-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathpyproject.toml
213 lines (194 loc) · 6.34 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
[tool.poetry]
name = "api-client-pydantic"
version = "3.1.0"
description = "API Client extension for validate and transform requests / responses using pydantic."
authors = ["MaxST <[email protected]>"]
license = "MIT"
repository = 'https://github.com/mom1/api-client-pydantic'
homepage = 'https://github.com/mom1/api-client-pydantic'
keywords = ['api-client', 'api-client-extension']
readme = 'README.md'
classifiers = [
'Development Status :: 5 - Production/Stable',
'Environment :: Web Environment',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
]
include = ['AUTHORS']
packages = [
{ include = 'apiclient_pydantic' },
]
[tool.poetry.dependencies]
python = ">=3.9,<4"
api-client = ">1.2.1"
pydantic = ">=2.10,<3.0"
[tool.poetry.dev-dependencies]
# tests
coverage = "^7.6"
pytest = "^8.3"
pytest-cov = "^6.0"
pytest-asyncio = "^0.25"
# formating
ruff = "^0.8"
mypy = "^1.10"
types-setuptools = "^75.6"
types-toml = "^0.10"
# checks
pre-commit = "^4.0"
[build-system]
requires = ["poetry-core>=1.8"]
build-backend = "poetry.core.masonry.api"
[tool.ruff]
# ruff configuration:
# https://docs.astral.sh/ruff/settings/#top-level
target-version = "py39"
fix = true
unsafe-fixes = true
line-length = 120
extend-exclude = ["apiclient_pydantic/v1"]
[tool.ruff.lint]
select = ["ALL"]
fixable = ["ALL"]
extend-ignore = [
"PGH003",
"FBT", # flake8-boolean-trap
"FA", # flake8-future-annotations
"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__
"D203", # 1 blank line required before class docstring
"D213", # Multi-line docstring summary should start at the second line
"D301", # Use r""" if any backslashes in a docstring
"D401", # The First line of docstring should be in imperative mood
"D413", # Missing blank line after last section ("{name}")
"DJ012", # django-unordered-body-content-in-model
"E203", # Whitespace around slice operators
"G004", # logging-f-string
"PLR0913", # too-many-arguments
"RET501", # Do not explicitly `return None` in function if it is the only possible return value
"RET502", # Do not implicitly `return None` in function able to return non-`None` value
"RET503", # Missing explicit `return` at the end of function able to return non-`None` value
"RUF001", # ambiguous-unicode-character-string
"RUF002", # ambiguous-unicode-character-docstring
"RUF003", # ambiguous-unicode-character-comment
"RUF012", # Mutable class attributes should be annotated with typing.ClassVar
"S105", # hardcoded-password-string
"S608", # hardcoded-sql-expression
"SIM105", # Use contextlib.suppress({exception}) instead of try-except-pass
# https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules
"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
]
flake8-quotes = { inline-quotes = "single" }
[tool.ruff.lint.per-file-ignores]
"tests/**/*.py" = [
"S101", # assert
"S106", # hardcoded-password-func-arg
"S311", # suspicious-non-cryptographic-random-usage
"PLR2004", # magic-value-comparison
"ANN", # flake8-annotations
]
[tool.ruff.format]
# https://docs.astral.sh/ruff/settings/#format
quote-style = "single"
[tool.ruff.lint.isort]
# https://docs.astral.sh/ruff/settings/#isort
combine-as-imports = true
known-first-party = ["apiclient_pydantic", "tests"]
known-local-folder = ["."]
[tool.mypy]
# https://mypy.readthedocs.io/en/latest/config_file.html#using-a-pyproject-toml-file
pretty = true
show_traceback = true
color_output = true
exclude = ["apiclient_pydantic/v1"]
plugins = ["pydantic.mypy"]
follow_imports = "silent"
strict_optional = true
warn_redundant_casts = true
warn_unused_ignores = true
disallow_any_generics = true
check_untyped_defs = true
no_implicit_reexport = true
disallow_untyped_defs = true
ignore_missing_imports = true
[tool.pydantic-mypy]
init_forbid_extra = true
init_typed = true
warn_required_dynamic_aliases = true
[[tool.mypy.overrides]]
module = [
'pydantic_core.*',
'apiclient.*',
]
follow_imports = "skip"
[tool.coverage.run]
# Coverage configuration:
# https://coverage.readthedocs.io/en/latest/config.html
# https://coverage.readthedocs.io/en/latest/config.html#run
branch = true
source = ["apiclient_pydantic"]
omit = ["tests", ".github"]
[tool.coverage.report]
# https://coverage.readthedocs.io/en/latest/config.html#report
fail_under = 100
show_missing = true
exclude_lines = [
"pragma: no cover",
"if TYPE_CHECKING:",
"raise AssertionError",
"raise NotImplementedError",
"if __name__ == .__main__.:",
]
[tool.pytest.ini_options]
# pytest configuration:
# https://docs.pytest.org/en/stable/customize.html
python_files = ["tests.py", "test_*.py", "*_tests.py"]
asyncio_mode = 'auto'
asyncio_default_fixture_loop_scope = 'function'
# Directories that are not visited by pytest collector:
norecursedirs = [
"*.egg",
".eggs",
"dist",
"build",
"docs",
".tox",
".git",
"__pycache__",
]
addopts = [
"-v",
"--strict-markers",
"--strict-config",
"--tb=short",
"--cov=apiclient_pydantic",
"--cov-report=term-missing:skip-covered",
"--cov-report=html",
"--no-cov-on-fail",
]
filterwarnings = ["ignore:A private pytest class or function was used.:_pytest.warning_types.PytestDeprecationWarning"]