diff --git a/.bumpversion.cfg b/.bumpversion.cfg deleted file mode 100644 index e76bc60..0000000 --- a/.bumpversion.cfg +++ /dev/null @@ -1,10 +0,0 @@ -[bumpversion] -commit = False -tag = False -current_version = 0.18.1 - -[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 a712cec..992386c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -72,8 +72,8 @@ jobs: - name: Build sdist and 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@release/v1 diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..25d389f --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,125 @@ +[build-system] +requires = ["setuptools>=61.0.0"] +build-backend = "setuptools.build_meta" + +[project] +name = "mozilla-django-oidc-db" +version = "0.18.1" +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 :: 4 - Beta", + "Framework :: Django", + "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>=4.2", + "django-jsonform", + "django-solo", + "glom", + "mozilla-django-oidc>=3.0.0", + "typing-extensions>=4.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"] +skip = ["env", "node_modules", ".tox"] +skip_glob = ["**/migrations/**"] + +[tool.pytest.ini_options] +testpaths = ["tests"] +DJANGO_SETTINGS_MODULE = "testapp.settings" +markers = [ + "oidcconfig: keyword arguments for the OIDC config", + "auth_request: additional configuration for the auth_request fixture", + "callback_request: additional configuration for the callback_request fixture", + "mock_backend_claims: claims to be returned by the mock backend fixture", +] + +[tool.bumpversion] +current_version = "0.18.1" +files = [ + {filename = "pyproject.toml"}, + {filename = "README.rst"}, + {filename = "docs/conf.py"}, +] + +[tool.coverage.run] +branch = true +source = [ + "mozilla_django_oidc_db" +] +omit = [ + # migrations run while django initializes the test db + "*/migrations/*", +] + +[tool.coverage.report] +exclude_also = [ + "if (typing\\.)?TYPE_CHECKING:", + "@(typing\\.)?overload", + "class .*\\(.*Protocol.*\\):", + "@(abc\\.)?abstractmethod", + "raise NotImplementedError", + "\\.\\.\\.", + "pass", +] +omit = [ + "*/migrations/*", +] diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 9e9eb0d..0000000 --- a/setup.cfg +++ /dev/null @@ -1,125 +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.18.1 -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 :: 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 >= 4.2 - django-jsonform - django-solo - glom - mozilla-django-oidc >= 4.0.0 - typing-extensions >= 4.0.0 -tests_require = - psycopg2 - pytest - pytest-django - pytest-mock - pytest-recording - requests-mock - factory-boy - pyquery - tox - isort - black - -[options.packages.find] -include = mozilla_django_oidc_db* - -[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 -markers = - oidcconfig: keyword arguments for the OIDC config - auth_request: additional configuration for the auth_request fixture - callback_request: additional configuration for the callback_request fixture - mock_backend_claims: claims to be returned by the mock backend fixture - -[pep8] -max-line-length=88 -exclude=env,.tox,doc - -[flake8] -max-line-length=88 -exclude=env,.tox,doc - -[coverage:run] -branch = true -source = mozilla_django_oidc_db -omit = - # migrations run while django initializes the test db - */migrations/* - -[coverage:report] -exclude_also = - if (typing\.)?TYPE_CHECKING: - @(typing\.)?overload - class .*\(.*Protocol.*\): - @(abc\.)?abstractmethod - raise NotImplementedError - \.\.\. - pass 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/tests/test_admin_form.py b/tests/test_admin_form.py index 6cbdd3b..0660fcc 100644 --- a/tests/test_admin_form.py +++ b/tests/test_admin_form.py @@ -85,7 +85,7 @@ class ExtendedOpenIDConnectConfigForm(OpenIDConnectConfigForm): # Define an extra field to derive from the configuration oidc_mapping = dict( **OpenIDConnectConfigForm.oidc_mapping, - **{"logout_endpoint": "end_session_endpoint"} + **{"logout_endpoint": "end_session_endpoint"}, ) form = ExtendedOpenIDConnectConfigForm(data=form_data) diff --git a/tox.ini b/tox.ini index 736f158..2ea6c0b 100644 --- a/tox.ini +++ b/tox.ini @@ -33,7 +33,7 @@ passenv = setenv = PYTHONPATH = {toxinidir} commands = - py.test tests \ + pytest tests \ --cov --cov-report xml:reports/coverage-{envname}.xml \ {posargs} @@ -56,6 +56,6 @@ extras = docs tests commands= - py.test check_sphinx.py -v \ + pytest check_sphinx.py -v \ --tb=auto \ {posargs}