-
Notifications
You must be signed in to change notification settings - Fork 0
/
pyproject.toml
328 lines (305 loc) · 8.72 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
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
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
[tool.poetry]
name = "django-lookup-property"
version = "0.1.7"
description = "Django model properties that are also lookup expressions."
authors = [
"Matti Lamppu <[email protected]>",
]
packages = [
{ include = "lookup_property" },
]
license = "MIT"
readme = "README.md"
homepage = "https://mrthearman.github.io/django-lookup-property"
repository = "https://github.com/MrThearMan/django-lookup-property"
documentation = "https://mrthearman.github.io/django-lookup-property"
keywords = [
"django",
"lookup",
"property",
"orm",
"model",
"extension",
]
classifiers = [
"Environment :: Web Environment",
"Operating System :: OS Independent",
"Intended Audience :: Developers",
"Natural Language :: English",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Framework :: Django :: 4.2",
"Framework :: Django :: 5.0",
"Framework :: Django :: 5.1",
]
include = [
"README.md",
"LICENSE",
]
exclude = [
"tests",
]
[tool.poetry.urls]
"Bug Tracker" = "https://github.com/MrThearMan/django-lookup-property/issues"
[tool.poetry.dependencies]
python = ">=3.11,<4"
Django = ">=4.2"
[tool.poetry.group.test.dependencies]
pytest = "8.3.4"
coverage = "7.6.9"
pytest-django = "4.9.0"
freezegun = "1.5.1"
tox = "4.23.2"
tox-gh-actions = "3.2.0"
factory-boy = "3.3.1"
[tool.poetry.group.docs.dependencies]
mkdocs = "1.6.1"
pymdown-extensions = "10.12"
mkdocs-mermaid2-plugin = "1.2.1"
[tool.poetry.group.lint.dependencies]
mypy = "1.14.0"
pre-commit = "4.0.1"
django-stubs = "5.1.1"
[tool.ruff]
fix = true
unsafe-fixes = true
line-length = 120
extend-exclude = [
"tests*",
]
lint.typing-modules = [
"lookup_property.typing",
]
lint.explicit-preview-rules = true
lint.preview = true
lint.select = [
"A", # flake8-builtins
"ANN", # flake8-annotations
"ARG", # flake8-unused-arguments
"B", # flake8-bugbear
"BLE", # flake8-blind-except
"C90", # mccabe
"C4", # flake8-comprehensions
"COM", # flake8-commas
"D200", # pydocstyle: One-line docstring should fit on one line
"D201", # pydocstyle: No blank lines allowed before function docstring (found {num_lines})
"D202", # pydocstyle: No blank lines allowed after function docstring (found {num_lines})
"D209", # pydocstyle: Multi-line docstring closing quotes should be on a separate line
"D213", # pydocstyle: Multi-line docstring summary should start at the second line
"DJ", # flake8-django
"DTZ", # flake8-datetimez
"E", # pycodestyle errors
"EM", # flake8-errmsg
"F", # pyflakes
"FA", # flake8-future-annotations
"FBT", # flake8-boolean-trap
"FLY", # flynt
"G", # flake8-logging-format
"I", # isort
"ICN", # flake8-import-conventions
"INP", # flake8-no-pep420
"INT", # flake8-gettext
"ISC", # flake8-implicit-str-concat
"LOG", # flake8-logging
"N", # pep8-naming
"PERF", # perflint
"PGH", # pygrep-hooks
"PIE", # flake8-pie
"PL", # pylint
"PT", # flake8-pytest-style
"PTH", # flake8-use-pathlib
"PYI", # flake8-pyi
"Q", # flake8-quotes
"R", # Refactor
"RET", # flake8-return
"RSE", # flake8-raise
"RUF", # ruff-specific rules
"S", # flake8-bandit
"SIM", # flake8-simplify
"SLF", # flake8-self
"T20", # flake8-print
"TCH", # flake8-type-checking
"TID", # flake8-tidy-imports
"TRY", # tryceratops
"UP", # pyupgrade
"W", # pycodestyle warnings
]
# Preview rules
lint.extend-select = [
"B909", # loop-iterator-mutation
"FURB110", # if-exp-instead-of-or-operator
"FURB142", # for-loop-set-mutations
"FURB145", # slice-copy
"FURB171", # single-item-membership-test
"FURB187", # list-reverse-copy
"PLE0307", # invalid-str-return-type
"PLR0916", # too-many-boolean-expressions
"PLR1730", # if-stmt-min-max
"PLR1733", # unnecessary-dict-index-lookup
"PLR1736", # unnecessary-list-index-lookup
"PLR6104", # non-augmented-assignment
"PLW0211", # bad-staticmethod-argument
"PLW0642", # self-or-cls-assignment
"RUF021", # parenthesize-chained-operators
"RUF022", # unsorted-dunder-all
"UP042", # replace-str-enum
]
lint.ignore = [
"ANN101", # Missing type annotation for `self` in method
"ANN102", # Missing type annotation for `cls` in method
"ANN401", # Any-typing allowed
"ARG001", # Unused function argument
"ARG002", # Unused method argument
"ARG003", # Unused class method argument
"G004", # Logging statement uses f-string
"S602", # Broken: https://github.com/astral-sh/ruff/issues/4045
"S603", # Broken: https://github.com/astral-sh/ruff/issues/4045
"TCH001",
"TCH002",
#
# Conflicting with ruff-format
#
"COM812", # missing-trailing-comma
"COM819", # prohibited-trailing-comma
"D206", # indent-with-spaces
"D300", # triple-single-quotes
"E111", # indentation-with-invalid-multiple
"E114", # indentation-with-invalid-multiple-comment
"E117", # over-indented
"ISC001", # single-line-implicit-string-concatenation
"ISC002", # multi-line-implicit-string-concatenation
"Q000", # bad-quotes-inline-string
"Q001", # bad-quotes-multiline-string
"Q002", # bad-quotes-docstring
"Q003", # avoidable-escaped-quote
"W191", # tab-indentation
]
[tool.ruff.lint.extend-per-file-ignores]
"test_*.py" = [
"ANN", # No need to annotate tests
"N801", # Allow whatever class names in tests
"N802", # Allow whatever function names in tests
"N815", # Allow whatever variable names in tests
"PLR0915", # Can have as many statements as needed
"PLR2004", # Magic value comparisons are allowed in tests
"S101", # Assert is fine
"S105", # Hardcoded passwords are fine in tests
"S106", # Hardcoded passwords are fine in tests
"S108", # No need to care about insecure temp file usages in tests
"S311", # Pseudo-random generators are fine here
"SLF", # Allow accessing private members in tests
"UP", # No upgrade rules
]
"conftest.py" = [
"ARG", # Fixtures can be unused
"ANN", # No need to annotate tests
"UP", # No upgrade rules
]
[tool.ruff.lint.isort]
combine-as-imports = false
split-on-trailing-comma = false
known-third-party = [
"django",
]
known-first-party = [
"query_optimizer",
]
[tool.ruff.lint.flake8-import-conventions]
banned-from = [
"base64",
"csv",
"datetime",
"hashlib",
"hmac",
"json",
"logging",
"math",
"os",
"pickle",
"random",
"re",
"shutil",
"subprocess",
"sys",
"tempfile",
"time",
"uuid",
"xml",
"yaml",
]
[tool.ruff.lint.flake8-self]
extend-ignore-names = [
"_base_manager",
"_default_manager",
"_meta",
]
[tool.ruff.lint.pep8-naming]
staticmethod-decorators = ["lookup_property.decorator.lookup_property"]
[tool.ruff.lint.pydocstyle]
property-decorators = ["lookup_property.decorator.lookup_property"]
[tool.ruff.lint.pylint]
max-args = 7
[tool.mypy]
python_version = "3.13"
warn_return_any = "True"
warn_unused_configs = "True"
plugins = [
"mypy_django_plugin.main",
]
[tool.django-stubs]
django_settings_module = "tests.project.settings"
[tool.coverage.run]
relative_files = true
[tool.coverage.report]
omit = [
"tests/*",
"docs/*",
".venv/*",
".tox/*",
]
exclude_lines = [
"if TYPE_CHECKING:",
"except ImportError:",
"pragma: no cover",
"pass",
"def __repr__",
"def __str__",
]
[tool.pytest.ini_options]
DJANGO_SETTINGS_MODULE = "tests.project.settings"
addopts = "-vv -s --log-cli-level=INFO"
[tool.tox]
legacy_tox_ini = """
[tox]
envlist = py{311, 312, 313}-django{42, 50, 51}
isolated_build = true
[gh-actions]
python =
3.11: py311
3.12: py312
3.13: py313
[testenv]
allowlist_externals =
poetry
setenv =
PYTHONPATH = {toxinidir}
DJANGO_SETTINGS_MODULE = tests.project.settings
deps =
django42: Django >=4.2,<4.3
django50: Django >=5.0,<5.1
django51: Django >=5.1,<5.2
pytest
coverage
pytest-django
freezegun
factory-boy
commands =
coverage run -m pytest -vv -s --log-cli-level=INFO
"""
[build-system]
requires = ["poetry-core>=1.9.0"]
build-backend = "poetry.core.masonry.api"