[Distutils] distribute 0.6.10 and convert_2to3_doctests
ben+python at benfinney.id.au
Sat Jan 30 01:32:23 CET 2010
"P.J. Eby" <pje at telecommunity.com> writes:
> At 04:05 PM 1/29/2010 -0500, Barry Warsaw wrote:
> >The important thing is to have exactly one place to set the package's
> >version number.
> Put it in setup.py, then. If you absolutely must have a __version__
> at runtime, use this to extract it from the installation metadata:
> __version__ = pkg_resources.require('MyProject').version
> Mostly, though, I don't bother with having a __version__ in my modules
> or packages any more, since you can just do the above if you want to
> check the installed version of something.
That assumes that the only things that will need to query the package's
version are Python modules. That's often not the case, especially when
there are other tools (e.g. shell programs, make files, or any program
not written in Python) that are part of the same package.
Better would be to have a *non-executable* data file containing the
version string and other such package meta-data. “Query the metadata”
should not necessarily imply “parse or execute a bunch of Python code”.
\ “None can love freedom heartily, but good men; the rest love |
`\ not freedom, but license.” —John Milton |
More information about the Distutils-SIG