diff --git a/django_auth_adfs/__init__.py b/django_auth_adfs/__init__.py index 6a74b3d..ed49459 100644 --- a/django_auth_adfs/__init__.py +++ b/django_auth_adfs/__init__.py @@ -1,7 +1,10 @@ -""" -Don't put imports or code here -This file is imported by setup.py -Adding imports here will break setup.py -""" +import sys -__version__ = '1.11.0' +if sys.version_info[:2] >= (3, 8): + from importlib import metadata +else: + import importlib_metadata as metadata + +__version__ = metadata.version(__package__) + +del metadata # optional, avoids polluting the results of dir(__package__) diff --git a/pyproject.toml b/pyproject.toml index b114b1e..65aa001 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = 'django-auth-adfs' -version = "1.11.0" # Remember to also change __init__.py version +version = "1.11.0" description = 'A Django authentication backend for Microsoft ADFS and AzureAD' authors = ['Joris Beckers '] maintainers = ['Jonas Krüger Svensson ', 'Sondre Lillebø Gundersen '] @@ -43,6 +43,7 @@ requests = '^1 || ^2' urllib3 = '^1.26.0' cryptography = '>=1.7,<39.0' PyJWT = "^2.4.0" +importlib-metadata = {version = ">=1.7.0", python = "<3.8"} [tool.poetry.dev-dependencies] responses = '*'