forked from django-components/django-components
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpyproject.toml
More file actions
303 lines (282 loc) · 10.1 KB
/
pyproject.toml
File metadata and controls
303 lines (282 loc) · 10.1 KB
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
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"
[project]
name = "django_components"
version = "0.148.0"
requires-python = ">=3.10, <4.0"
description = "A way to create simple reusable template components in Django."
keywords = ["django", "components", "css", "js", "html"]
readme = "README.md"
authors = [
{ name = "Emil Stenström", email = "emil@emilstenstrom.se" },
{ name = "Juro Oravec", email = "juraj.oravec.josefson@gmail.com" },
]
classifiers = [
"Framework :: Django",
"Framework :: Django :: 4.2",
"Framework :: Django :: 5.2",
"Framework :: Django :: 6.0",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
]
# Package dependencies
dependencies = ["Django>=4.2", "djc-core>=1.3.0", "typing-extensions>=4.12.2"]
license = { text = "MIT" }
# See https://docs.pypi.org/project_metadata/#icons
[project.urls]
Homepage = "https://github.com/django-components/django-components/"
Documentation = "https://django-components.github.io/django-components/"
Changelog = "https://django-components.github.io/django-components/latest/releases/"
Issues = "https://github.com/django-components/django-components/issues"
Donate = "https://github.com/sponsors/EmilStenstrom"
###########################################
# ENVIRONMENT DEPENDENCIES
###########################################
[dependency-groups]
# Dev dependencies - install with `uv sync --group dev`
dev = [
"django",
"djc-core>=1.3.0",
"django-template-partials",
"tox",
"pytest",
"pytest-django",
"pytest-asyncio==1.3.0",
"syrupy",
"ruff",
"pre-commit",
"mypy",
"playwright",
"requests",
"types-requests",
"whitenoise",
"pydantic",
"pydantic-settings",
"pygments",
"pygments-djc",
"asv",
# NOTE: pin virtualenv to <20.31 until asv fixes integration
# See https://github.com/airspeed-velocity/asv/issues/1484
"virtualenv==20.35.4",
"typing-extensions>=4.12.2",
"pathspec",
"PyGithub",
"pyyaml",
]
# CI dependencies - install with `uv sync --group ci`
ci = [
"tox",
"tox-gh-actions",
"playwright",
"requests",
"types-requests",
"whitenoise",
"asv",
# NOTE: pin virtualenv to <20.31 until asv fixes integration
# See https://github.com/airspeed-velocity/asv/issues/1484
"virtualenv==20.35.4",
"pytest-asyncio",
"pytest-django",
"typing-extensions>=4.12.2",
"pathspec",
]
# Docs dependencies - install with `uv sync --group docs`
docs = [
"markdown-exec",
"mike",
"mkdocs",
"mkdocs-autorefs",
"mkdocs-awesome-nav",
"mkdocs-gen-files",
"mkdocs-git-authors-plugin",
"mkdocs-git-revision-date-localized-plugin",
"mkdocs-include-markdown-plugin",
"mkdocs-macros-plugin",
"mkdocs-material",
"mkdocs-material[imaging]",
"mkdocs-minify-plugin",
"mkdocs-redirects",
"mkdocstrings",
"mkdocstrings-python",
"pymdown-extensions",
"pygments",
"pygments-djc",
"django>=4.2",
"djc-core>=1.3.0",
]
###########################################
# BUILD TOOLS
###########################################
[tool.setuptools.packages.find]
where = ["src"]
include = ["django_components*"]
exclude = ["django_components.tests*"]
namespaces = false
###########################################
# TESTING TOOLS
###########################################
[tool.pytest.ini_options]
testpaths = ["tests", "docs/examples"]
asyncio_mode = "auto"
###########################################
# FORMATTING & TYPE-CHECKING TOOLS
###########################################
[tool.black]
line-length = 119
include = '\.pyi?$'
exclude = '''
/(
\.git
| \.hg
| \.mypy_cache
| \.tox
| \.venv
| activate
| _build
| buck-out
| build
| dist
)/
'''
[tool.ruff]
line-length = 119
src = ["src", "tests"]
exclude = [
"migrations",
"manage.py",
"settings.py",
"env",
".env",
# From mypy
"test_structures",
]
# See https://docs.astral.sh/ruff/linter/#rule-selection
[tool.ruff.lint]
select = ["ALL"]
ignore = [
# Annotations
"ANN401", # Dynamically typed expressions (typing.Any) are disallowed in `*args`
# Docstring
"D100", # Missing docstring in public module
"D101", # Missing docstring in public class
"D102", # Missing docstring in public method
"D103", # Missing docstring in public function
"D104", # Missing docstring in public package
"D105", # Missing docstring in magic method
"D106", # Missing docstring in public nested class
"D107", # Missing docstring in `__init__`
"D203", # Incorrect blank line before class
"D205", # 1 blank line required between summary line and description
"D212", # Multi-line docstring summary should start at the first line
"D400", # First line should end with a period
"D401", # First line of docstring should be in imperative mood
"D404", # First word of the docstring should not be "This"
"D412", # No blank lines allowed between a section header and its content ("Examples")
"D415", # First line should end with a period, question mark, or exclamation point
# Exceptions
"EM101", # Exception must not use a string literal, assign to variable first
"EM102", # Exception must not use an f-string literal, assign to variable first
# `TODO` comments
"FIX002", # Line contains TODO, consider resolving the issue
"TD002", # Missing author in TODO; try: `# TODO(<author_name>): ...` or `# TODO @<author_name>: ...`
"TD003", # Missing issue link for this TODO
"TD004", # Missing colon in TODO
# Code
"C901", # `test_result_interception` is too complex (36 > 10)
"COM812", # missing-trailing-comma (NOTE: Already handled by formatter)
"ERA001", # Found commented-out code (NOTE: Too many false positives)
"INP001", # File `...` is part of an implicit namespace package. Add an `__init__.py`.
"PLR0915", # Too many statements (64 > 50)
"PLR0911", # Too many return statements (7 > 6)
"PLR0912", # Too many branches (31 > 12)
"PLR0913", # Too many arguments in function definition (6 > 5)
"PLR2004", # Magic value used in comparison, consider replacing `123` with a constant variable
"RET504", # Unnecessary assignment to `collected` before `return` statement
"RET505", # Unnecessary `elif` after `return` statement
"S308", # Use of `mark_safe` may expose cross-site scripting vulnerabilities
"S603", # `subprocess` call: check for execution of untrusted input
"SIM108", # Use ternary operator `...` instead of `if`-`else`-block
"SIM117", # Use a single `with` statement with multiple contexts instead of nested `with` statements
"SLF001", # Private member accessed: `_registry`
"TRY300", # Consider moving this statement to an `else` block
"TRY301", # Abstract `raise` to an inner function
# TODO: Following could be useful to start using, but might require more changes.
"C420", # Unnecessary dict comprehension for iterable; use `dict.fromkeys` instead
"PERF401", # Use `list.extend` to create a transformed list
"PERF203", # `try`-`except` within a loop incurs performance overhead
"FBT001", # Boolean-typed positional argument in function definition
"FBT002", # Boolean default positional argument in function definition
"TRY003", # Avoid specifying long messages outside the exception class
# TODO_V1 - Rename error to suffix with `Error` before v1?
"N818", # Exception name `NotRegistered` should be named with an Error suffix
]
[tool.ruff.lint.per-file-ignores]
"tests/*" = [
"ARG002", # Unused method argument: `components_settings`
"ANN", # Annotations are not needed for tests
"N806", # Variable `SimpleComponent` in function should be lowercase
"PLC0415", # `import` should be at the top-level of a file
"RUF012", # Mutable class attributes should be annotated with `typing.ClassVar`
"S101", # Use of `assert` detected
"TRY002", # Create your own exception
]
"benchmarks/*" = [
"ARG002", # Unused method argument: `components_settings`
"ANN", # Annotations are not needed for tests
"N806", # Variable `SimpleComponent` in function should be lowercase
"PLC0415", # `import` should be at the top-level of a file
"RUF012", # Mutable class attributes should be annotated with `typing.ClassVar`
"S101", # Use of `assert` detected
"TRY002", # Create your own exception
]
"sampleproject/*" = [
"ARG002", # Unused method argument
"ANN", # Annotations are not needed for tests
"T201", # `print` found
"DTZ", # `datetime` found
]
"docs/examples/*" = [
"ARG002", # Unused method argument
"ANN", # Annotations are not needed for tests
"S101", # Use of `assert` detected
"T201", # `print` found
"DTZ", # `datetime` found
]
[tool.ruff.lint.isort]
known-first-party = ["django_components"]
[tool.mypy]
check_untyped_defs = true
ignore_missing_imports = true
exclude = ["build", "sampleproject", "test_structures"]
[[tool.mypy.overrides]]
module = "django_components.*"
disallow_untyped_defs = true
# TODO - Review these rules once we officially support Pylance / Pyright
# See https://github.com/django-components/django-components/issues/1397
[tool.basedpyright]
reportMissingTypeArgument = "none"
reportUnknownParameterType = "none"
reportAny = "none"
reportExplicitAny = "none"
reportUnknownVariableType = "none"
reportUnknownArgumentType = "none"
reportUnknownMemberType = "none"
reportAttributeAccessIssue = "none"
reportPrivateUsage = "none"
reportConstantRedefinition = "none"
reportUnusedCallResult = "none"
reportImplicitStringConcatenation = "none"
reportUnannotatedClassAttribute = "none"
reportSelfClsParameterName = "none"
reportDeprecated = "none"
reportUnusedParameter = "none"
reportUninitializedInstanceVariable = "none"
reportRedeclaration = "none"
reportIncompatibleVariableOverride = "none"