Skip to content

Commit c88927b

Browse files
committed
Modernize project from Poetry to uv and ruff
1 parent 7d5aa0b commit c88927b

File tree

7 files changed

+2273
-2181
lines changed

7 files changed

+2273
-2181
lines changed

.pre-commit-config.yaml

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,15 @@
11
repos:
22
- repo: local
33
hooks:
4-
- id: system
5-
name: isort
6-
entry: poetry run isort .
4+
- id: ruff-check
5+
name: ruff check
6+
entry: uv run ruff check --fix
77
language: system
8-
pass_filenames: false
9-
- repo: local
10-
hooks:
11-
- id: pyupgrade
12-
name: pyupgrade
13-
entry: poetry run pyupgrade --py37-plus
14-
language: python
158
types: [python]
16-
pass_filenames: true
17-
- repo: local
18-
hooks:
19-
- id: system
20-
name: Black
21-
entry: poetry run black .
22-
language: system
239
pass_filenames: false
24-
- repo: local
25-
hooks:
26-
- id: system
27-
name: flake8
28-
entry: poetry run flake8 .
10+
- id: ruff-format
11+
name: ruff format
12+
entry: uv run ruff format
2913
language: system
14+
types: [python]
3015
pass_filenames: false

poetry.lock

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

pyproject.toml

Lines changed: 70 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,87 @@
1-
[tool.poetry]
1+
[project]
22
name = "django-security-keys"
33
version = "1.1.0"
44
description = "Django webauthn security key integration"
55
readme = "README.md"
6-
repository = "https://github.com/fullctl/django-security-keys"
7-
authors = [ "20C <[email protected]>",]
8-
license = "Apache-2"
6+
authors = [{ name = "20C", email = "[email protected]" }]
7+
license = { text = "Apache-2.0" }
8+
requires-python = ">=3.9"
9+
910
classifiers = [
10-
"Topic :: Software Development",
11-
"Development Status :: 5 - Production/Stable",
12-
"License :: OSI Approved :: Apache Software License",
13-
"Programming Language :: Python :: 3.8",
14-
"Programming Language :: Python :: 3.9",
15-
"Programming Language :: Python :: 3.10",
16-
"Programming Language :: Python :: 3.11",
11+
"Topic :: Software Development",
12+
"Development Status :: 5 - Production/Stable",
13+
"License :: OSI Approved :: Apache Software License",
14+
"Programming Language :: Python :: 3.9",
15+
"Programming Language :: Python :: 3.10",
16+
"Programming Language :: Python :: 3.11",
17+
"Programming Language :: Python :: 3.12",
18+
"Programming Language :: Python :: 3.13",
1719
]
1820

19-
packages = [
20-
{ include = "django_security_keys", from = "src" },
21+
dependencies = [
22+
"webauthn>=1",
23+
"django-two-factor-auth>=1.13.1",
24+
"phonenumbers>=8.12.47",
2125
]
2226

23-
[tool.poetry.dependencies]
24-
python = "^3.8"
25-
webauthn = "^1"
26-
27-
# requirements for 2FA
28-
django-two-factor-auth = "^1.13.1"
29-
phonenumbers = "^8.12.47"
30-
31-
[tool.poetry.dev-dependencies]
32-
# testing
33-
pytest = ">=6.0.1"
34-
pytest-django = ">=3.8.0"
35-
pytest-cov = "*"
36-
pytest-pythonpath = "*"
37-
tox = ">=3.24"
38-
tox-gh-actions = ">=2.9.1"
27+
[project.urls]
28+
repository = "https://github.com/fullctl/django-security-keys"
3929

40-
# linting
41-
black = { version = ">=20", allow-prereleases = true }
42-
isort = "^5.7.0"
43-
flake8 = "^3.8.4"
44-
mypy = ">=0.950"
45-
pre-commit = "^2.13"
46-
pyupgrade = "^2.19.4"
30+
[project.optional-dependencies]
31+
dev = [
32+
# testing
33+
"pytest>=6.0.1",
34+
"pytest-django>=3.8.0",
35+
"pytest-cov",
36+
"pytest-pythonpath",
37+
"tox>=3.24",
38+
"tox-gh-actions>=2.9.1",
39+
40+
# linting
41+
"ruff>=0.6",
42+
"pre-commit>=2.13",
43+
44+
# ctl
45+
"ctl>=1",
46+
"jinja2>=3.1.2",
47+
"tmpl>=1",
48+
"twine>=3.3.0",
49+
50+
# docs
51+
"markdown-include>=0.5",
52+
"mkdocs>=1.2.3",
53+
"pymdgen>=1.0.0",
54+
]
4755

48-
# ctl
49-
ctl = "^1"
50-
jinja2 = "^3.1.2"
51-
tmpl = "^1"
52-
twine = "^3.3.0"
56+
[build-system]
57+
requires = ["hatchling"]
58+
build-backend = "hatchling.build"
5359

54-
# docs
55-
markdown-include = ">=0.5"
56-
mkdocs = "^1.2.3"
57-
pymdgen = "^1.0.0"
60+
[tool.hatch.build.targets.wheel]
61+
packages = ["src/django_security_keys"]
5862

63+
[tool.ruff]
64+
line-length = 88
65+
target-version = "py39"
5966

60-
[tool.poetry.plugins."markdown.extensions"]
61-
pymdgen = "pymdgen.md:Extension"
67+
[tool.ruff.lint]
68+
select = [
69+
"E", # pycodestyle errors
70+
"W", # pycodestyle warnings
71+
"F", # Pyflakes
72+
"I", # isort
73+
"UP", # pyupgrade
74+
"C90", # mccabe complexity
75+
]
6276

63-
[build-system]
64-
requires = [ "poetry>=0.12",]
65-
build-backend = "poetry.masonry.api"
77+
[tool.ruff.lint.isort]
78+
known-first-party = ["django_security_keys"]
6679

67-
[tool.isort]
68-
profile = "black"
69-
multi_line_output = 3
80+
[tool.ruff.format]
81+
quote-style = "double"
82+
indent-style = "space"
7083

84+
[tool.pytest.ini_options]
85+
DJANGO_SETTINGS_MODULE = "tests.project.settings"
86+
python_paths = ["src"]
87+
addopts = "--cov=django_security_keys --cov-report=term-missing"

src/django_security_keys/migrations/0004_remove_securitykey_passwordless_login_and_more.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ def migrate_passwordless_login_to_passkey_login(apps, schema_editor):
1313

1414

1515
class Migration(migrations.Migration):
16-
1716
dependencies = [
1817
("django_security_keys", "0003_date_fields"),
1918
]

src/django_security_keys/views.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -320,9 +320,11 @@ def update_security_key(request: WSGIRequest, **kwargs: Any) -> JsonResponse:
320320
sec_key.passkey_login = passkey_login
321321
sec_key.save()
322322

323-
return JsonResponse({
324-
"status": "ok",
325-
"id": sec_key.id,
326-
"name": sec_key.name,
327-
"passkey_login": sec_key.passkey_login
328-
})
323+
return JsonResponse(
324+
{
325+
"status": "ok",
326+
"id": sec_key.id,
327+
"name": sec_key.name,
328+
"passkey_login": sec_key.passkey_login,
329+
}
330+
)

tests/manage.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/usr/bin/env python
22
"""Django's command-line utility for administrative tasks."""
3+
34
import os
45
import sys
56

0 commit comments

Comments
 (0)