[Distutils] Specifying version information once
ben+python at benfinney.id.au
Wed May 20 02:17:31 CEST 2009
Jean-Paul Calderone <exarkun at divmod.com> writes:
> For a long time, the idiom I've used to specify version information in my
> distutils-based packages has been this simple one: put version information
> into the Python package somewhere, structure the source layout so that the
> package can be imported directly from an unpacked source tarball (or vcs wc),
> and import the version into setup.py. This worked great. And I only had to
> define my version once.
> Increasingly, it seems that new distutils-related tools don't support this
> idiom and break in various ways. (eg
Those breakages seem to be caused in part because the module containing
version information is doing too much.
> What is the recommendation for specifying version information in a way
> which is compatible with all these new tools?
I would recommend having a module in your package whose *only*
responsibility is version information for the package, so that importing
it won't break in different environments.
That module can the be imported both by the package itself when it needs
to know its version string, and by the ‘setup.py’ to get that same
version string for package building.
\ “The only tyrant I accept in this world is the still voice |
`\ within.” —Mahatma Gandhi |
More information about the Distutils-SIG