-
-
Notifications
You must be signed in to change notification settings - Fork 1k
/
pyproject.toml
533 lines (505 loc) · 14.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
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
[build-system]
build-backend = "setuptools.build_meta"
requires = [
"setuptools>=69.0.0",
"translate-toolkit"
]
[dependency-groups]
dev = [
"django-debug-toolbar==4.4.6",
"PyICU==2.14",
"reuse==5.0.2",
"scour==0.38.2",
"tinyunicodeblock==1.3",
{include-group = "lint"},
{include-group = "test"},
{include-group = "types"}
]
lint = [
{include-group = "pylint"},
{include-group = "pre-commit"}
]
pre-commit = [
"pre-commit==4.0.1"
]
pylint = [
"pylint==3.3.1"
]
test = [
"coverage==7.6.7",
"pytest==8.3.3",
"pytest-cov==6.0.0",
"pytest-django==4.9.0",
"responses==0.25.3",
"respx==0.21.1",
"selenium==4.26.1"
]
types = [
"boto3-stubs==1.35.63",
"celery-types==0.22.0",
"django-stubs-ext==5.1.1",
"django-stubs==5.1.1",
"djangorestframework-stubs==3.15.1",
"types-lxml==2024.11.8",
"mypy==1.13.0",
"types-dateparser==1.2.0.20240420",
"types-jsonschema==4.23.0.20240813",
"types-openpyxl==3.1.5.20241114",
"types-Pillow==10.2.0.20240822",
"types-python-dateutil==2.9.0.20241003",
"types-requests==2.32.0.20241016"
]
[project]
authors = [{name = "Michal Čihař", email = "[email protected]"}]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Environment :: Web Environment",
"Framework :: Django",
"Intended Audience :: Developers",
"Intended Audience :: System Administrators",
"License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
"Operating System :: OS Independent",
"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",
"Topic :: Software Development :: Internationalization",
"Topic :: Software Development :: Localization",
"Topic :: Internet :: WWW/HTTP",
"Topic :: Internet :: WWW/HTTP :: Dynamic Content"
]
dependencies = [
"aeidon>=1.14.1,<1.16",
"ahocorasick-rs>=0.20.0,<0.23.0",
"borgbackup>=1.2.5,<1.5",
"celery[redis]>=5.4.0,<5.5",
"certifi>=2024.8.30",
"charset-normalizer>=2.0.12,<4.0",
"crispy-bootstrap3==2024.1",
"cryptography>=42.0.4",
"cssselect>=1.2,<1.3",
"Cython>=3.0.0,<3.1",
"cyrtranslit>=1.1.0,<1.2.0",
"dateparser>=1.2.0,<1.3.0",
"diff-match-patch==20241021",
"django-appconf>=1.0.3,<1.1",
"django-celery-beat>=2.6.0,<2.8",
"django-compressor>=4.4,<5",
"django-cors-headers>=4.3.0,<4.7",
"django-crispy-forms>=2.3,<2.4",
"django-filter>=23.4,<24.4",
"django-redis>=5.4.0,<6.0",
"django-otp>=1.5.2,<2.0",
"django-otp-webauthn>=0.4.0,<0.5",
"Django[argon2]>=5.0,<5.2",
"djangorestframework>=3.15.2,<3.16",
"drf-spectacular[sidecar]>=0.27.2,<0.28",
"filelock<4,>=3.12.2",
"fluent.syntax>=0.18.1,<0.20",
"GitPython>=3.1.0,<3.2",
"hiredis>=2.2.1,<3.1",
"html2text>=2024.2.25,<2024.2.27",
"iniparse==0.5",
"jsonschema>=4.23.0,<5",
"lxml>=5.2.0,<5.4",
"mistletoe>=1.4.0,<1.5",
"nh3>=0.2.14,<0.3",
"openpyxl>=3.1.0,<3.2",
"packaging>=22,<25",
"phply>=1.2.6,<1.3",
"Pillow>=10.3.0,<12",
"pycairo>=1.20.0",
"Pygments>=2.17.0,<3.0",
"PyGObject>=3.40.1",
"pyicumessageformat>=1.0.0,<1.1",
"pyparsing>=3.1.1,<3.3",
"python-dateutil>=2.8.2",
"python-redis-lock[django]>=4,<4.1",
"qrcode>=7.4.1,<8.1",
"rapidfuzz>=3.8.0,<3.11",
"redis>=5.0.2,<5.3.0",
"requests>=2.32.2,<2.33",
"ruamel.yaml>=0.17.2,<0.19.0",
"sentry-sdk>=2.15.0,<3.0",
"siphashc>=2.1,<3.0",
"social-auth-app-django>=5.4.1,<6.0.0",
"social-auth-core>=4.5.0,<5.0.0",
"tesserocr>=2.6.1,<2.8.0",
"translate-toolkit>=3.14.1,<3.15",
"translation-finder>=2.18,<3.0",
"user-agents>=2.0,<2.3",
"weblate-language-data>=2024.14",
"weblate-schemas==2024.2"
]
description = "A web-based continuous localization system with tight version control integration"
keywords = [
"i18n",
"l10n",
"gettext",
"git",
"mercurial",
"translate"
]
license = {text = "GPLv3+"}
name = "weblate"
requires-python = ">=3.11"
version = "5.9-dev"
[project.optional-dependencies]
alibaba = [
"aliyun-python-sdk-alimt>=3.2.0,<4.0.0",
"aliyun-python-sdk-core>=2.16.0,<3.0.0"
]
all = [
"weblate[alibaba,amazon,antispam,gerrit,google,ldap,mercurial,openai,postgres,saml,zxcvbn]"
]
amazon = [
"boto3>=1.28.62,<1.36.0"
]
antispam = [
"python-akismet>=0.4.2,<0.5"
]
gerrit = [
"git-review>=2.4.0,<2.5.0"
]
google = [
"google-cloud-translate>=3.13.0,<4.0",
"google-cloud-storage>=2.18.2,<3.0"
]
ldap = [
"django-auth-ldap>=4.6.0,<6.0.0"
]
mercurial = [
"mercurial>=6.8.0,<7.0"
]
mysql = [
"mysqlclient>=2.1.1,<3"
]
openai = [
"openai>=1.28.1,<2.0"
]
postgres = [
"psycopg[binary]>=3.1.8,<4"
]
saml = [
"python3-saml>=1.2.1"
]
saml2idp = [
"djangosaml2idp==0.7.2"
]
wlhosted = [
"wlhosted"
]
wllegal = [
"wllegal>=2024.6"
]
wsgi = [
"gunicorn==23.0.0"
]
zxcvbn = [
"django-zxcvbn-password==2.1.1"
]
[project.readme]
content-type = "text/x-rst"
file = "README.rst"
[project.scripts]
weblate = "weblate.runner:main"
weblate-generate-secret-key = "weblate.utils.generate_secret_key:main"
[project.urls]
Documentation = "https://docs.weblate.org/"
Download = "https://weblate.org/download/"
Funding = "https://weblate.org/donate/"
Homepage = "https://weblate.org/"
"Issue Tracker" = "https://github.com/WeblateOrg/weblate/issues"
"Release Notes" = "https://docs.weblate.org/en/latest/changes.html"
"Source Code" = "https://github.com/WeblateOrg/weblate"
Twitter = "https://twitter.com/WeblateOrg"
[tool.check-manifest]
ignore = [
".well-known/*",
".gitmodules",
"scripts/*",
"scripts/*/*",
"scripts/*/*/*",
"scripts/*/*/*/*",
"docs/*",
"docs/*/*",
"docs/*/*/*",
"docs/*/*/*/*",
"client/*",
"client/*/*",
"ci/*",
"dev-docker/*",
"dev-docker/*/*",
"LICENSES/*",
"*.toml",
"*.yml",
"*.yaml",
"*.json",
"rundev.sh",
".editorconfig",
".gitmodules",
".imgbotconfig",
".reuse/dep5",
".stylelintrc",
".weblate",
".yamllint.yml"
]
ignore-bad-ideas = [
"weblate/trans/tests/data/cs.mo" # Test data
]
[tool.check-wheel-contents]
ignore = [
"W002", # Triggered by __init__.py or .license files
"W004" # Django migrations fail here
]
[tool.codespell]
count = true
ignore-words-list = "assertIn"
skip = '*.po,*.pot,*.json,*.tmx,*.tbx,*.csv,*/vendor/*,weblate/trans/specialchars.py,scripts/yarn/yarn.lock,weblate/trans/tests/data/known_hosts,docs/user/checks.rst,docs/toc-devel.rst,docs/changes/contributors/*.rst'
[tool.coverage.paths]
source = [
"."
]
[tool.coverage.report]
exclude_also = [
"@(abc\\.)?abstractmethod",
# Have to re-enable the standard pragma
"pragma: no cover",
# Don't complain about missing debug-only code:
"def __repr__",
"if self\\.debug",
# Don't complain if tests don't hit defensive assertion code:
"raise AssertionError",
"raise NotImplementedError",
# Don't complain if non-runnable code isn't run:
"if 0:",
"if __name__ == .__main__.:",
# Type checking
"if TYPE_CHECKING:"
]
[tool.coverage.run]
branch = true
concurrency = ["thread", "multiprocessing"]
omit = [
"weblate/settings_*.py",
"weblate/settings.py",
".venv*/*"
]
[tool.django-stubs]
django_settings_module = "weblate.settings_example"
strict_settings = false
[tool.djlint]
blank_line_after_tag = "load,extends,endblock"
# - reconsider T032 and H014 once formatter is in use
# T003 - Endblock should have name.
# T002 - Double quotes should be used in tags. (makes using tags in attributes hard)
# H013 - Img tag should have an alt attribute.
# H006 - Img tag should have height and width attributes.
# H021 - Inline styles should be avoided.
# H031 - Consider adding meta keywords.
ignore = "T003,H014,T032,T002,H013,H006,H021,H031"
indent = 2
max_attribute_length = 80
max_blank_lines = 2
preserve_blank_lines = true
profile = "django"
[tool.djlint.per-file-ignores]
# Mail templates need inline CSS and do not utilize description
"weblate/templates/mail/base.html" = "H030"
# Test file
"weblate/trans/tests/data/cs.html" = "H005,H007,H016,H030"
[tool.mypy]
check_untyped_defs = true
plugins = [
"mypy_django_plugin.main",
"mypy_drf_plugin.main"
]
[[tool.mypy.overrides]]
disallow_untyped_defs = true
ignore_missing_imports = true
module = [
"cyrtranslit.*",
"mistletoe.*",
"simple_sso.*",
"social_django.*",
"social_core.*",
"ruamel.*",
"aliyunsdkcore.*",
"aliyunsdkalimt.*",
"google.oauth2.*",
"user_agents.*",
"translation_finder.*",
"weblate_language_data.*",
"django_redis.*",
"pygments.*",
"redis_lock.*",
"borg.*",
"rollbar.*",
"crispy_forms.*",
"akismet.*",
"gi.*",
"diff_match_patch.*",
"saml2.*",
"ldap.*",
"django_auth_ldap.*",
"pyicumessageformat.*",
"django_filters.*",
"tesserocr.*",
"django_celery_beat.*",
"translate.*",
"appconf.*",
"wllegal.*",
"wlhosted.*",
"djangosaml2idp.*",
"debug_toolbar.*",
"weblate_schemas.*",
"django.db.backends.postgresql.psycopg_any",
"django_otp.*",
"django_otp_webauthn.*",
"qrcode.*"
]
[tool.pydistcheck]
max_allowed_files = 2500
max_allowed_size_compressed = '100M'
max_allowed_size_uncompressed = '300M'
[tool.pylint.main]
disable = [
"C",
"W",
"R",
"I",
"no-member",
"not-a-mapping",
"unsubscriptable-object",
"unsupported-membership-test",
"not-an-iterable",
"unsupported-binary-operation",
"c-extension-no-member",
"not-callable",
"invalid-str-returned",
"raising-bad-type",
"no-name-in-module",
"import-error"
]
extension-pkg-whitelist = ["siphashc"]
ignore = [
"migrations",
"settings.py",
"settings_test.py",
".git",
"test-repos",
"repos",
"build",
".venv"
]
[tool.pytest.ini_options]
DJANGO_SETTINGS_MODULE = "weblate.settings_test"
FAIL_INVALID_TEMPLATE_VARS = true
addopts = "--reuse-db --cov=weblate --cov-report="
python_files = ["test_*.py", "tests.py"]
[tool.ruff.lint]
extend-safe-fixes = [
"D",
"TCH",
"FLY",
"SIM",
"ANN",
"FA102",
"UP"
]
# CONFIG - intentional configuration
# TODO - needs decision whether intention, add noqa tags or fix
# WONTFIX - not fixable in current codebase, might be better to go for noqa
ignore = [
"COM", # CONFIG: No trailing commas
"PT", # CONFIG: Not using pytest
"D203", # CONFIG: incompatible with D211
"D212", # CONFIG: incompatible with D213
"FIX002", # CONFIG: we use TODO
"TD002", # CONFIG: no detailed TODO documentation is required
"TD003", # CONFIG: no detailed TODO documentation is required
"S404", # CONFIG: `subprocess` module is possibly insecure
"S603", # CONFIG: `subprocess` call: check for execution of untrusted input
"S607", # CONFIG: executing system installed tools
"D206", # CONFIG: formatter
'ISC001', # CONFIG: formatter
'Q000', # CONFIG: formatter
'Q001', # CONFIG: formatter
'Q002', # CONFIG: formatter
'Q003', # CONFIG: formatter
'W191', # CONFIG: formatter
"E203", # CONFIG: formatter
"PTH", # TODO: Not using pathlib
"FBT", # TODO: Boolean in function definition
"BLE001", # WONTFIX: Do not catch blind exception: `Exception`, third-party modules do not have defined exceptions
"ARG001", # TODO: Unused function argument (mostly for API compatibility)
"ARG002", # TODO: Unused method argument (mostly for API compatibility)
"ANN001", # TODO: Missing type annotation for function argument
"ANN002", # TODO: Missing type annotation for `*args`
"ANN003", # TODO: Missing type annotation for `**kwargs`
"ANN201", # TODO: Missing return type annotation for public function
"ANN202", # TODO: Missing return type annotation for private function
"ANN204", # TODO: Missing return type annotation for special method
"ANN205", # TODO: Missing return type annotation for staticmethod
"ANN206", # TODO: Missing return type annotation for classmethod
"D100", # TODO: Missing docstring in public module
"D101", # TODO: Missing docstring in public class
"D102", # TODO: Missing docstring in public method
"D103", # TODO: Missing docstring in public function
"D104", # TODO: Missing docstring in public package
"D105", # TODO: Missing docstring in magic method
"D106", # TODO: Missing docstring in public nested class
"D107", # TODO: Missing docstring in `__init__`
"DOC", # TODO: Ignore all pydoclint rules for now
"TRY003", # WONTFIX: Avoid specifying long messages outside the exception class
"PERF203", # WONTFIX: This rule is only enforced for Python versions prior to 3.11
"PLR6301", # TODO: Method could be a function, class method, or static method
"PLR2004", # TODO: Magic value used in comparison, consider replacing 201 with a constant variable
"PLC0415", # TODO: `import` should be at the top-level of a file
"RUF001", # WONTFIX: String contains ambiguous unicode character, we are using Unicode
"RUF012", # TODO: Mutable class attributes should be annotated with `typing.ClassVar`
"E501", # WONTFIX: we accept long strings (rest is formatted by black)
"A005", # WONTFIX: Module is shadowing a Python builtin module
"PLW2901", # TODO: overwriting variables inside loop
"PLW1514", # TODO: `open` in text mode without explicit `encoding` argument
"FURB101", # TODO: `open` and `read` should be replaced by `Path(hostsfile).read_text()`
"FURB103" # TODO: `open` and `write` should be replaced by `Path(name).write_text(content)`
]
preview = true
select = ["ALL"]
[tool.ruff.lint.flake8-copyright]
min-file-size = 2
# Copyright without a year, see https://github.com/astral-sh/ruff/issues/10062
notice-rgx = "(?i)Copyright\\s+©\\s+"
[tool.ruff.lint.mccabe]
max-complexity = 16 # TODO: should be lower
[tool.ruff.lint.per-file-ignores]
"docs/_ext/djangodocs.py" = ["INP001"]
"docs/conf.py" = ["INP001", "ERA001"]
"scripts/*" = ["T201", "T203"]
"weblate/*/tests**.py" = ["S106", "S105"]
"weblate/auth/migrations/0003_fixup_teams.py" = ["T201"]
"weblate/examples/*.py" = ["INP001"]
"weblate/settings_*.py" = ["F405"]
"weblate/settings_example.py" = ["ERA001"]
"weblate/utils/generate_secret_key.py" = ["T201"]
[tool.ruff.lint.pylint]
# TODO: all these should be lower (or use defaults)
max-args = 12
max-bool-expr = 8
max-branches = 36
max-locals = 23
max-nested-blocks = 9
max-positional-args = 8
max-public-methods = 180
max-returns = 21
max-statements = 100
[tool.setuptools]
include-package-data = true
zip-safe = false
[tool.setuptools.packages]
find = {namespaces = false}
[tool.uv.sources]
wlhosted = {path = "../hosted", editable = true}