diff --git a/.github/workflows/i18n.yml b/.github/workflows/i18n.yml index 411f80702..ee068c633 100644 --- a/.github/workflows/i18n.yml +++ b/.github/workflows/i18n.yml @@ -25,12 +25,12 @@ jobs: with: python-version: '3.12' cache: 'pip' - cache-dependency-path: setup.py + cache-dependency-path: pyproject.toml - name: Install dependencies run: | - sudo apt-get install -y gettext - python -m pip install --upgrade pip wheel setuptools + sudo apt-get install -y gettext + python -m pip install --upgrade pip pip install -e .[dev] - name: Run locale Update Script diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4c34793ff..13b52bf6c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -22,9 +22,8 @@ jobs: - name: Install dependencies run: | - sudo apt-get install -y gettext + sudo apt-get install -y gettext python -m pip install -U pip - python -m pip install -U setuptools twine wheel pip install -e .[dev] - name: Check locale @@ -36,8 +35,7 @@ jobs: - name: Build package run: | - python setup.py --version - python setup.py sdist --format=gztar bdist_wheel + python -m build twine check dist/* - name: Upload packages to Jazzband @@ -46,4 +44,4 @@ jobs: with: user: jazzband password: ${{ secrets.JAZZBAND_RELEASE_KEY }} - repository_url: https://jazzband.co/projects/djangorestframework-simplejwt/upload + repository-url: https://jazzband.co/projects/djangorestframework-simplejwt/upload diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7ce5e28aa..df5ff7839 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -41,7 +41,7 @@ jobs: with: path: ${{ steps.pip-cache.outputs.dir }} key: - ${{ matrix.python-version }}-v1-${{ hashFiles('**/setup.py') }} + ${{ matrix.python-version }}-v1-${{ hashFiles('**/pyproject.toml') }} restore-keys: | ${{ matrix.python-version }}-v1- diff --git a/.readthedocs.yml b/.readthedocs.yml index 8896b7862..0fd7dea55 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -8,8 +8,7 @@ build: python: install: - # Install dependencies from setup.py . - - method: setuptools + - method: pip path: . # Build documentation in the docs/ directory with Sphinx diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index 1501b7de9..000000000 --- a/MANIFEST.in +++ /dev/null @@ -1,7 +0,0 @@ -include README.rst -include LICENSE.txt -include rest_framework_simplejwt/py.typed -recursive-include rest_framework_simplejwt/locale *.mo -recursive-include rest_framework_simplejwt/locale *.po -recursive-exclude * __pycache__ -recursive-exclude * *.py[co] diff --git a/Makefile b/Makefile index 83b7a02e5..7e06f0785 100644 --- a/Makefile +++ b/Makefile @@ -3,9 +3,7 @@ clean: clean-build clean-pyc .PHONY: clean-build clean-build: - rm -fr build/ rm -fr dist/ - rm -fr *.egg-info .PHONY: clean-pyc clean-pyc: @@ -33,7 +31,6 @@ test-all: .PHONY: build-docs build-docs: sphinx-apidoc -o docs/ . \ - setup.py \ *confest* \ tests/* \ rest_framework_simplejwt/token_blacklist/* \ @@ -59,10 +56,10 @@ pushversion: .PHONY: publish publish: - python setup.py sdist bdist_wheel + python -m build --wheel twine upload dist/* .PHONY: dist dist: clean - python setup.py sdist bdist_wheel + python -m build --wheel ls -l dist diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 000000000..c1bbb58f2 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,92 @@ +[build-system] +requires = ["hatchling>=1.23.0", "hatch-vcs"] +build-backend = "hatchling.build" + +[project] +name = "djangorestframework-simplejwt" +dynamic = ["version"] +description = "A minimal JSON Web Token authentication plugin for Django REST Framework" +readme = "README.rst" +license = "MIT" +license-files = { globs = ["LICENSE*", "licenses/*"] } +requires-python = ">=3.8" +authors = [ + { name = "David Sanders", email = "davesque@gmail.com" }, +] +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Environment :: Web Environment", + "Framework :: Django", + "Framework :: Django :: 3.2", + "Framework :: Django :: 4.1", + "Framework :: Django :: 4.2", + "Framework :: Django :: 5.0", + "Intended Audience :: Developers", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Topic :: Internet :: WWW/HTTP", +] +dependencies = [ + "django>=3.2", + "djangorestframework>=3.12", + "pyjwt>=1.7.1,<3", +] + +[project.optional-dependencies] +crypto = [ + "cryptography>=3.3.1", +] +dev = [ + "build", + "ipython", + "pytest-watch", + "twine", + "wheel", + "djangorestframework-simplejwt[doc,lint,test,python-jose]", +] +doc = [ + "Sphinx>=1.6.5,<2", + "sphinx_rtd_theme>=0.1.9", +] +lint = [ + "flake8", + "isort", + "pep8", +] +python-jose = [ + "python-jose==3.3.0", +] +test = [ + "cryptography", + "freezegun", + "pytest", + "pytest-cov", + "pytest-django", + "pytest-xdist", + "tox", +] + +[project.urls] +Homepage = "https://github.com/jazzband/djangorestframework-simplejwt" + +[tool.hatch.version] +source = "vcs" +raw-options = { version_scheme = "post-release" } + +[tool.hatch.build.targets.wheel] +# Jazzband's release process is limited to 2.2 metadata +# - see https://github.com/jazzband/help/issues/360 +core-metadata-version = "2.2" +packages = ["rest_framework_simplejwt"] + +[tool.hatch.build.targets.sdist] +# Jazzband's release process is limited to 2.2 metadata +# - see https://github.com/jazzband/help/issues/360 +core-metadata-version = "2.2" diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 498ec14ac..000000000 --- a/setup.cfg +++ /dev/null @@ -1,2 +0,0 @@ -[metadata] -license_file = LICENSE.txt diff --git a/setup.py b/setup.py deleted file mode 100755 index 995e63533..000000000 --- a/setup.py +++ /dev/null @@ -1,88 +0,0 @@ -#!/usr/bin/env python -from pathlib import Path - -from setuptools import find_packages, setup - -extras_require = { - "test": [ - "cryptography", - "freezegun", - "pytest-cov", - "pytest-django", - "pytest-xdist", - "pytest", - "tox", - ], - "lint": [ - "flake8", - "pep8", - "isort", - ], - "doc": [ - "Sphinx>=1.6.5,<2", - "sphinx_rtd_theme>=0.1.9", - ], - "dev": [ - "pytest-watch", - "wheel", - "twine", - "ipython", - ], - "python-jose": [ - "python-jose==3.3.0", - ], - "crypto": [ - "cryptography>=3.3.1", - ], -} - -extras_require["dev"] = ( - extras_require["dev"] - + extras_require["test"] - + extras_require["lint"] - + extras_require["doc"] - + extras_require["python-jose"] -) - - -setup( - name="djangorestframework_simplejwt", - use_scm_version={"version_scheme": "post-release"}, - setup_requires=["setuptools_scm"], - url="https://github.com/jazzband/djangorestframework-simplejwt", - license="MIT", - description="A minimal JSON Web Token authentication plugin for Django REST Framework", - long_description=Path("README.rst").read_text(encoding="utf-8"), - author="David Sanders", - author_email="davesque@gmail.com", - install_requires=[ - "django>=3.2", - "djangorestframework>=3.12", - "pyjwt>=1.7.1,<3", - ], - python_requires=">=3.8", - extras_require=extras_require, - packages=find_packages(exclude=["tests", "tests.*", "licenses", "requirements"]), - include_package_data=True, - zip_safe=False, - classifiers=[ - "Development Status :: 5 - Production/Stable", - "Environment :: Web Environment", - "Framework :: Django", - "Framework :: Django :: 3.2", - "Framework :: Django :: 4.1", - "Framework :: Django :: 4.2", - "Framework :: Django :: 5.0", - "Intended Audience :: Developers", - "License :: OSI Approved :: MIT License", - "Operating System :: OS Independent", - "Programming Language :: Python", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", - "Topic :: Internet :: WWW/HTTP", - ], -)