This repository has been archived by the owner on May 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
pyproject.toml
213 lines (192 loc) · 4.15 KB
/
pyproject.toml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[project]
name = "{{ project_name }}"
dynamic = ["version"]
description = ""
readme = "README.md"
requires-python = ">=3.11"
license = "MIT"
authors = [{ name = "Oliver Andrich", email = "oliver@andrich.me" }]
dependencies = [
"django[argon2]>=4.2.0,<5.0",
"django-browser-reload>=1.9.0",
"django-environ>=0.10.0",
"django-htmx>=1.15.0",
"django-tailwind-cli>=2.2.3",
"pytz",
"whitenoise[brotli]>=6.5.0"
]
[project.optional-dependencies]
mysql = [
"mysqlclient>=2.2.0",
"django-mysql>=4.10.0",
]
postgres = [
"psycopg[binary]>=3.1.10",
]
[tool.hatch.version]
path = "{{ project_name }}/__version__.py"
# Default environment
[tool.hatch.envs.default]
dependencies = [
"django-types",
"ipdb",
"model-bakery",
"pytest",
"pytest-django",
"pytest-mock",
]
features = [
# Uncomment the next line to add the MySQL dependencies
# "mysql",
# Uncomment the next line to add the Postgres dependencies
# "postgres",
]
[tool.hatch.envs.default.scripts]
runserver = "manage.py tailwind runserver {args}"
migrate = "manage.py migrate {args}"
makemigrations = "manage.py makemigrations {args}"
# Test environment
[[tool.hatch.envs.test.matrix]]
python = ["3.11", "3.12"]
[tool.hatch.envs.test]
dependencies = [
"pytest",
"pytest-django",
"pytest-cov",
"pytest-sugar",
"pytest-randomly",
"pytest-mock",
"syrupy"
]
[tool.hatch.envs.test.scripts]
test = "pytest --no-header {args}"
test-cov = "pytest --cov {args}"
cov-report = ["coverage combine", "coverage report"]
cov = ["test-cov", "cov-report"]
# Lint environment
[tool.hatch.envs.lint]
dependencies = [
# Tools
"pyright",
"curlylint",
"black",
"ruff",
"pyupgrade",
"django-upgrade",
# Libraries / Typestubs
"django-types",
"pytest",
"pytest-django",
"pytest-mock",
]
[tool.hatch.envs.lint.scripts]
run-pyright = "pyright {args:.}"
run-black = "black --quiet {args:.}"
run-ruff = "ruff check --quiet --fix --exit-non-zero-on-fix {args:.}"
run-curlylint = "curlylint {args:.}"
run-pyupgrade = "pyupgrade --py311-plus {args}"
run-all-pyupgrade = "git ls-files -- '*.py' | xargs pyupgrade --py311-plus"
run-django-upgrade = "django-upgrade --target-version 4.2 {args}"
run-all-django-upgrade = "git ls-files -- '*.py' | xargs django-upgrade --target-version 4.2"
python = ["run-pyright", "run-black", "run-ruff", "run-all-pyupgrade", "run-all-django-upgrade"]
templates = ["run-curlylint"]
all = ["python", "templates"]
# Black
[tool.black]
target-version = ["py311"]
line-length = 120
skip-string-normalization = true
# Pyright
[tool.pyright]
typeCheckingMode = "basic"
# Ruff
[tool.ruff]
target-version = "py311"
line-length = 120
select = [
"A",
"ARG",
"B",
"C",
"DJ",
"DTZ",
"E",
"EM",
"F",
"FBT",
"I",
"ICN",
"ISC",
"N",
"PLC",
"PLE",
"PLR",
"PLW",
"Q",
"RUF",
"S",
"T",
"TID",
"UP",
"W",
"YTT",
]
ignore = [
# Allow non-abstract empty methods in abstract base classes
"B027",
# Allow boolean positional values in function calls, like `dict.get(... True)`
"FBT003",
# Ignore checks for possible passwords
"S105",
"S106",
"S107",
# Ignore complexity
"C901",
"PLR0911",
"PLR0912",
"PLR0913",
"PLR0915",
]
unfixable = [
# Don't touch unused imports
"F401",
]
[tool.ruff.isort]
known-first-party = ["django_tailwind_cli"]
[tool.ruff.flake8-tidy-imports]
ban-relative-imports = "all"
[tool.ruff.per-file-ignores]
"tests/**/*" = ["PLR2004", "S101", "TID252"]
# Coverage
[tool.coverage.run]
source=["."]
branch = true
parallel = true
omit = ["config/__version__.py"]
[tool.coverage.report]
exclude_lines = ["no cov", "if __name__ == .__main__.:", "if TYPE_CHECKING:"]
# Curlylint
[tool.curlylint]
include = '\.(html|jinja)$'
exclude = '''
(
/(
\.eggs # exclude a few common directories in the root of the project
| \.git
| \.venv
| \.ruff_cache
)/
| webpack-stats.html # also separately exclude a file named webpack-stats.html in the root of the project
)
'''
[tool.curlylint.rules]
indent = 4
aria_role = true
django_forms_rendering = true
image_alt = true
meta_viewport = true
no_autofocus = true
tabindex_no_positive = true