[Distutils] Specifying version information once

A. Cavallo a.cavallo at cavallinux.eu
Wed May 20 08:17:09 CEST 2009

> No, I would say “too much” here is importing a module not guaranteed to
> be installed, for creating something as simple as a version. I'd prefer
> the above to be::
>   $ cat _version.py
>   # This is an auto-generated file. Use magicbean to update.
>   version = "0.9.33"
>   $

Or my preferred way:
 $cat foobar/__init__.py
__version__ = "0.9.33"

and import foobar should not trigger code execution anyway IMHO so
$ python -c 'import foobar; print foobar.__version__'

> I still like the approach of having it in a module that can be imported
> to automatically have the name bound to an appropriate value.

Yes, agree 100% the KISS approach is always the best.


More information about the Distutils-SIG mailing list