Skip to content

Commit d21d8c2

Browse files
committed
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.
1 parent 02a17e1 commit d21d8c2

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

oidc_provider/version.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__version__ = '0.6.2'

setup.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,16 @@
44
setup,
55
)
66

7+
version = {}
8+
with open("./oidc_provider/version.py") as fp:
9+
exec(fp.read(), version)
710

811
# allow setup.py to be run from any path
912
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
1013

1114
setup(
1215
name='django-oidc-provider',
13-
version='0.6.2',
16+
version=version['__version__'],
1417
packages=find_packages(),
1518
include_package_data=True,
1619
license='MIT License',

0 commit comments

Comments
 (0)