Re:How To Package Your Python Code
by gvalkov on Sunday November 18, 2012 @05:48PM
(#4801972)
It actually comes in handy if you're using Sphinx and don't want to maintain release and version in conf.py separately from the version in setup.py. There's no reasons why the data should be consumable only by setuptools .
[ Parent
| on HN ]
You can use pkg_resources which comes with setuptools to look up the version number of your package in setup.py:
import pkg_resources
pkg_resources.get_distribution("PIL").version
Re:How To Package Your Python Code
by borntyping on Sunday November 18, 2012 @05:51PM
(#4801981)
I put the version information inside the package, then anything with access to the package (which both setup.py and sphinx have) can access it - quite useful for doing things like checking the version number from the REPL, for instance.