From aaebe1aa453da392dff44690760b50cd2a10c6d1 Mon Sep 17 00:00:00 2001 From: Jannis Leidel Date: Fri, 14 May 2021 09:27:50 +0200 Subject: [PATCH] Move to setuptools_scm instead of bumpversion. (#403) --- .bumpversion.cfg | 22 ---------------------- Makefile | 4 ---- docs/conf.py | 18 +++++------------- rest_framework_simplejwt/__init__.py | 8 +++++++- setup.py | 4 ++-- 5 files changed, 14 insertions(+), 42 deletions(-) delete mode 100644 .bumpversion.cfg diff --git a/.bumpversion.cfg b/.bumpversion.cfg deleted file mode 100644 index 71c3d887a..000000000 --- a/.bumpversion.cfg +++ /dev/null @@ -1,22 +0,0 @@ -[bumpversion] -current_version = 4.6.0 -commit = True -tag = True -parse = (?P\d+)\.(?P\d+)\.(?P\d+)(-(?P[^.]*)\.(?P\d+))? -serialize = - {major}.{minor}.{patch}-{stage}.{devnum} - {major}.{minor}.{patch} - -[bumpversion:part:stage] -optional_value = stable -first_value = stable -values = - alpha - beta - stable - -[bumpversion:part:devnum] - -[bumpversion:file:setup.py] -search = version='{current_version}', -replace = version='{new_version}', diff --git a/Makefile b/Makefile index 8e6b86628..b095e0e9c 100644 --- a/Makefile +++ b/Makefile @@ -54,10 +54,6 @@ docs: build-docs linux-docs: build-docs xdg-open docs/_build/html/index.html -.PHONY: bumpversion -bumpversion: - bumpversion $(bump) - .PHONY: pushversion pushversion: git push upstream && git push upstream --tags diff --git a/docs/conf.py b/docs/conf.py index 43ed995cc..8ea193b94 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -15,16 +15,8 @@ # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. -#sys.path.insert(0, os.path.abspath('.')) +from pkg_resources import get_distribution -import os - -DIR = os.path.dirname('__file__') -with open (os.path.join(DIR, '../setup.py'), 'r') as f: - for line in f: - if 'version=' in line: - setup_version = line.split('\'')[1] - break # -- General configuration ------------------------------------------------ @@ -85,15 +77,15 @@ def django_configure(): project = 'Simple JWT' copyright = '2020, David Sanders' -__version__ = setup_version # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # -# The short X.Y version. -version = '.'.join(__version__.split('.')[:2]) # The full version, including alpha/beta/rc tags. -release = __version__ +release = get_distribution("django-rest-framework-simplejwt").version + +# The short X.Y version. +version = ".".join(release.split(".")[:2]) # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/rest_framework_simplejwt/__init__.py b/rest_framework_simplejwt/__init__.py index 372a50797..f745897e4 100644 --- a/rest_framework_simplejwt/__init__.py +++ b/rest_framework_simplejwt/__init__.py @@ -1 +1,7 @@ -__version__ = '4.7.0' +from pkg_resources import get_distribution, DistributionNotFound + +try: + __version__ = get_distribution("django-rest-framework-simplejwt").version +except DistributionNotFound: + # package is not installed + __version__ = None diff --git a/setup.py b/setup.py index 020264559..ac64330f5 100755 --- a/setup.py +++ b/setup.py @@ -23,7 +23,6 @@ 'sphinx_rtd_theme>=0.1.9', ], 'dev': [ - 'bumpversion>=0.5.3,<1', 'pytest-watch', 'wheel', 'twine', @@ -45,7 +44,8 @@ setup( name='djangorestframework_simplejwt', - version='4.6.0', + use_scm_version={"version_scheme": "post-release"}, + setup_requires=["setuptools_scm"], url='https://github.com/SimpleJWT/django-rest-framework-simplejwt', license='MIT', description='A minimal JSON Web Token authentication plugin for Django REST Framework',