-
Notifications
You must be signed in to change notification settings - Fork 0
/
pyproject.toml
208 lines (178 loc) · 6.58 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
[build-system] # https://python-poetry.org/docs/pyproject/#poetry-and-pep-517
requires = ["poetry_core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
[tool.poetry] # https://python-poetry.org/docs/pyproject/
package-mode = false
name = "vkusvill-green-labels"
[tool.poetry.dependencies] # https://python-poetry.org/docs/dependency-specification/
python = "^3.12"
pydantic = "^2.9.2"
apscheduler = "^3.10.4"
loguru = "^0.7.2"
pydantic-settings = "^2.5.2"
httpx = "^0.27.2"
sqlalchemy = {extras = ["asyncio"], version = "^2.0.35"}
asyncpg = "^0.29.0"
advanced-alchemy = "^0.19.3"
alembic = "^1.13.2"
redis = {extras = ["hiredis"], version = "^5.0.8"}
aiogram = "^3.13.1"
dishka = "^1.3.0"
sentry-sdk = {extras = ["loguru"], version = "^2.16.0"}
aiohttp = "^3.10.10"
[tool.poetry.group.dev.dependencies] # https://python-poetry.org/docs/master/managing-dependencies/
mypy = "^1.11.2"
pre-commit = "^3.8.0"
pytest = "^8.3.3"
pytest-cov = "^5.0.0"
coverage = "^7.6.1"
ruff = "^0.6.5"
safety = "^3.2.7"
deptry = "^0.20.0"
respx = "^0.21.1"
testcontainers = {extras = ["postgres", "redis"], version = "^4.8.1"}
pytest-asyncio = "^0.24.0"
pytest-alembic = "^0.11.1"
pytest-postgresql = "^6.1.1"
polyfactory = "^2.17.0"
[tool.mypy] # https://mypy.readthedocs.io/en/latest/config_file.html#using-a-pyproject-toml-file
junit_xml = "reports/mypy.xml"
python_version = "3.12"
pretty = true
show_column_numbers = true
show_error_codes = true
show_error_context = true
show_traceback = true
color_output = true
plugins = ["pydantic.mypy"]
strict = true # https://mypy.readthedocs.io/en/stable/existing_code.html#introduce-stricter-options
ignore_missing_imports = true
disallow_untyped_decorators = false
[[tool.mypy.overrides]]
module = "tests.*"
disallow_untyped_defs = false
disallow_incomplete_defs = false
disallow_untyped_calls = false
[tool.pydantic-mypy] # https://pydantic-docs.helpmanual.io/mypy_plugin/#configuring-the-plugin
init_forbid_extra = true
init_typed = true
warn_required_dynamic_aliases = true
warn_untyped_fields = true
[tool.pytest.ini_options]
# https://docs.pytest.org/en/6.2.x/customize.html#pyproject-toml
# https://docs.pytest.org/en/latest/reference/reference.html#ini-options-ref
filterwarnings = ["error", "ignore::DeprecationWarning", "ignore::ImportWarning", "ignore::ResourceWarning"]
testpaths = ["vkusvill_green_labels", "tests"]
xfail_strict = true
asyncio_mode = "auto"
asyncio_default_fixture_loop_scope = "function"
# Extra options:
addopts = [
"--color=yes",
"--failed-first",
"--strict-config",
"--strict-markers",
"--tb=short",
"--verbosity=2",
"--doctest-modules",
"--doctest-continue-on-failure",
"--cov",
"--junitxml=reports/junit.xml",
]
[tool.coverage.run] # https://coverage.readthedocs.io/en/latest/config.html#run
branch = true
data_file = "reports/.coverage"
source = ["vkusvill_green_labels"]
[tool.coverage.report] # https://coverage.readthedocs.io/en/latest/config.html#report
precision = 1
show_missing = true
skip_covered = true
[tool.coverage.xml] # https://coverage.readthedocs.io/en/latest/config.html#xml
output = "reports/coverage.xml"
[tool.pylint.basic]
class-attribute-naming-style = "any"
class-const-naming-style = "any"
good-names = ["i", "j", "k", "e", "x", "id", "_", "pk"]
[tool.pylint.exceptions]
overgeneral-exceptions = ["builtins.BaseException", "builtins.Exception"]
[tool.ruff] # https://github.com/charliermarsh/ruff
line-length = 100
target-version = "py312"
[tool.ruff.lint]
select = ["ALL"]
ignore = [
"D", # pydocstyle
"TD", # flake8-todos
"FIX", # flake8-fixme
"ANN", # flake8-annotations (handled by mypy)
"EM", # flake8-errmsg - String literals in exceptions
"E501", # pycodestyle - line too long (handled by formatter)
"COM812", # forced by ruff formatter
"ISC001", # forced by ruff formatter
"TRY003", # long message for exceptions
"EM101", # allow string literals for exceptions
"EM102", # allow f-string literals for exceptions
"FBT001", # Boolean-typed positional argument in function definition
]
unfixable = [
"F", # pyflakes
"ERA", # eradicate - commented-out code
]
allowed-confusables = [
"а", "А", "б", "Б", "в", "В", "г", "Г", "е", "Е", "з", "З", "и", "И", "к", "К", "м", "М",
"н", "Н", "о", "О", "р", "Р", "с", "С", "т", "Т", "у", "У", "ф", "Ф", "х", "Х" # Allow cyrillic letters
]
[tool.ruff.lint.per-file-ignores]
"__init__.py" = [
"F401", # Unused import
"F403", # Import star
"ARG001", # Unused function argument (using fixtures from other fixtures)
]
"tests/**/*.py" = [
"S101", # Use of assert detected (assert allowed in tests)
"S105", # Possible hardcoded password
"S106", # Possible hardcoded password
"PLR2004", # Magic value used in comparison
]
[tool.ruff.lint.flake8-tidy-imports] # https://docs.astral.sh/ruff/settings/#lintflake8-tidy-imports
ban-relative-imports = "all"
[tool.ruff.lint.flake8-boolean-trap] # https://docs.astral.sh/ruff/settings/#lintflake8-bugbear
extend-allowed-calls = ["pydantic.Field", "django.db.models.Value"]
[tool.ruff.lint.flake8-builtins]
builtins-ignorelist = ["id"]
[tool.ruff.lint.flake8-bugbear] # https://docs.astral.sh/ruff/settings/#lintflake8-bugbear
extend-immutable-calls = ["fastapi.Depends", "fastapi.Query", "fastapi.Path", "fastapi.Body", "fastapi_filter.FilterDepends"]
[tool.ruff.lint.flake8-type-checking]
exempt-modules = ["typing", "typing_extensions"]
[tool.ruff.lint.isort] # https://docs.astral.sh/ruff/settings/#isort
section-order = ["future", "typing", "standard-library", "third-party", "first-party", "local-folder"]
lines-between-types = 1
split-on-trailing-comma = false
[tool.ruff.lint.isort.sections]
"typing" = ["typing", "types", "typing_extensions", "mypy", "mypy_extensions"]
[tool.ruff.lint.pep8-naming]
classmethod-decorators = [
# Allow Pydantic's `@validator` decorator to trigger class method treatment.
"pydantic.validator",
# Allow SQLAlchemy's dynamic decorators, like `@field.expression`, to trigger class method treatment.
"declared_attr",
"expression",
"comparator",
]
[tool.ruff.lint.pycodestyle] # https://docs.astral.sh/ruff/settings/#pycodestyle
max-doc-length = 100
[tool.ruff.lint.pydocstyle] # https://docs.astral.sh/ruff/settings/#pydocstyle
convention = "google"
[tool.ruff.lint.pylint] # https://docs.astral.sh/ruff/settings/#pylint
allow-dunder-method-names = ["__tablename__", "__table_args__"]
allow-magic-value-types = ["int", "str", "bytes"]
max-args = 10
max-statements = 30
[tool.ruff.format]
docstring-code-format = true
indent-style = "space"
quote-style = "double"
skip-magic-trailing-comma = true
[tool.deptry.per_rule_ignores]
DEP002 = ["asyncpg", "apscheduler"]
DEP003 = []