dsacre/mididings — pull request #10 by SpotlightKid (2014-09-15 23:02:51+00:00)
Title: Extended setuptools and PyPI support

To further easy installation of mididings, I propose a number of changes through this PR to make deployment via setuptools to PyPI and installation via pip easier (but all the while keeping compatibility with plain distutils):

* Declare required and optional dependencies in `setup.py`.
* Move scripts into a sub-package and declare [console script entry point wrappers](http://pythonhosted.org//setuptools/setuptools.html#automatic-script-creation) and dependencies for them in `setup.py` (more on this below).
* Add a long description read from the README, which was slightly tweaked, to make the PyPI page look nice.
* Add `wheel` package dependency via `setup_requires` option to allow `bdist_wheel` build target (technically this is only required for the release process, so this may be left out).
* Add `dependency_links` option to `setup` to mitigate missing PyPI entry for `pysmf` (only works for older versions of pip (<1.5) or easy_install, though).

If this PR is accepted and mididings, pyliblo and pysmf are eventually registered on PyPI and wheel distributions are uploaded to PyPI, it is possible to install mididings with all dependencies via:

pip install mididings[autorestart,dbus,osc,smf,xdg]

I tested this with a local PyPI server ([dev-pi](https://pypi.python.org/pypi/devpi)), and installation with the above command took less than two seconds (with pre-compiled wheels available for my system) in a new virtualenv.

About the script wrapper entry points: the rationale for this is, that IMHO all code should live in the mididings package and the functionality of the scripts should be available by importing them as a module and calling their `main` function (new) as well. The script wrappers also provide better support across platforms (maybe mididings will work on Windows some day as well?) and give a slightly better error message when a dependency is not installed.

For keeping compatibility with a development process without setuptools / virtualenv or installation with plain distutils, I replaced the old scripts in the top-level `scripts` dir with thin wrappers around the modules in `mididings.scripts`.

Another possibility would be to put each script into the appropriate sub-package, i.e. the `livedings` script into `mididings.live` and name it `__main__.py` to additionally support calling it via `python -m mididings.live`.