I am writing Flask based module with standard setup.py in root directory:
#!/usr/bin/env python
from distutils.core import setup
setup(name=modulename,
version='0.2.16.dev0',
description='...',
author='...',
...
)
I am willing to expose module version using Flask API. What is the correct way to access my own module version programmatically?
Thanks
Update: I forgot to mention that the module is not necessary installed as a standard module and may not be available in PYTHONPATH. This is why this question is not like this and this
Put version in
version.py
or__version__.py
or such (inside the package) and import it both insetup.py
and the application:If importing your package in
setup.py
causes unwanted side effects you can just readmypackage/version.py
and parse it orexec()
or import it alone (without the package) with the trick: