From 4b66e4eabf6577d43a685eb5eb013c954601cbbb Mon Sep 17 00:00:00 2001 From: Viicos <65306057+Viicos@users.noreply.github.com> Date: Mon, 24 Jun 2024 21:41:08 +0200 Subject: [PATCH] Switch to `pyproject.toml` --- .bumpversion.cfg | 10 ---- .flake8 | 3 + .github/workflows/ci.yml | 17 +++--- docs/conf.py | 2 +- pyproject.toml | 119 +++++++++++++++++++++++++++++++++++++++ setup.cfg | 100 -------------------------------- setup.py | 3 - tox.ini | 7 +-- 8 files changed, 134 insertions(+), 127 deletions(-) delete mode 100644 .bumpversion.cfg create mode 100644 .flake8 create mode 100644 pyproject.toml delete mode 100644 setup.cfg delete mode 100644 setup.py diff --git a/.bumpversion.cfg b/.bumpversion.cfg deleted file mode 100644 index d114fed..0000000 --- a/.bumpversion.cfg +++ /dev/null @@ -1,10 +0,0 @@ -[bumpversion] -commit = False -tag = False -current_version = 0.15.0 - -[bumpversion:file:setup.cfg] - -[bumpversion:file:README.rst] - -[bumpversion:file:docs/conf.py] diff --git a/.flake8 b/.flake8 new file mode 100644 index 0000000..6e29ba0 --- /dev/null +++ b/.flake8 @@ -0,0 +1,3 @@ +[flake8] +max-line-length=88 +exclude=env,.tox,doc diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 705c9f5..eb7bbf9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,7 +21,7 @@ jobs: exclude: - python: '3.11' django: '3.2' - - python: '3.12' + - python: 3.12' django: '3.2' # support for django 4.2 was added in 4.0 - django: '4.2' @@ -64,6 +64,9 @@ jobs: name: Publish package to PyPI runs-on: ubuntu-latest needs: tests + environment: release + permissions: + id-token: write if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') @@ -73,12 +76,10 @@ jobs: with: python-version: '3.10' - - name: Build sdist and wheel + - name: Build wheel run: | - pip install pip setuptools wheel --upgrade - python setup.py sdist bdist_wheel + pip install build --upgrade + python -m build + - name: Publish a Python distribution to PyPI - uses: pypa/gh-action-pypi-publish@v1.4.1 - with: - user: __token__ - password: ${{ secrets.PYPI_TOKEN }} + uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/docs/conf.py b/docs/conf.py index 43a3378..26d87c4 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -22,7 +22,7 @@ # -- Project information ----------------------------------------------------- project = "mozilla_django_oidc_db" -copyright = "2024, Maykin Media" +copyright = "2021, Maykin Media" author = "Maykin Media" # The full version, including alpha/beta/rc tags diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..7ad342c --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,119 @@ +[build-system] +requires = ["setuptools>=61.0.0"] +build-backend = "setuptools.build_meta" + +[project] +name = "mozilla-django-oidc-db" +version = "0.15.0" +description = "A database-backed configuration for mozilla-django-oidc" +authors = [ + {name = "Maykin Media", email = "support@maykinmedia.nl"} +] +readme = "README.rst" +license = {file = "LICENSE"} +keywords = ["OIDC", "django", "database", "authentication"] +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Framework :: Django", + "Framework :: Django :: 3.2", + "Framework :: Django :: 4.2", + "Intended Audience :: Developers", + "Operating System :: Unix", + "Operating System :: MacOS", + "Operating System :: Microsoft :: Windows", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Topic :: Software Development :: Libraries :: Python Modules", +] +requires-python = ">=3.10" +dependencies = [ + "django>=3.2", + "django-jsonform", + "django-solo", + "glom", + "mozilla-django-oidc>=3.0.0", +] + +[project.urls] +Homepage = "/~https://github.com/maykinmedia/mozilla-django-oidc-db" +Documentation = "https://mozilla-django-oidc-db.readthedocs.io/en/latest/" +"Bug Tracker" = "/~https://github.com/maykinmedia/mozilla-django-oidc-db/issues" +"Source Code" = "/~https://github.com/maykinmedia/mozilla-django-oidc-db" +Changelog = "/~https://github.com/maykinmedia/mozilla-django-oidc-db/blob/master/CHANGELOG.rst" + +[project.optional-dependencies] +tests = [ + "psycopg2", + "pytest", + "pytest-django", + "pytest-mock", + "pytest-recording", + "requests-mock", + "factory-boy", + "pyquery", + "tox", + "isort", + "black", + "flake8", +] +coverage = [ + "pytest-cov", +] +docs = [ + "sphinx", + "sphinx-rtd-theme", +] +release = [ + "bump-my-version", + "twine", +] + +[tool.setuptools.packages.find] +include = ["mozilla_django_oidc_db*"] +namespaces = false + +[tool.isort] +profile = "black" +combine_as_imports = true +known_django = "django" +known_first_party="mozilla_django_oidc_db" +sections=["FUTURE", "STDLIB", "DJANGO", "THIRDPARTY", "FIRSTPARTY", "LOCALFOLDER"] + +[tool.pytest.ini_options] +testpaths = ["tests"] +DJANGO_SETTINGS_MODULE = "testapp.settings" + +[tool.bumpversion] +current_version = "0.15.0" +files = [ + {filename = "pyproject.toml"}, + {filename = "README.rst"}, + {filename = "docs/conf.py"}, +] + +[tool.coverage.run] +branch = true +source = [ + "mozilla_django_oidc_db" +] +omit = [ + "mozilla_django_oidc_db/migrations/*", +] + +[tool.coverage.report] +exclude_also = [ + "if (typing\\.)?TYPE_CHECKING:", + "@(typing\\.)?overload", + "class .*\\(.*Protocol.*\\):", + "@(abc\\.)?abstractmethod", + "raise NotImplementedError", + "\\.\\.\\.", + "pass", +] +omit = [ + "mozilla_django_oidc_db/migrations/*", +] + +[tool.coverage.html] +directory = "cover" diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 6be08d7..0000000 --- a/setup.cfg +++ /dev/null @@ -1,100 +0,0 @@ -# setuptools config -# see http://setuptools.readthedocs.io/en/latest/setuptools.html#configuring-setup-using-setup-cfg-files -[metadata] -name = mozilla-django-oidc-db -version = 0.15.0 -description = A database-backed configuration for mozilla-django-oidc -long_description = file: README.rst -url = /~https://github.com/maykinmedia/mozilla-django-oidc-db -project_urls = - Documentation = https://mozilla-django-oidc-db.readthedocs.io/en/latest/ - Changelog = /~https://github.com/maykinmedia/mozilla-django-oidc-db/blob/master/CHANGELOG.rst - Bug Tracker = /~https://github.com/maykinmedia/mozilla-django-oidc-db/issues - Source Code = /~https://github.com/maykinmedia/mozilla-django-oidc-db -license = MIT -author = Maykin Media -author_email = support@maykinmedia.nl -keywords = OIDC, django, database, authentication -classifiers = - Development Status :: 4 - Beta - Framework :: Django - Framework :: Django :: 3.2 - Framework :: Django :: 4.2 - Intended Audience :: Developers - Operating System :: Unix - Operating System :: MacOS - Operating System :: Microsoft :: Windows - Programming Language :: Python :: 3.10 - Programming Language :: Python :: 3.11 - Programming Language :: Python :: 3.12 - Topic :: Software Development :: Libraries :: Python Modules - -[options] -zip_safe = False -include_package_data = True -packages = find: -python_requires = >=3.10 -install_requires = - Django >=3.2 - django-jsonform - django-solo - glom - mozilla-django-oidc >=3.0.0 -tests_require = - psycopg2 - pytest - pytest-django - pytest-mock - pytest-recording - requests-mock - factory-boy - pyquery - tox - isort - black - -[options.extras_require] -tests = - psycopg2 - pytest - pytest-django - pytest-mock - pytest-recording - requests-mock - factory-boy - pyquery - tox - isort - black -pep8 = flake8 -coverage = pytest-cov -docs = - sphinx - sphinx-rtd-theme -release = - bumpversion - twine - -# 3rd party configuration - -[aliases] -test=pytest - -[isort] -profile = black -combine_as_imports = true -known_django = django -known_first_party=mozilla_django_oidc_db -sections=FUTURE,STDLIB,DJANGO,THIRDPARTY,FIRSTPARTY,LOCALFOLDER - -[tool:pytest] -DJANGO_SETTINGS_MODULE = testapp.settings -testpaths = tests - -[pep8] -max-line-length=88 -exclude=env,.tox,doc - -[flake8] -max-line-length=88 -exclude=env,.tox,doc diff --git a/setup.py b/setup.py deleted file mode 100644 index 6068493..0000000 --- a/setup.py +++ /dev/null @@ -1,3 +0,0 @@ -from setuptools import setup - -setup() diff --git a/tox.ini b/tox.ini index c3b2944..648d08e 100644 --- a/tox.ini +++ b/tox.ini @@ -9,8 +9,6 @@ skip_missing_interpreters = true [gh-actions] python = - 3.8: py38 - 3.9: py39 3.10: py310 3.11: py311 3.12: py312 @@ -40,8 +38,7 @@ passenv = setenv = PYTHONPATH = {toxinidir} commands = - py.test tests \ - --junitxml=reports/junit.xml \ + pytest tests \ --cov --cov-report xml:reports/coverage-{envname}.xml \ {posargs} @@ -64,6 +61,6 @@ extras = docs tests commands= - py.test check_sphinx.py -v \ + pytest check_sphinx.py -v \ --tb=auto \ {posargs}