brian-team/brian2 — pull request #123 by mstimberg (2013-09-19 15:39:48+00:00)
Title: Setuptools

Ok, the basic switch is done, if it works for you (I only tested on Linux), I think it is ready to merge.

Not much did change, there are some differences/new features, though:

* We do not have to update the list of packages whenever we rename/add/delete packages, only the template directories (because they are no Python packages) have to be mentioned explicitly
* There's an `ez_setup` bootstrap file which automatically downloads setuptools if it is not installed already. This is irrelevant in most cases (where users use pip or easy_install to download from pypi) but is a nice extra if you download the source tarball or clone the repository from git.
* We can build the documentation with `python setup.py build_sphinx` (this needs sphinx, of course). I think it's nice to include the doc sources in the source tarball, a user downloading the package can then build the docs on their own machine. It doesn't take up much space since we do not have to include the reference section which is auto-generated.
* We can run the test suite with `python setup.py nosetests` -- this does not seem very useful at first (after all, you can also run nosetests directly), but it is a nice shortcut for testing under Python 3: just use `python3 setup.py nosetests` and it will run the code through `2to3` and then run the test suite on the Python3 code.

As a general "note to ourselves": We should try not to rely on the `__file__` attribute of modules but rather use the `pkg_resource` mechanism (I changed this for the templates). In principle Python packages can be installed as single zip files and then the assumption of modules being files in the file system fails.