-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpyproject.toml
More file actions
356 lines (293 loc) · 10.1 KB
/
Copy pathpyproject.toml
File metadata and controls
356 lines (293 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
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
[project]
name = "django-react-boilerplate"
version = "0.1.0"
description = "A robust, production-ready boilerplate designed to jumpstart generic web applications. This project bridges the gap between a powerful Django REST Framework backend and a high-speed Vite-powered React frontend."
authors = [
{name = "git-evinci",email = "gustavo.adolfo@evinci.com.br"}
]
readme = "docs/README.md"
license = "MIT License"
requires-python = ">=3.12,<4.0"
dependencies = [
"chardet (>=7.4.3,<8.0.0)",
"django (>=6.0.4,<7.0.0)",
"django-allauth (>=65.16.0,<66.0.0)",
"django-celery-beat (>=2.9.0,<3.0.0)",
"django-constance (>=4.3.5,<5.0.0)",
"django-cors-headers (>=4.9.0,<5.0.0)",
"django-crispy-forms (>=2.6,<3.0)",
"django-extensions (>=4.1,<5.0)",
"django-guardian (>=3.3.1,<4.0.0)",
"django-import-export (>=4.4.0,<5.0.0)",
"django-location-field (>=2.7.3,<3.0.0)",
"django-modeltranslation (>=0.20.2,<0.21.0)",
"django-money (>=3.6.0,<4.0.0)",
"django-redis (>=6.0.0,<7.0.0)",
"django-simple-history (>=3.11.0,<4.0.0)",
"django-unfold @ git+https://github.com/unfoldadmin/django-unfold.git",
"django-versatileimagefield (>=3.1,<4.0)",
"django-vite (>=3.1.0,<4.0.0)",
"djangorestframework (>=3.17.1,<4.0.0)",
"drf-spectacular (>=0.29.0,<0.30.0)",
"drf-spectacular-sidecar (>=2026.4.1,<2027.0.0)",
"gunicorn (>=25.3.0,<26.0.0)",
"psycopg2-binary (>=2.9.11,<3.0.0)",
"python-dotenv (>=1.2.2,<2.0.0)",
"redis (>=7.4.0,<8.0.0)",
"sentry-sdk (>=2.58.0,<3.0.0)",
"whitenoise (>=6.12.0,<7.0.0)"
]
[dependency-groups]
dev = [
"pytest (>=9.0.3,<10.0.0)",
"dotenv (>=0.9.9,<0.10.0)",
"django-debug-toolbar (>=6.3.0,<7.0.0)",
"black (>=26.3.1,<27.0.0)",
"mypy (>=1.20.1,<2.0.0)",
"flake8 (>=7.3.0,<8.0.0)",
"ruff (>=0.15.10,<0.16.0)",
"pytest-cov (>=7.1.0,<8.0.0)",
"django-extensions (>=4.1,<5.0)",
"django-stubs-ext (>=6.0.2,<7.0.0)",
"django-types (>=0.23.0,<0.24.0)",
"pygments (>=2.20.0,<3.0.0)",
"pillow (>=12.2.0,<13.0.0)",
"pre-commit (>=4.5.1,<5.0.0)"
]
[build-system]
requires = ["poetry-core>=2.0.0,<3.0.0"]
build-backend = "poetry.core.masonry.api"
[tool.poetry]
# Disables package installation mode so Poetry works solely as a
# dependency manager for your Django web application.
package-mode = false
[tool.ruff]
fix = true
line-length = 120
target-version = "py312" # Python version for compatibility
# Exclude a variety of commonly ignored directories.
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".git-rewrite",
".hg",
".ipynb_checkpoints",
".mypy_cache",
".nox",
".pants.d",
".pyenv",
".pytest_cache",
".pytype",
".ruff_cache",
".svn",
".tox",
".venv",
".vscode",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"management",
"site-packages",
"venv",
"**/migrations"
]
[tool.ruff.format]
quote-style = "double"
#indent-style = "tab"
#skip-magic-trailing-comma = false
line-ending = "auto"
docstring-code-format = true
docstring-code-line-length = "dynamic"
[tool.ruff.lint]
select = [
# Annotation & typing rules
"ANN",
# "ANN001", # Missing type annotation for function argument {name}
# "ANN002", # Missing type annotation for *{name}
# "ANN003", # Missing type annotation for **{name}
# "ANN201", # Missing return type annotation for public function {name}
# "ANN202", # Missing return type annotation for private function {name}
# "ANN204", # Missing return type annotation for special method {name}
# "ANN205", # Missing return type annotation for staticmethod {name}
# "ANN206", # Missing return type annotation for classmethod {name}
# "ANN401", # Dynamically typed expressions (typing.Any) are disallowed in {name}
"ARG", # Argument/parameter related issues
# Bug prevention
"B", # Builtin misuse and potential bugs
# Code complexity & style
"C4", # Comprehensions improvements
"C90", # McCabe cyclomatic complexity
# Documentation
"D", # Docstring conventions
# Django-specific rules
"DJ", # Django best practices
# Datetime & timezone safety
"DTZ", # Requires timezone-aware datetimes
# Error handling
"E", # Syntax errors, indentation, etc.
"EM", # Exception handling improvements
# Formatting & style (originally from pyflakes)
"F", # Pyflakes rules
# Global variables
"G", # Global statement misuse
# Import sorting
"I", # Unsorted/ungrouped imports
# Implicit string concatenation
"ISC", # Detects potentially dangerous implicit string concat
# Logging
"LOG", # Logging format issues
# Naming conventions
"N", # PEP 8 naming violations
# Flake8-pie rules
"PIE", # Python improvement recommendations
# Python typing
"PT", # Type-related checks
# Path handling
"PTH", # os.path vs Pathlib recommendations
# Return statements
"RET", # Return consistency checks
# Ruff-specific rules
"RUF", # Additional Ruff-specific checks
# Quote consistency
"Q", # Single vs double quotes
# Simplification
"SIM", # Code that can be simplified
# TensorFlow-specific (if used)
"T10", # TensorFlow best practices
# Try-except handling
"TRY", # Try-except improvements
# Unicode & string handling
"UP", # Unicode normalization checks
]
ignore = [
"ISC001", # Implicit string concatenation
"D203", # 1 blank line required before class docstring
"D213", # Multi-line docstring summary should start at the second line
"TRY003", # Avoid specifying long messages outside the exception class
"EM101", # Exception message should be a string literal
"ARG005", # Unused lambda argument
"ARG002",
"ANN401",
"E501", # line too long, handled by black
]
fixable = ["ALL"]
unfixable = []
[tool.ruff.lint.per-file-ignores]
"tests/*" = ["D", "ANN"]
"__init__.py" = ["D"]
"backend/core/*/__init__.py" = ["F403"]
# Optional: Add these configurations for stricter checks
[tool.ruff.lint.flake8-annotations]
allow-star-arg-any = true # Allow `*args: Any`, `**kwargs: Any`
[tool.ruff.lint.flake8-unused-arguments]
ignore-variadic-names = true # Ignore unused `*args`, `**kwargs`
[tool.ruff.lint.flake8-pytest-style]
mark-parentheses = false
[tool.ruff.lint.isort]
section-order = [
"future",
"standard-library",
"third-party",
"django",
"first-party",
"local",
"local-folder",
]
[tool.ruff.lint.isort.sections]
"django" = ["django", "wagtail"]
"local" = ["core", "pages"]
[tool.pylint."MESSAGES CONTROL"]
max-line-length = 120
disable = ["fixme", "too-many-arguments", "arguments-differ", "too-many-ancestors", "broad-exception-caught", "pointless-string-statement", "useless-parent-delegation"]
load-plugins = ["pylint_per_file_ignores", "pylint_django"]
per-file-ignores = """
/tests/:missing-function-docstring,assignment-from-no-return,not-context-manager,django-not-configured,imported-auth-user,missing-module-docstring
/migrations/:invalid-name,missing-class-docstring,wrong-import-order
models.py:too-many-ancestors
manage.py:import-outside-toplevel
"""
django-settings-module = "core.settings"
init-hook = 'import sys; sys.path.append("./app")'
ignore-paths = [".*[/\\\\]migrations[/\\\\]"]
[tool.pylint.MASTER]
# Adds backend to path for linting/running
init-hook = 'import sys; os.path.append("./backend")'
[tool.mypy]
plugins = ["mypy_django_plugin.main"]
mypy_path = "backend" # Tells MyPy to look inside backend/ for core
exclude = ["^.*/migrations/", "^.*/tests/", "^.*/management/", "^.*/scripts/", "tests/"]
disallow_untyped_defs = false
check_untyped_defs = true
# Correct plugin configuration (single table)
[tool.mypy-plugins.django-stubs]
django_settings_module = "core.settings"
# General django-stubs configuration
[tool.django-stubs]
django_settings_module = "core.settings"
ignore_missing_model_attributes = true
# Overrides (array of tables)
[[tool.mypy.overrides]]
module = "tablib.*"
ignore_missing_imports = true
# Overrides (array of tables)
[[tool.mypy.overrides]]
module = "allauth.*"
ignore_missing_imports = true
[[tool.mypy.overrides]]
module = "user_agents"
ignore_missing_imports = true
[[tool.mypy.overrides]]
module = "simple_history.*"
ignore_missing_imports = true
[[tool.mypy.overrides]]
module = "unfold.*"
ignore_missing_imports = true
[tool.poe.tasks.test]
help = "Pytest with coverage."
# Added --cov=backend to specify exactly what to measure
cmd = "pytest backend --showlocals --tb=auto -ra --cov=backend --cov-branch --cov-report=term-missing"
[tool.poe.tasks.mypy]
# Explicitly check the backend directory
cmd = "mypy --install-types --check-untyped-defs backend"
[tool.poe.tasks.pylint]
# Updated paths to reflect your backend/ folder structure
cmd = "pylint tests backend/core"
[tool.poe.tasks.ruff]
# Checking the whole project but focusing ruff's engine on the source
cmd = "ruff check backend scripts tests"
[tool.poe.tasks.check]
sequence = ["mypy", "pylint", "ruff"]
[tool.poe.tasks.format]
cmd = "ruff format backend scripts tests"
[tool.poe.tasks.dev]
help = "Run development server."
# Ensure path to manage.py is correct from the root
cmd = "python ./backend/manage.py runserver 127.0.0.1:8000"
[tool.poe.tasks.makemigrations]
help = "Generate new migrations."
cmd = "python ./backend/manage.py makemigrations"
[tool.poe.tasks.migrate]
help = "Migrate existing migrations."
cmd = "python ./backend/manage.py migrate"
[tool.poe.tasks.manage]
cmd = "python ./backend/manage.py"
[tool.poe.tasks.shell]
help = "Run Django shell_plus"
cmd = "python ./backend/manage.py shell_plus"
[tool.poe.tasks.schema]
help = "Export OpenAPI schema to file."
cmd = "python ./backend/manage.py spectacular --file schema.yml"
[tool.pytest.ini_options]
# Tell pytest where your Django settings are
DJANGO_SETTINGS_MODULE = "core.settings.development"
# Add the backend folder to the Python path so it can find the 'core' module
pythonpath = [".", "backend"]
# Define test file naming conventions
python_files = ["test_*.py", "*_test.py"]
# Tell pytest which directories to scan for tests
testpaths = ["tests"]