-
Notifications
You must be signed in to change notification settings - Fork 1
/
pyproject.toml
313 lines (271 loc) · 11.2 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
# ==== pytest ====
[tool.pytest.ini_options]
minversion = "6.0"
addopts = "--ds=config.settings --reuse-db --disable-socket --allow-unix-socket --allow-hosts=localhost"
python_files = [
"tests.py",
"test_*.py",
]
filterwarnings = [
# We know and aren’t impacted.
"ignore:To avoid breaking existing software while fixing issue 310",
]
env = [
"LOGGING_RICH_TRACEBACK=False", # This slows downs test and we don’t need it.
]
# ==== Coverage ====
[tool.coverage.run]
include = ["legadilo/**"]
omit = ["*/migrations/*", "*/tests/*"]
plugins = ["django_coverage_plugin"]
# ==== Ruf ====
[tool.ruff]
line-length = 100
target-version = "py312"
[tool.ruff.lint]
select = [
"F", "E", "W", "C", "I", "N", "UP", "ASYNC", "S", "BLE", "FBT", "B", "A", "COM", "DTZ", "T",
"DJ", "ICN", "RSE", "PT", "ISC", "RET", "SIM", "INT", "PTH", "ERA", "PGH", "PL", "FLY",
"FURB", "LOG", "RUF", "D"
]
ignore = [
"RUF012", # RUF012 Mutable class attributes should be annotated with `typing.ClassVar`
"COM812", # missing-trailing-comma (the formatter will do this)
"ISC001", # single-line-implicit-string-concatenation (the formatter will do this)
"PLR6301", # Method XXX could be a function, class method, or static method
"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__
"D415", # First line should end with a period, question mark, or exclamation point
]
[tool.ruff.lint.per-file-ignores]
"legadilo/**/tests/**/test_*.py" = [
# at least this three should be fine in tests:
"S101", # asserts allowed in tests...
"ARG", # Unused function args -> fixtures nevertheless are functionally relevant...
"FBT", # Don't care about booleans as positional arguments in tests, e.g. via @pytest.mark.parametrize()
"PLR2004", # Magic value used in comparison, ...
"S311", # Standard pseudo-random generators are not suitable for cryptographic purposes
"S106", # Possible hardcoded password
]
"legadilo/feeds/tests/test_utils/test_article_fetching.py" = [
"E501",
"RUF001", # String contains ambiguous `’`
]
"legadilo/**/factories.py" = [
"FBT001", # Boolean-typed positional argument in function definition
"ARG002", # Unused method argument
"RUF012", # Mutable class attributes should be annotated with `typing.ClassVar`
]
"legadilo/**/migrations/*.py" = [
"E501", # Line too long.
"RUF012", # Mutable class attributes should be annotated with `typing.ClassVar`
]
"config/wsgi.py" = [
"ERA001", # Found commented-out code
]
"config/asgi.py" = [
"ERA001", # Found commented-out code
]
"config/settings.py" = [
"ERA001", # Found commented-out code
]
[tool.ruff.format]
# Like Black, use double quotes for strings.
quote-style = "double"
# Like Black, indent with spaces, rather than tabs.
indent-style = "space"
# Like Black, respect magic trailing commas.
skip-magic-trailing-comma = false
# Like Black, automatically detect the appropriate line ending.
line-ending = "auto"
[tool.ruff.lint.isort]
known-first-party = [
"legadilo",
"config",
]
[tool.ruff.lint.pylint]
max-args = 6
[tool.ruff.lint.pydocstyle]
convention = "google"
# ==== curlylint ====
[tool.curlylint.rules]
# All role attributes must be valid.
# See https://www.curlylint.org/docs/rules/aria_role.
aria_role = true
# Forms cannot be rendered with as_table, as_ul, or as_p
# See https://www.curlylint.org/docs/rules/django_forms_rendering.
django_forms_rendering = true
# The `lang` attribute must be present.
# See https://www.curlylint.org/docs/rules/html_has_lang.
html_has_lang = true
# The `alt` attribute must be present.
# See https://www.curlylint.org/docs/rules/image_alt.
image_alt = true
# Use tabs.
# See https://www.curlylint.org/docs/rules/indent.
indent = 4
# `user-scalable=no` must not be used, and `maximum-scale` should be 2 or above.
# See https://www.curlylint.org/docs/rules/meta_viewport.
meta_viewport = true
# The `autofocus` attribute must not be used.
# See https://www.curlylint.org/docs/rules/no_autofocus.
no_autofocus = true
# Avoid positive `tabindex` values, change the order of elements on the page instead.
# See https://www.curlylint.org/docs/rules/tabindex_no_positive.
tabindex_no_positive = true
# ==== mypy ====
[tool.mypy]
python_version = "3.12"
check_untyped_defs = true
ignore_missing_imports = true
warn_unused_ignores = true
warn_redundant_casts = true
warn_unused_configs = true
plugins = [
"mypy_django_plugin.main",
]
[[tool.mypy.overrides]]
# Django migrations should not produce any errors:
module = "*.migrations.*"
ignore_errors = true
[tool.django-stubs]
django_settings_module = "config.settings"
# ==== djLint ====
[tool.djlint]
blank_line_after_tag = "load,extends"
close_void_tags = true
format_css = true
format_js = true
# TODO: remove T002 when fixed https://github.com/Riverside-Healthcare/djLint/issues/687
ignore = "H006,H030,H031,T002"
include = "H017,H035"
indent = 4
max_line_length = 119
profile = "django"
custom_blocks = "partialdef"
[tool.djlint.css]
indent_size = 4
[tool.djlint.js]
indent_size = 4
[tool.importlinter]
root_package = "legadilo"
[[tool.importlinter.contracts]]
name = "Enforce Django apps layering"
type = "layers"
layers = [
"legadilo.import_export",
"legadilo.feeds",
"legadilo.reading",
"legadilo.users",
"legadilo.core",
"legadilo.utils",
]
ignore_imports = [
"legadilo.reading.tests.test_models.test_article -> legadilo.feeds.tests.factories",
"legadilo.users.tests.test_registration -> legadilo.core.middlewares",
"legadilo.users.tests.models.test_user -> legadilo.feeds.tests.factories",
]
[tool.poetry]
name = "legadilo"
version = "0.1.0"
description = ""
authors = ["Julien Enselme <[email protected]>"]
license = "AGPLv3"
readme = "README.md"
package-mode = false
[tool.poetry.dependencies]
python = "^3.12"
# General
# ------------------------------------------------------------------------------
python-slugify = "8.0.4" # https://github.com/un33k/python-slugify
Pillow = "11.0.0" # https://github.com/python-pillow/Pillow
argon2-cffi = "23.1.0" # https://github.com/hynek/argon2_cffi
whitenoise = "6.8.2" # https://github.com/evansd/whitenoise
psycopg = { extras = ["binary"], version = "3.2.3" } # https://github.com/psycopg/psycopg
rich = "^13.9.4" # https://rich.readthedocs.io/en/stable/
# Django
# ------------------------------------------------------------------------------
django = "^5.1.3" # https://www.djangoproject.com/
django-environ = "0.11.2" # https://github.com/joke2k/django-environ
django-allauth = {extras = ["mfa"], version = "^65.2.0"} # https://github.com/pennersr/django-allauth
django-crispy-forms = "2.3" # https://github.com/django-crispy-forms/django-crispy-forms
crispy-bootstrap5 = "2024.10" # https://github.com/django-crispy-forms/crispy-bootstrap5
django-anymail = "12.0" # https://github.com/anymail/django-anymail
daphne = "^4.1.2" # https://github.com/django/daphne
django-version-checks = "1.13.0" # https://github.com/adamchainz/django-version-checks
django-extra-checks = "0.15.1" # https://github.com/kalekseev/django-extra-checks
django-csp = "3.8" # https://django-csp.readthedocs.io/en/latest/index.html
django-axes = "^7.0.0" # https://github.com/jazzband/django-axes
django-htmx = "1.21.0" # https://django-htmx.readthedocs.io/en/latest/
django-template-partials = "24.4" # https://github.com/carltongibson/django-template-partials
django-ninja = "1.3.0" # https://django-ninja.dev
django-cors-headers = "4.6.0" # https://github.com/adamchainz/django-cors-headers#readme
# Project
# ------------------------------------------------------------------------------
#feedparser = "^6.0.11" # https://feedparser.readthedocs.io/en/latest/
# We must use git because the released version has a bug around media parsing.
# See https://github.com/kurtmckee/feedparser/pull/441
feedparser = {git = "https://github.com/Jenselme/feedparser.git", rev = "correct-media-parsing"}
httpx = "0.28.0" # https://www.python-httpx.org/
beautifulsoup4 = "^4.12.3" # https://www.crummy.com/software/BeautifulSoup/bs4/doc/
nh3 = "^0.2.17" # https://nh3.readthedocs.io/en/latest/
python-dateutil = "^2.9.0.post0" # https://github.com/dateutil/dateutil
defusedxml = "0.7.1" # https://github.com/tiran/defusedxml
markdown = "^3.7" # https://python-markdown.github.io
pydantic = "^2.10.2" # https://docs.pydantic.dev/latest/
pyjwt = "2.10.1" # https://pyjwt.readthedocs.io/en/stable/
[tool.poetry.group.prod]
optional = true
[tool.poetry.group.prod.dependencies]
sentry-sdk = {extras = ["django"], version = "^2.18.0"}
[tool.poetry.group.dev]
optional = true
[tool.poetry.group.dev.dependencies]
pudb = "^2024.1.2" # https://documen.tician.de/pudb/
ipdb = "^0.13.13" # https://github.com/gotcha/ipdb
# Testing
# ------------------------------------------------------------------------------
pytest = "^8.3.3" # https://github.com/pytest-dev/pytest
pytest-sugar = "1.0.0" # https://github.com/Frozenball/pytest-sugar
pytest-httpx = "^0.35.0" # https://colin-b.github.io/pytest_httpx/
pytest-asyncio = "^0.24.0" # https://github.com/pytest-dev/pytest-asyncio/
pytest-mock = "^3.14.0" # https://pytest-mock.readthedocs.io/en/latest/
pytest-socket = "0.7.0" # https://github.com/miketheman/pytest-socket
pytest-env = "1.1.5" # https://github.com/pytest-dev/pytest-env
pytest-snapshot = "^0.9.0" # https://github.com/joseph-roitman/pytest-snapshot
pytest-cov = "^6.0.0" # https://github.com/pytest-dev/pytest-cov
time-machine = "2.16.0" # https://github.com/adamchainz/time-machine
# Code quality
# ------------------------------------------------------------------------------
pre-commit = "4.0.1" # https://github.com/pre-commit/pre-commit
# Django
# ------------------------------------------------------------------------------
factory-boy = "3.3.1" # https://github.com/FactoryBoy/factory_boy
django-debug-toolbar = "4.4.6" # https://github.com/jazzband/django-debug-toolbar
django-coverage-plugin = "3.1.0" # https://github.com/nedbat/django_coverage_plugin
pytest-django = "4.9.0" # https://github.com/pytest-dev/pytest-django
django-browser-reload = "1.17.0" # https://pypi.org/project/django-browser-reload/
django-watchfiles = "1.0.0" # https://github.com/adamchainz/django-watchfiles
django-extensions = "3.2.3" # https://github.com/django-extensions/django-extensions
[tool.poetry.group.doc]
optional = true
[tool.poetry.group.doc.dependencies]
sphinx = "8.1.3" # https://github.com/sphinx-doc/sphinx
sphinx-autobuild = "2024.10.3" # https://github.com/GaretJax/sphinx-autobuild
myst-parser = "4.0.0" # https://myst-parser.readthedocs.io/en/stable/intro.html
[tool.poetry.group.typing]
optional = true
[tool.poetry.group.typing.dependencies]
types-python-dateutil = "^2.9.0.20240906"
types-Markdown = "^3.7.0.20240822"
mypy = "1.13.0" # https://github.com/python/mypy
django-stubs = { extras = ["compatible-mypy"], version = "5.1.1" } # https://github.com/typeddjango/django-stubs
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"