Skip to content

Commit e2e9df4

Browse files
committed
chore: set up Django for development and testing
1 parent ec5a112 commit e2e9df4

File tree

3 files changed

+36
-1
lines changed

3 files changed

+36
-1
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ repos:
2727
rev: "v1.11.2"
2828
hooks:
2929
- id: mypy
30+
additional_dependencies:
31+
- django-stubs[compatible-mypy] ~= 5.0
3032

3133
ci:
3234
autofix_commit_msg: "style: fix issues from Pre-commit hooks"

pyproject.toml

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ keywords = [
1616
"django-management-commands",
1717
]
1818
classifiers = [
19+
"Framework :: Django",
20+
"Framework :: Django :: 4.2",
21+
"Framework :: Django :: 5.0",
22+
"Framework :: Django :: 5.1",
1923
"Intended Audience :: Developers",
2024
"License :: OSI Approved :: MIT License",
2125
"Operating System :: OS Independent",
@@ -30,16 +34,19 @@ classifiers = [
3034
]
3135
requires-python = ">= 3.9"
3236
dependencies = [
37+
"django >= 4.2, < 5.2",
38+
"django-appconf ~= 1.0",
3339
"typing-extensions ~= 4.12",
3440
]
3541
dynamic = ["version"]
3642

3743
[project.optional-dependencies]
3844
dev = [
39-
"mypy ~= 1.11",
45+
"django-stubs[compatible-mypy] ~= 5.0",
4046
"pre-commit ~= 3.8",
4147
"pytest ~= 8.3",
4248
"pytest-custom-exit-code ~= 0.3",
49+
"pytest-django ~= 4.9",
4350
"pytest-mock ~= 3.14",
4451
"pytest-randomly ~= 3.15",
4552
"ruff ~= 0.6",
@@ -66,24 +73,49 @@ known-first-party = ["management_commands"]
6673
required-imports = [
6774
"from __future__ import annotations",
6875
]
76+
section-order = [
77+
"future",
78+
"standard-library",
79+
"third-party",
80+
"django",
81+
"first-party",
82+
"local-folder",
83+
]
84+
85+
[tool.ruff.lint.isort.sections]
86+
"django" = ["django"]
6987

7088
[tool.ruff.lint.pydocstyle]
7189
convention = "google"
7290

7391
[tool.mypy]
7492
mypy_path = "src/"
7593
strict = true
94+
plugins = [
95+
"mypy_django_plugin.main",
96+
]
97+
98+
[[tool.mypy.overrides]]
99+
module = [
100+
"appconf",
101+
]
102+
ignore_missing_imports = true
76103

77104
[[tool.mypy.overrides]]
78105
module = [
79106
"tests.*",
80107
]
81108
disallow_untyped_decorators = false
82109

110+
[tool.django-stubs]
111+
django_settings_module = "tests.settings"
112+
strict_settings = false
113+
83114
[tool.pytest.ini_options]
84115
addopts = [
85116
"-ra",
86117
"--suppress-no-test-exit-code",
118+
"--ds=tests.settings",
87119
]
88120
pythonpath = [".", "src/"]
89121
testpaths = ["tests/"]

tests/settings.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from __future__ import annotations

0 commit comments

Comments
 (0)