Skip to content

Commit de33a6d

Browse files
authored
Replace setup.py by pyproject.toml
1 parent 16f688b commit de33a6d

File tree

8 files changed

+136
-105
lines changed

8 files changed

+136
-105
lines changed

.coveragerc

Lines changed: 0 additions & 19 deletions
This file was deleted.

.github/workflows/build.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
steps:
1717
- uses: actions/checkout@v4
1818
- name: Set up Python ${{ matrix.python-version }}
19-
uses: actions/setup-python@v4
19+
uses: actions/setup-python@v5
2020
with:
2121
python-version: ${{ matrix.python-version }}
2222
- name: Install Tox and any other packages
@@ -39,14 +39,14 @@ jobs:
3939
runs-on: ubuntu-latest
4040

4141
steps:
42-
- uses: actions/checkout@v3
42+
- uses: actions/checkout@v4
4343
- name: Set up Python 3.11
44-
uses: actions/setup-python@v4
44+
uses: actions/setup-python@v5
4545
with:
4646
python-version: 3.11
4747
- name: Install Tox
4848
run: pip install tox
4949
- name: isort
5050
run: tox -e isort
51-
- name: flake8
52-
run: tox -e flake8
51+
- name: ruff
52+
run: tox -e ruff

.pre-commit-config.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ repos:
55
- id: isort
66
args: ['--check-only', '--diff']
77

8-
- repo: https://github.com/PyCQA/flake8
9-
rev: 7.0.0
8+
- repo: https://github.com/astral-sh/ruff-pre-commit
9+
rev: v0.2.0
1010
hooks:
11-
- id: flake8
12-
files: ^(example|tests|two_factor)/
11+
- id: ruff

pyproject.toml

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
[build-system]
2+
requires = ["setuptools>=61.0.0"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "django-two-factor-auth"
7+
version = "1.16.0"
8+
description = "Complete Two-Factor Authentication for Django"
9+
readme = "README.rst"
10+
authors = [
11+
{name = "Bouke Haarsma", email = "bouke@haarsma.eu"},
12+
]
13+
maintainers = [
14+
{name = "Claude Paroz", email = "claude@2xlibre.net"},
15+
{name = "Matt Molyneaux", email = "moggers87+git@moggers87.co.uk"},
16+
]
17+
license = {text = "MIT"}
18+
requires-python = ">= 3.8"
19+
dependencies = [
20+
"Django>=3.2",
21+
"django_otp>=0.8.0",
22+
"qrcode>=4.0.0,<7.99",
23+
"django-phonenumber-field<8",
24+
"django-formtools",
25+
]
26+
keywords = ["django", "two-factor"]
27+
classifiers = [
28+
"Development Status :: 5 - Production/Stable",
29+
"Environment :: Web Environment",
30+
"Framework :: Django",
31+
"Framework :: Django :: 3.2",
32+
"Framework :: Django :: 4.0",
33+
"Framework :: Django :: 4.1",
34+
"Framework :: Django :: 4.2",
35+
"Framework :: Django :: 5.0",
36+
"Intended Audience :: Developers",
37+
"License :: OSI Approved :: MIT License",
38+
"Operating System :: OS Independent",
39+
"Programming Language :: Python",
40+
"Programming Language :: Python :: 3",
41+
"Programming Language :: Python :: 3 :: Only",
42+
"Programming Language :: Python :: 3.8",
43+
"Programming Language :: Python :: 3.9",
44+
"Programming Language :: Python :: 3.10",
45+
"Programming Language :: Python :: 3.11",
46+
"Programming Language :: Python :: 3.12",
47+
"Topic :: Security",
48+
"Topic :: System :: Systems Administration :: Authentication/Directory",
49+
]
50+
51+
[project.optional-dependencies]
52+
call = ['twilio>=6.0']
53+
sms = ['twilio>=6.0']
54+
webauthn = ['webauthn>=2.0,<2.99']
55+
yubikey = ['django-otp-yubikey']
56+
phonenumbers = ['phonenumbers>=7.0.9,<8.99']
57+
phonenumberslite = ['phonenumberslite>=7.0.9,<8.99']
58+
# used internally for local development & CI
59+
tests = [
60+
"coverage",
61+
"freezegun",
62+
"tox",
63+
]
64+
linting = [
65+
"ruff",
66+
"isort<=5.99",
67+
]
68+
69+
[project.urls]
70+
Homepage = "https://github.com/jazzband/django-two-factor-auth"
71+
Documentation = "https://django-two-factor-auth.readthedocs.io/en/stable/"
72+
Changelog = "https://github.com/jazzband/django-two-factor-auth/blob/master/CHANGELOG.md"
73+
74+
[tool.ruff]
75+
line-length = 119
76+
target-version = "py38"
77+
extend-exclude = ["docs"]
78+
79+
[tool.ruff.lint]
80+
select = [
81+
"F", # Pyflakes
82+
"E", # pycodestyle (Error)
83+
"W", # pycodestyle (Warning)
84+
# "I", # isort (waiting for https://github.com/astral-sh/ruff/issues/2600)
85+
]
86+
87+
# [tool.ruff.lint.isort]
88+
# combine-as-imports = true
89+
# known-first-party = ["two_factor"]
90+
91+
[tool.isort]
92+
combine_as_imports = true
93+
default_section = "THIRDPARTY"
94+
include_trailing_comma = true
95+
known_first_party = "two_factor"
96+
line_length = 79
97+
multi_line_output = 5
98+
sections="FUTURE,STDLIB,THIRDPARTY,FIRSTPARTY,LOCALFOLDER"
99+
100+
[tool.coverage.run]
101+
branch = true
102+
source = [
103+
"tests",
104+
"two_factor",
105+
]
106+
omit = ["*/migrations/*"]
107+
108+
[tool.coverage.report]
109+
exclude_also = [
110+
# Don't complain about missing debug-only code:
111+
"def __repr__",
112+
# Don't complain if tests don't hit defensive assertion code:
113+
"raise AssertionError",
114+
"raise NotImplementedError",
115+
]

setup.cfg

Lines changed: 0 additions & 12 deletions
This file was deleted.

setup.py

Lines changed: 0 additions & 63 deletions
This file was deleted.

tox.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,10 @@ commands =
6060
coverage run {env:COVERAGE_OPTIONS:} {envbindir}/django-admin test -v 2 --pythonpath=./ --settings=tests.settings
6161
coverage report
6262

63-
[testenv:flake8]
63+
[testenv:ruff]
6464
basepython = python3
6565
extras = linting
66-
commands = flake8 example tests two_factor
66+
commands = ruff .
6767

6868
[testenv:isort]
6969
basepython = python3

two_factor/views/__init__.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,14 @@
33
)
44
from .mixins import OTPRequiredMixin
55
from .profile import DisableView, ProfileView
6+
7+
__all__ = (
8+
"BackupTokensView",
9+
"LoginView",
10+
"QRGeneratorView",
11+
"SetupCompleteView",
12+
"SetupView",
13+
"OTPRequiredMixin",
14+
"DisableView",
15+
"ProfileView"
16+
)

0 commit comments

Comments
 (0)