forked from zmievsa/cadwyn
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pyproject.toml
239 lines (222 loc) · 7.82 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
[tool.poetry]
name = "cadwyn"
version = "3.4.1"
description = "Production-ready community-driven modern Stripe-like API versioning in FastAPI"
authors = ["Stanislav Zmiev <zmievsa@gmail.com>"]
license = "MIT"
readme = "README.md"
repository = "https://github.com/zmievsa/cadwyn"
documentation = "https://docs.cadwyn.dev"
keywords = [
"python",
"api",
"json-schema",
"stripe",
"versioning",
"code-generation",
"hints",
"api-versioning",
"pydantic",
"fastapi",
"python310",
"python311",
"python312",
]
classifiers = [
"Intended Audience :: Information Technology",
"Intended Audience :: System Administrators",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Internet",
"Topic :: Software Development :: Libraries :: Application Frameworks",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Software Development :: Libraries",
"Topic :: Software Development",
"Typing :: Typed",
"Development Status :: 5 - Production/Stable",
"Environment :: Web Environment",
"Framework :: AsyncIO",
"Framework :: FastAPI",
"Framework :: Pydantic",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Topic :: Internet :: WWW/HTTP :: HTTP Servers",
"Topic :: Internet :: WWW/HTTP",
]
[tool.poetry.dependencies]
python = "^3.10"
typing-extensions = "*"
fastapi = ">=0.96.1"
pydantic = ">=1.0.0"
typer = {version = ">=0.7.0", optional = true}
verselect = ">=0.0.6"
better-ast-comments = "~1.2.1"
[tool.poetry.extras]
cli = ["typer"]
[tool.poetry.group.dev.dependencies]
ruff = "*"
pytest = ">=7.2.1"
pytest-cov = ">=4.0.0"
uvicorn = "*"
devtools = "*"
pdbpp = "^0.10.3"
pytest-pretty = "^1.2.0"
pytest-asyncio = "^0.21.0"
httpx = "*"
pytest-fixture-classes = "^1.0.3"
pre-commit = "^3.4.0"
dirty-equals = "^0.6.0"
mkdocs = "^1.5.2"
mkdocs-material = "^9.3.1"
python-multipart = "^0.0.6"
mkdocs-simple-hooks = "^0.1.5"
[tool.poetry.scripts]
cadwyn = "cadwyn.__main__:app"
[tool.pytest.ini_options]
asyncio_mode = "auto"
[tool.coverage.report]
skip_covered = true
skip_empty = true
# Taken from https://coverage.readthedocs.io/en/7.1.0/excluding.html#advanced-exclusion
exclude_lines = [
"pragma: no cover",
"assert_never\\(",
"if self.debug:",
"if settings.DEBUG",
"raise AssertionError",
"raise NotImplementedError",
"if False:",
"assert_never",
"if 0:",
"class .*\\bProtocol\\):",
"if __name__ == .__main__.:",
"if TYPE_CHECKING:",
"@(abc\\.)?abstractmethod",
"@(typing\\.)?overload",
"__rich_repr__",
"__repr__",
]
omit = ["./docs/plugin.py", "./site/plugin.py", "./tests/_data/_temp/**/*", "tests/tutorial/data/**/*"]
[tool.pyright]
reportMissingImports = true
strictListInference = true
strictDictionaryInference = true
strictSetInference = true
reportPropertyTypeMismatch = true
reportImportCycles = true
reportUntypedFunctionDecorator = "warning"
reportUntypedClassDecorator = "warning"
reportUntypedBaseClass = "warning"
reportDeprecated = "warning"
reportInvalidTypeVarUse = true
reportUnnecessaryCast = true
reportUnnecessaryComparison = true
reportUnnecessaryContains = true
reportAssertAlwaysTrue = true
reportUnsupportedDunderAll = true
reportUnnecessaryTypeIgnoreComment = true
reportMissingSuperCall = true
[tool.ruff]
target-version = "py310"
line-length = 120
select = [
"F", # pyflakes
"E", # pycodestyle errors
"W", # pycodestyle warnings
"C90", # mccabe
"I", # isort
"N", # pep8-naming
"UP", # pyupgrade
"YTT", # flake8-2020
"S", # flake8-bandit
"BLE", # flake8-blind-except
"FBT003", # flake8-boolean-trap
"B", # flake8-bugbear
"COM", # flake8-commas
"C4", # flake8-comprehensions
"T10", # flake8-debugger
"ISC", # flake8-implicit-str-concat
"G010", # Logging statement uses warn instead of warning
"G201", # Logging .exception(...) should be used instead of .error(..., exc_info=True)
"G202", # Logging statement has redundant exc_info
"INP", # flake8-no-pep420
"PIE", # flake8-pie
"T20", # flake8-print
"PYI", # flake8-pyi
"PT", # flake8-pytest-style
"Q", # flake8-quotes
"RSE", # flake8-raise
"RET", # flake8-return
"SIM", # flake8-simplify
"TCH", # flake8-type-checking
"ARG", # flake8-unused-arguments
"PTH", # flake8-use-pathlib
"ERA", # flake8-eradicate
"PGH", # pygrep-hooks
"PLC0414", # Import alias does not rename original package
"PLE", # Error
"PLW", # Warning
"TRY", # tryceratops
"FLY", # flynt
"RUF", # ruff-specific rules
"ANN001", # missing type annotation for arguments
"ANN002", # missing type annotation for *args
"ANN003", # missing type annotation for **kwargs
]
unfixable = [
"ERA001", # eradicate: found commented out code (can be dangerous if fixed automatically)
]
ignore = [
"D203", # 1 blank line required before class docstring
"ARG002", # Unused method argument
"TRY003", # Avoid specifying long messages outside the exception class
"TRY300", # Consider moving statement into the else clause
"ARG001", # Unused first argument
"PT019", # Fixture without value is injected as parameter, use @pytest.mark.usefixtures instead
"SIM108", # Use ternary operator instead of if-else block (ternaries lie to coverage)
"RET505", # Unnecessary `else` after `return` statement
"N805", # First argument of a method should be named `self`
"UP007", # Use `X | Y` for type annotations (we need this for testing and our runtime logic)
# The following rules are recommended to be ignored by ruff when using ruff format
"ISC001", # Checks for implicitly concatenated strings on a single line
"ISC002", # Checks for implicitly concatenated strings that span multiple lines
"W191", # Checks for indentation that uses tabs
"E111", # Checks for indentation with a non-multiple of 4 spaces
"E114", # Checks for indentation of comments with a non-multiple of 4 spaces
"E117", # Checks for over-indented code
"D206", # Checks for docstrings that are indented with tabs
"D300", # Checks for docstrings that use '''single quotes''' instead of """double quotes"""
"Q000", # Checks for inline strings that use single quotes or double quotes
"Q001", # Checks for multiline strings that use single quotes or double quotes
"Q002", # Checks for docstrings that use single quotes or double quotes
"Q003", # Checks for strings that include escaped quotes
"COM812", # Checks for the absence of trailing commas
"COM819", # Checks for the presence of prohibited trailing commas
]
[tool.ruff.format]
quote-style = "double"
indent-style = "space"
[tool.ruff.per-file-ignores]
"tests/*" = [
"S", # ignore bandit security issues in tests
"B018", # ignore useless expressions in tests
"PT012", # ignore complex with pytest.raises clauses
"RUF012", # ignore mutable class attributes ClassVar typehint requirement
"ANN001", # Missing type annotation for function argument
"ANN002", # Missing type annotation for *args
"ANN003", # Missing type annotation for **kwargs
"PGH003", # Use specific rule codes when ignoring type issues
"B008", # Do not perform function call in argument defaults
]
"cadwyn/_utils.py" = [
"ERA001", # Found commented-out code (it's not actually commented out. It's just comments)
]
[tool.ruff.mccabe]
max-complexity = 14
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"