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.pyor__version__.pyor such (inside the package) and import it both insetup.pyand the application:If importing your package in
setup.pycauses unwanted side effects you can just readmypackage/version.pyand parse it orexec()or import it alone (without the package) with the trick: