[Distutils] on storing vcs version infos in sdists

David Cournapeau cournape at gmail.com
Wed May 26 00:44:15 CEST 2010

On Wed, May 26, 2010 at 12:58 AM, Ronny Pfannschmidt
<Ronny.Pfannschmidt at gmx.de> wrote:
> hi,
> whats a good place to store version information from a vcs in a sdist,
> without needing to drop them into python files.

What's the reason for not putting it in python files ? If the reason
is to avoid hardcoding things, you can generate the python file.

What I generally do is to "build" the version in setup.py, and
generate a trivial __version.py module which is imported by the module
to know its version. The __version.py is always generated everytime
setup.py (so will be taken into account when doing sdist), and I
protect the import of __version to have a default value, so that the
package may be imported before any call to setup.py


More information about the Distutils-SIG mailing list