Skip to content

Commit

Permalink
Merge pull request #56 from maykinmedia/pyproject
Browse files Browse the repository at this point in the history
Switch to `pyproject.toml`
  • Loading branch information
sergei-maertens authored Jun 26, 2024
2 parents a514595 + d2661ef commit 874ab6a
Show file tree
Hide file tree
Showing 16 changed files with 161 additions and 170 deletions.
10 changes: 0 additions & 10 deletions .bumpversion.cfg

This file was deleted.

3 changes: 3 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[flake8]
max-line-length=88
exclude=env,.tox,doc
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,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
Expand Down
2 changes: 1 addition & 1 deletion digid_eherkenning/backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class DigiDBackend(BSNBackendMixin, BaseSaml2Backend):
BaseSaml2Backend.error_messages,
**{
"digid_no_bsn": _("Login failed due to no BSN being returned by DigiD."),
}
},
)

def authenticate(self, request, digid=None, saml_art=None, errors=[]):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# Generated by Django 4.2.4 on 2023-08-15 13:47

import digid_eherkenning.choices
from django.db import migrations, models

import digid_eherkenning.choices

from ..choices import AssuranceLevels


Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Generated by Django 4.2.4 on 2023-09-01 09:23

from django.db import migrations, models
import uuid

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Generated by Django 4.2.6 on 2023-10-20 08:40

from django.db import migrations, models

import privates.fields
import privates.storages

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Generated by Django 4.2.10 on 2024-03-04 13:08

from django.db import migrations, models

import digid_eherkenning.models.eherkenning


Expand Down
2 changes: 1 addition & 1 deletion digid_eherkenning/mock/backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class DigiDBackend(BSNBackendMixin, BaseBackend):
"digid_no_bsn": _("Login failed due to no BSN being returned by DigiD."),
"digid_len_bsn": _("Login failed due to no BSN having more then 9 digits."),
"digid_num_bsn": _("Login failed due to no BSN not being numerical."),
}
},
)

def authenticate(self, request, bsn=None):
Expand Down
7 changes: 4 additions & 3 deletions digid_eherkenning/saml2/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,10 @@ def create_config_dict(self, conf):
service_description = get_service_description(conf)
requested_attributes = get_requested_attributes(conf)

with conf["cert_file"].open("r") as cert_file, conf["key_file"].open(
"r"
) as key_file:
with (
conf["cert_file"].open("r") as cert_file,
conf["key_file"].open("r") as key_file,
):
certificate = cert_file.read()
privkey = key_file.read()

Expand Down
7 changes: 4 additions & 3 deletions digid_eherkenning/saml2/eherkenning.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,9 +469,10 @@ def create_config_dict(self, conf: EHerkenningConfig) -> EHerkenningSAMLConfig:
config_dict: EHerkenningSAMLConfig = super().create_config_dict(conf)

attribute_consuming_services = create_attribute_consuming_services(conf)
with conf["cert_file"].open("r") as cert_file, conf["key_file"].open(
"r"
) as key_file:
with (
conf["cert_file"].open("r") as cert_file,
conf["key_file"].open("r") as key_file,
):
certificate = cert_file.read()
privkey = key_file.read()
acs_url = furl(conf["base_url"]) / conf["acs_path"]
Expand Down
128 changes: 128 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
[build-system]
requires = ["setuptools>=61.0.0"]
build-backend = "setuptools.build_meta"

[project]
name = "django-digid-eherkenning"
version = "0.15.0"
description = "A Django app for DigiD/eHerkenning authentication flows"
authors = [
{name = "Maykin Media", email = "[email protected]"}
]
readme = "README.rst"
license = {file = "LICENSE"}
keywords = ["django", "authentication", "digid", "eherkenning", "eidas", "dutch", "nl", "netherlands"]
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 = [
"cryptography>=40.0.0",
"django>=4.2.0",
"django-sessionprofile",
"django-simple-certmanager",
"django-solo",
"lxml>=4.7.1",
"furl",
"maykin-python3-saml>=1.16.0",
]

[project.urls]
Homepage = "https://github.com/maykinmedia/django-digid-eherkenning"
Documentation = "https://django-digid-eherkenning.readthedocs.io/en/latest/"
"Bug Tracker" = "https://github.com/maykinmedia/django-digid-eherkenning/issues"
"Source Code" = "https://github.com/maykinmedia/django-digid-eherkenning"
Changelog = "https://github.com/maykinmedia/django-digid-eherkenning/blob/master/CHANGELOG.rst"

[project.optional-dependencies]
oidc = [
"mozilla-django-oidc-db>=0.18.0",
]
tests = [
"django-test-migrations",
"pytest",
"pytest-django",
"pytest-mock",
"responses",
"freezegun",
"tox",
"isort",
"black",
"flake8",
]
coverage = [
"pytest-cov",
]
docs = [
"sphinx",
"sphinx-rtd-theme",
"psycopg2",
]
release = [
"bump-my-version",
"twine",
]

[tool.setuptools.packages.find]
include = ["digid_eherkenning*"]
namespaces = false

[tool.isort]
profile = "black"
combine_as_imports = true
known_django = "django"
known_first_party="digid_eherkenning"
sections=["FUTURE", "STDLIB", "DJANGO", "THIRDPARTY", "FIRSTPARTY", "LOCALFOLDER"]
skip = ["env", "node_modules", ".tox"]
skip_glob = ["**/migrations/**"]

[tool.pytest.ini_options]
testpaths = ["tests"]
DJANGO_SETTINGS_MODULE = "tests.project.settings"
markers = [
"callback: additional configuration for the callback fixture",
"mock_backend: class/claims to be returned by the mock backend fixture",
]

[tool.bumpversion]
current_version = "0.15.0"
files = [
{filename = "pyproject.toml"},
{filename = "README.rst"},
{filename = "docs/conf.py"},
]

[tool.coverage.run]
branch = true
source = [
"digid_eherkenning"
]
omit = [
# migrations run while django initializes the test db
"*/migrations/*",
]

[tool.coverage.report]
skip_covered = true
exclude_also = [
"if (typing\\.)?TYPE_CHECKING:",
"@(typing\\.)?overload",
"class .*\\(.*Protocol.*\\):",
"@(abc\\.)?abstractmethod",
"raise NotImplementedError",
"\\.\\.\\.",
"pass",
]
omit = [
"*/migrations/*",
]
136 changes: 0 additions & 136 deletions setup.cfg

This file was deleted.

3 changes: 0 additions & 3 deletions setup.py

This file was deleted.

Loading

0 comments on commit 874ab6a

Please sign in to comment.