Make version available in code (#282)

It seems like there are multi ways to achieve that, all of them highliting
the importance of maintain a single source of truth for the version number.

More info: https://packaging.python.org/guides/single-sourcing-package-version/.

This PR includes one possible approach, open to discussion.
This commit is contained in:
Christian Bouvier 2018-10-14 15:02:56 -03:00
parent 02a17e10d5
commit d21d8c29b0
2 changed files with 5 additions and 1 deletions

1
oidc_provider/version.py Normal file
View file

@ -0,0 +1 @@
__version__ = '0.6.2'

View file

@ -4,13 +4,16 @@ from setuptools import (
setup,
)
version = {}
with open("./oidc_provider/version.py") as fp:
exec(fp.read(), version)
# allow setup.py to be run from any path
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
setup(
name='django-oidc-provider',
version='0.6.2',
version=version['__version__'],
packages=find_packages(),
include_package_data=True,
license='MIT License',