After reading the python documentation (http://www.python.org/dev/peps/pep-0396/) I was more confused than before about how to set the __version__
attribute for packages appropriately. It is mentioned to put them into the setup.py
file, which kind of confuses me: it would not be available as my_package.__version__
, would it?
I ended up to import the version attribute from a separate file.
So my "version" file usually is
my_package/
__init__.py
my_module1/
...
my_module2/
...
my_module3/
...
info/
__init__.py
version.py
__version__ = '0.1.0'
and in the uppermost __init__.py
I import the __version__
attribute
from info.version
:
import __version__
so that one can get version number via
my_package.__version__
I am just wondering if this is a "okay" approach, and if something speaks against doing it like this? I am looking forward to your opinions and suggestions!