From d21d8c29b0c4d25cf72ea4679c049d27e89ef126 Mon Sep 17 00:00:00 2001 From: Christian Bouvier Date: Sun, 14 Oct 2018 15:02:56 -0300 Subject: [PATCH] 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. --- oidc_provider/version.py | 1 + setup.py | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 oidc_provider/version.py diff --git a/oidc_provider/version.py b/oidc_provider/version.py new file mode 100644 index 0000000..39cae21 --- /dev/null +++ b/oidc_provider/version.py @@ -0,0 +1 @@ +__version__ = '0.6.2' \ No newline at end of file diff --git a/setup.py b/setup.py index 2d6b5d4..70663bc 100644 --- a/setup.py +++ b/setup.py @@ -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',