cadwyn 3.12.0__tar.gz → 3.12.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of cadwyn might be problematic. Click here for more details.
- {cadwyn-3.12.0 → cadwyn-3.12.1}/PKG-INFO +1 -1
- {cadwyn-3.12.0 → cadwyn-3.12.1}/cadwyn/__main__.py +1 -2
- {cadwyn-3.12.0 → cadwyn-3.12.1}/cadwyn/codegen/_main.py +2 -4
- {cadwyn-3.12.0 → cadwyn-3.12.1}/cadwyn/route_generation.py +2 -4
- {cadwyn-3.12.0 → cadwyn-3.12.1}/cadwyn/routing.py +4 -5
- {cadwyn-3.12.0 → cadwyn-3.12.1}/cadwyn/structure/data.py +4 -8
- {cadwyn-3.12.0 → cadwyn-3.12.1}/cadwyn/structure/versions.py +23 -13
- cadwyn-3.12.1/pyproject.toml +137 -0
- cadwyn-3.12.0/pyproject.toml +0 -247
- {cadwyn-3.12.0 → cadwyn-3.12.1}/LICENSE +0 -0
- {cadwyn-3.12.0 → cadwyn-3.12.1}/README.md +0 -0
- {cadwyn-3.12.0 → cadwyn-3.12.1}/cadwyn/__init__.py +0 -0
- {cadwyn-3.12.0 → cadwyn-3.12.1}/cadwyn/_asts.py +0 -0
- {cadwyn-3.12.0 → cadwyn-3.12.1}/cadwyn/_compat.py +0 -0
- {cadwyn-3.12.0 → cadwyn-3.12.1}/cadwyn/_package_utils.py +0 -0
- {cadwyn-3.12.0 → cadwyn-3.12.1}/cadwyn/_utils.py +0 -0
- {cadwyn-3.12.0 → cadwyn-3.12.1}/cadwyn/applications.py +0 -0
- {cadwyn-3.12.0 → cadwyn-3.12.1}/cadwyn/codegen/README.md +0 -0
- {cadwyn-3.12.0 → cadwyn-3.12.1}/cadwyn/codegen/__init__.py +0 -0
- {cadwyn-3.12.0 → cadwyn-3.12.1}/cadwyn/codegen/_common.py +0 -0
- {cadwyn-3.12.0 → cadwyn-3.12.1}/cadwyn/codegen/_plugins/__init__.py +0 -0
- {cadwyn-3.12.0 → cadwyn-3.12.1}/cadwyn/codegen/_plugins/class_migrations.py +0 -0
- {cadwyn-3.12.0 → cadwyn-3.12.1}/cadwyn/codegen/_plugins/class_rebuilding.py +0 -0
- {cadwyn-3.12.0 → cadwyn-3.12.1}/cadwyn/codegen/_plugins/class_renaming.py +0 -0
- {cadwyn-3.12.0 → cadwyn-3.12.1}/cadwyn/codegen/_plugins/import_auto_adding.py +0 -0
- {cadwyn-3.12.0 → cadwyn-3.12.1}/cadwyn/codegen/_plugins/module_migrations.py +0 -0
- {cadwyn-3.12.0 → cadwyn-3.12.1}/cadwyn/exceptions.py +0 -0
- {cadwyn-3.12.0 → cadwyn-3.12.1}/cadwyn/main.py +0 -0
- {cadwyn-3.12.0 → cadwyn-3.12.1}/cadwyn/middleware.py +0 -0
- {cadwyn-3.12.0 → cadwyn-3.12.1}/cadwyn/py.typed +0 -0
- {cadwyn-3.12.0 → cadwyn-3.12.1}/cadwyn/static/__init__.py +0 -0
- {cadwyn-3.12.0 → cadwyn-3.12.1}/cadwyn/static/docs.html +0 -0
- {cadwyn-3.12.0 → cadwyn-3.12.1}/cadwyn/structure/__init__.py +0 -0
- {cadwyn-3.12.0 → cadwyn-3.12.1}/cadwyn/structure/common.py +0 -0
- {cadwyn-3.12.0 → cadwyn-3.12.1}/cadwyn/structure/endpoints.py +0 -0
- {cadwyn-3.12.0 → cadwyn-3.12.1}/cadwyn/structure/enums.py +0 -0
- {cadwyn-3.12.0 → cadwyn-3.12.1}/cadwyn/structure/modules.py +0 -0
- {cadwyn-3.12.0 → cadwyn-3.12.1}/cadwyn/structure/schemas.py +0 -0
|
@@ -115,8 +115,7 @@ def _get_version_bundle(possibly_version_bundle: Any) -> VersionBundle:
|
|
|
115
115
|
@app.callback()
|
|
116
116
|
def main(
|
|
117
117
|
version: bool = typer.Option(None, "-V", "--version", callback=version_callback, is_eager=True),
|
|
118
|
-
):
|
|
119
|
-
...
|
|
118
|
+
): ...
|
|
120
119
|
|
|
121
120
|
|
|
122
121
|
if __name__ == "__main__":
|
|
@@ -53,8 +53,7 @@ def generate_code_for_versioned_packages(
|
|
|
53
53
|
codegen_plugins: Sequence[CodegenPlugin] = DEFAULT_CODEGEN_PLUGINS,
|
|
54
54
|
migration_plugins: Sequence[MigrationPlugin] = DEFAULT_CODEGEN_MIGRATION_PLUGINS,
|
|
55
55
|
extra_context: dict[str, Any] | None = None,
|
|
56
|
-
):
|
|
57
|
-
...
|
|
56
|
+
): ...
|
|
58
57
|
|
|
59
58
|
|
|
60
59
|
@overload
|
|
@@ -70,8 +69,7 @@ def generate_code_for_versioned_packages(
|
|
|
70
69
|
codegen_plugins: Sequence[CodegenPlugin] = DEFAULT_CODEGEN_PLUGINS,
|
|
71
70
|
migration_plugins: Sequence[MigrationPlugin] = DEFAULT_CODEGEN_MIGRATION_PLUGINS,
|
|
72
71
|
extra_context: dict[str, Any] | None = None,
|
|
73
|
-
):
|
|
74
|
-
...
|
|
72
|
+
): ...
|
|
75
73
|
|
|
76
74
|
|
|
77
75
|
def generate_code_for_versioned_packages(
|
|
@@ -95,8 +95,7 @@ class InternalRepresentationOf:
|
|
|
95
95
|
def generate_versioned_routers(
|
|
96
96
|
router: _R,
|
|
97
97
|
versions: VersionBundle,
|
|
98
|
-
) -> dict[VersionDate, _R]:
|
|
99
|
-
...
|
|
98
|
+
) -> dict[VersionDate, _R]: ...
|
|
100
99
|
|
|
101
100
|
|
|
102
101
|
@overload
|
|
@@ -105,8 +104,7 @@ def generate_versioned_routers(
|
|
|
105
104
|
router: _R,
|
|
106
105
|
versions: VersionBundle,
|
|
107
106
|
latest_schemas_package: ModuleType | None,
|
|
108
|
-
) -> dict[VersionDate, _R]:
|
|
109
|
-
...
|
|
107
|
+
) -> dict[VersionDate, _R]: ...
|
|
110
108
|
|
|
111
109
|
|
|
112
110
|
def generate_versioned_routers(
|
|
@@ -67,15 +67,14 @@ class _RootHeaderAPIRouter(APIRouter):
|
|
|
67
67
|
if self.min_routes_version > request_header_value:
|
|
68
68
|
# then the request version is older that the oldest route we have
|
|
69
69
|
_logger.info(
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
f"version {self.min_routes_version.isoformat()} ",
|
|
70
|
+
"Request version is older than the oldest version. No route can match this version",
|
|
71
|
+
extra={"oldest_version": self.min_routes_version.isoformat(), "request_version": request_version},
|
|
73
72
|
)
|
|
74
73
|
return []
|
|
75
74
|
version_chosen = self.find_closest_date_but_not_new(request_header_value)
|
|
76
75
|
_logger.info(
|
|
77
|
-
|
|
78
|
-
|
|
76
|
+
"Partial match. The endpoint with a lower version was selected for the API call",
|
|
77
|
+
extra={"version_chosen": version_chosen, "request_version": request_version},
|
|
79
78
|
)
|
|
80
79
|
return self.versioned_routers[version_chosen].routes
|
|
81
80
|
|
|
@@ -109,13 +109,11 @@ class AlterRequestByPathInstruction(_BaseAlterRequestInstruction):
|
|
|
109
109
|
@overload
|
|
110
110
|
def convert_request_to_next_version_for(
|
|
111
111
|
first_schema: type, /, *additional_schemas: type
|
|
112
|
-
) -> "type[staticmethod[_P, None]]":
|
|
113
|
-
...
|
|
112
|
+
) -> "type[staticmethod[_P, None]]": ...
|
|
114
113
|
|
|
115
114
|
|
|
116
115
|
@overload
|
|
117
|
-
def convert_request_to_next_version_for(path: str, methods: list[str], /) -> "type[staticmethod[_P, None]]":
|
|
118
|
-
...
|
|
116
|
+
def convert_request_to_next_version_for(path: str, methods: list[str], /) -> "type[staticmethod[_P, None]]": ...
|
|
119
117
|
|
|
120
118
|
|
|
121
119
|
def convert_request_to_next_version_for(
|
|
@@ -174,8 +172,7 @@ def convert_response_to_previous_version_for(
|
|
|
174
172
|
/,
|
|
175
173
|
*schemas: type,
|
|
176
174
|
migrate_http_errors: bool = False,
|
|
177
|
-
) -> "type[staticmethod[_P, None]]":
|
|
178
|
-
...
|
|
175
|
+
) -> "type[staticmethod[_P, None]]": ...
|
|
179
176
|
|
|
180
177
|
|
|
181
178
|
@overload
|
|
@@ -185,8 +182,7 @@ def convert_response_to_previous_version_for(
|
|
|
185
182
|
/,
|
|
186
183
|
*,
|
|
187
184
|
migrate_http_errors: bool = False,
|
|
188
|
-
) -> "type[staticmethod[_P, None]]":
|
|
189
|
-
...
|
|
185
|
+
) -> "type[staticmethod[_P, None]]": ...
|
|
190
186
|
|
|
191
187
|
|
|
192
188
|
def convert_response_to_previous_version_for(
|
|
@@ -20,7 +20,7 @@ from fastapi.concurrency import run_in_threadpool
|
|
|
20
20
|
from fastapi.dependencies.models import Dependant
|
|
21
21
|
from fastapi.dependencies.utils import solve_dependencies
|
|
22
22
|
from fastapi.exceptions import RequestValidationError
|
|
23
|
-
from fastapi.responses import FileResponse, StreamingResponse
|
|
23
|
+
from fastapi.responses import FileResponse, JSONResponse, StreamingResponse
|
|
24
24
|
from fastapi.routing import APIRoute, _prepare_response_content
|
|
25
25
|
from pydantic import BaseModel
|
|
26
26
|
from starlette._utils import is_async_callable
|
|
@@ -74,9 +74,9 @@ class VersionChange:
|
|
|
74
74
|
alter_enum_instructions: ClassVar[list[AlterEnumSubInstruction]] = Sentinel
|
|
75
75
|
alter_module_instructions: ClassVar[list[AlterModuleInstruction]] = Sentinel
|
|
76
76
|
alter_endpoint_instructions: ClassVar[list[AlterEndpointSubInstruction]] = Sentinel
|
|
77
|
-
alter_request_by_schema_instructions: ClassVar[
|
|
78
|
-
|
|
79
|
-
|
|
77
|
+
alter_request_by_schema_instructions: ClassVar[dict[type[BaseModel], list[AlterRequestBySchemaInstruction]]] = (
|
|
78
|
+
Sentinel
|
|
79
|
+
)
|
|
80
80
|
alter_request_by_path_instructions: ClassVar[dict[str, list[AlterRequestByPathInstruction]]] = Sentinel
|
|
81
81
|
alter_response_by_schema_instructions: ClassVar[dict[type, list[AlterResponseBySchemaInstruction]]] = Sentinel
|
|
82
82
|
alter_response_by_path_instructions: ClassVar[dict[str, list[AlterResponseByPathInstruction]]] = Sentinel
|
|
@@ -245,8 +245,7 @@ class VersionBundle:
|
|
|
245
245
|
*other_versions: Version,
|
|
246
246
|
api_version_var: APIVersionVarType | None = None,
|
|
247
247
|
head_schemas_package: ModuleType | None = None,
|
|
248
|
-
) -> None:
|
|
249
|
-
...
|
|
248
|
+
) -> None: ...
|
|
250
249
|
|
|
251
250
|
@overload
|
|
252
251
|
@deprecated("Pass head_version_package instead of latest_schemas_package.")
|
|
@@ -257,8 +256,7 @@ class VersionBundle:
|
|
|
257
256
|
*other_versions: Version,
|
|
258
257
|
api_version_var: APIVersionVarType | None = None,
|
|
259
258
|
latest_schemas_package: ModuleType | None = None,
|
|
260
|
-
) -> None:
|
|
261
|
-
...
|
|
259
|
+
) -> None: ...
|
|
262
260
|
|
|
263
261
|
def __init__(
|
|
264
262
|
self,
|
|
@@ -620,7 +618,10 @@ class VersionBundle:
|
|
|
620
618
|
if isinstance(response_or_response_body, StreamingResponse | FileResponse):
|
|
621
619
|
body = None
|
|
622
620
|
elif response_or_response_body.body:
|
|
623
|
-
|
|
621
|
+
if isinstance(response_or_response_body, JSONResponse) or raised_exception is not None:
|
|
622
|
+
body = json.loads(response_or_response_body.body)
|
|
623
|
+
else:
|
|
624
|
+
body = response_or_response_body.body.decode(response_or_response_body.charset)
|
|
624
625
|
else:
|
|
625
626
|
body = None
|
|
626
627
|
# TODO (https://github.com/zmievsa/cadwyn/issues/51): Only do this if there are migrations
|
|
@@ -666,16 +667,25 @@ class VersionBundle:
|
|
|
666
667
|
# that do not have it. We don't support it too.
|
|
667
668
|
if response_info.body is not None and hasattr(response_info._response, "body"):
|
|
668
669
|
# TODO (https://github.com/zmievsa/cadwyn/issues/51): Only do this if there are migrations
|
|
669
|
-
|
|
670
|
+
if isinstance(response_info.body, str):
|
|
671
|
+
response_info._response.body = response_info.body.encode(response_info._response.charset)
|
|
672
|
+
else:
|
|
673
|
+
response_info._response.body = json.dumps(
|
|
674
|
+
response_info.body,
|
|
675
|
+
ensure_ascii=False,
|
|
676
|
+
allow_nan=False,
|
|
677
|
+
indent=None,
|
|
678
|
+
separators=(",", ":"),
|
|
679
|
+
).encode("utf-8")
|
|
680
|
+
# It makes sense to re-calculate content length because the previously calculated one
|
|
681
|
+
# might slightly differ. If it differs -- uvicorn will break.
|
|
682
|
+
response_info.headers["content-length"] = str(len(response_info._response.body))
|
|
670
683
|
|
|
671
684
|
if raised_exception is not None and response_info.status_code >= 400:
|
|
672
685
|
if isinstance(response_info.body, dict) and "detail" in response_info.body:
|
|
673
686
|
detail = response_info.body["detail"]
|
|
674
687
|
else:
|
|
675
688
|
detail = response_info.body
|
|
676
|
-
# It makes more sense to re-calculate content length because the previously calculated one
|
|
677
|
-
# might slightly differ.
|
|
678
|
-
del response_info.headers["content-length"]
|
|
679
689
|
|
|
680
690
|
raise HTTPException(
|
|
681
691
|
status_code=response_info.status_code,
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
[tool.poetry]
|
|
2
|
+
name = "cadwyn"
|
|
3
|
+
version = "3.12.1"
|
|
4
|
+
description = "Production-ready community-driven modern Stripe-like API versioning in FastAPI"
|
|
5
|
+
authors = ["Stanislav Zmiev <zmievsa@gmail.com>"]
|
|
6
|
+
license = "MIT"
|
|
7
|
+
readme = "README.md"
|
|
8
|
+
repository = "https://github.com/zmievsa/cadwyn"
|
|
9
|
+
documentation = "https://docs.cadwyn.dev"
|
|
10
|
+
keywords = [
|
|
11
|
+
"python",
|
|
12
|
+
"api",
|
|
13
|
+
"json-schema",
|
|
14
|
+
"stripe",
|
|
15
|
+
"versioning",
|
|
16
|
+
"code-generation",
|
|
17
|
+
"hints",
|
|
18
|
+
"api-versioning",
|
|
19
|
+
"pydantic",
|
|
20
|
+
"fastapi",
|
|
21
|
+
"python310",
|
|
22
|
+
"python311",
|
|
23
|
+
"python312",
|
|
24
|
+
]
|
|
25
|
+
classifiers = [
|
|
26
|
+
"Intended Audience :: Information Technology",
|
|
27
|
+
"Intended Audience :: System Administrators",
|
|
28
|
+
"Operating System :: OS Independent",
|
|
29
|
+
"Programming Language :: Python",
|
|
30
|
+
"Programming Language :: Python :: 3",
|
|
31
|
+
"Programming Language :: Python :: 3.10",
|
|
32
|
+
"Programming Language :: Python :: 3.11",
|
|
33
|
+
"Programming Language :: Python :: 3.12",
|
|
34
|
+
"Topic :: Internet",
|
|
35
|
+
"Topic :: Software Development :: Libraries :: Application Frameworks",
|
|
36
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
37
|
+
"Topic :: Software Development :: Libraries",
|
|
38
|
+
"Topic :: Software Development",
|
|
39
|
+
"Typing :: Typed",
|
|
40
|
+
"Development Status :: 5 - Production/Stable",
|
|
41
|
+
"Environment :: Web Environment",
|
|
42
|
+
"Framework :: AsyncIO",
|
|
43
|
+
"Framework :: FastAPI",
|
|
44
|
+
"Framework :: Pydantic",
|
|
45
|
+
"Intended Audience :: Developers",
|
|
46
|
+
"License :: OSI Approved :: MIT License",
|
|
47
|
+
"Topic :: Internet :: WWW/HTTP :: HTTP Servers",
|
|
48
|
+
"Topic :: Internet :: WWW/HTTP",
|
|
49
|
+
]
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
[tool.poetry.dependencies]
|
|
53
|
+
python = "^3.10"
|
|
54
|
+
typing-extensions = "*"
|
|
55
|
+
fastapi = ">=0.110.0"
|
|
56
|
+
starlette = ">=0.36.3"
|
|
57
|
+
pydantic = ">=1.0.0"
|
|
58
|
+
typer = {version = ">=0.7.0", optional = true}
|
|
59
|
+
better-ast-comments = "~1.2.1"
|
|
60
|
+
jinja2 = ">=3.1.2"
|
|
61
|
+
|
|
62
|
+
[tool.poetry.extras]
|
|
63
|
+
cli = ["typer"]
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
[tool.poetry.group.dev.dependencies]
|
|
67
|
+
pytest = ">=7.2.1"
|
|
68
|
+
pytest-cov = ">=4.0.0"
|
|
69
|
+
uvicorn = "*"
|
|
70
|
+
devtools = "*"
|
|
71
|
+
pdbpp = "^0.10.3"
|
|
72
|
+
httpx = "*"
|
|
73
|
+
pytest-fixture-classes = ">=1.0.3"
|
|
74
|
+
dirty-equals = ">=0.6.0"
|
|
75
|
+
mkdocs = ">=1.5.2"
|
|
76
|
+
mkdocs-material = ">=9.3.1"
|
|
77
|
+
python-multipart = ">=0.0.6"
|
|
78
|
+
mkdocs-simple-hooks = ">=0.1.5"
|
|
79
|
+
pytest-sugar = "^1.0.0"
|
|
80
|
+
|
|
81
|
+
[tool.poetry.scripts]
|
|
82
|
+
cadwyn = "cadwyn.__main__:app"
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
[tool.pytest.ini_options]
|
|
86
|
+
asyncio_mode = "auto"
|
|
87
|
+
|
|
88
|
+
[tool.coverage.report]
|
|
89
|
+
skip_covered = true
|
|
90
|
+
skip_empty = true
|
|
91
|
+
# Taken from https://coverage.readthedocs.io/en/7.1.0/excluding.html#advanced-exclusion
|
|
92
|
+
exclude_lines = [
|
|
93
|
+
"pragma: no cover",
|
|
94
|
+
"assert_never\\(",
|
|
95
|
+
"if self.debug:",
|
|
96
|
+
"if settings.DEBUG",
|
|
97
|
+
"raise AssertionError",
|
|
98
|
+
"raise NotImplementedError",
|
|
99
|
+
"if False:",
|
|
100
|
+
"assert_never",
|
|
101
|
+
"if 0:",
|
|
102
|
+
"class .*\\bProtocol\\):",
|
|
103
|
+
"if __name__ == .__main__.:",
|
|
104
|
+
"if TYPE_CHECKING:",
|
|
105
|
+
"@(abc\\.)?abstractmethod",
|
|
106
|
+
"@(typing\\.)?overload",
|
|
107
|
+
"__rich_repr__",
|
|
108
|
+
"__repr__",
|
|
109
|
+
]
|
|
110
|
+
omit = ["./docs/plugin.py", "./site/plugin.py", "./tests/_data/_temp/**/*", "tests/tutorial/data/**/*", "scripts/*.py"]
|
|
111
|
+
|
|
112
|
+
[tool.pyright]
|
|
113
|
+
reportMissingImports = true
|
|
114
|
+
strictListInference = true
|
|
115
|
+
strictDictionaryInference = true
|
|
116
|
+
strictSetInference = true
|
|
117
|
+
reportPropertyTypeMismatch = true
|
|
118
|
+
reportImportCycles = true
|
|
119
|
+
reportUntypedFunctionDecorator = "warning"
|
|
120
|
+
reportUntypedClassDecorator = "warning"
|
|
121
|
+
reportUntypedBaseClass = "warning"
|
|
122
|
+
reportDeprecated = "warning"
|
|
123
|
+
reportInvalidTypeVarUse = true
|
|
124
|
+
reportUnnecessaryCast = true
|
|
125
|
+
reportUnnecessaryComparison = true
|
|
126
|
+
reportUnnecessaryContains = true
|
|
127
|
+
reportAssertAlwaysTrue = true
|
|
128
|
+
reportUnsupportedDunderAll = true
|
|
129
|
+
reportUnnecessaryTypeIgnoreComment = true
|
|
130
|
+
reportMissingSuperCall = true
|
|
131
|
+
reportFunctionMemberAccess = false
|
|
132
|
+
reportCircularImports = true
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
[build-system]
|
|
136
|
+
requires = ["poetry-core>=1.0.0"]
|
|
137
|
+
build-backend = "poetry.core.masonry.api"
|
cadwyn-3.12.0/pyproject.toml
DELETED
|
@@ -1,247 +0,0 @@
|
|
|
1
|
-
[tool.poetry]
|
|
2
|
-
name = "cadwyn"
|
|
3
|
-
version = "3.12.0"
|
|
4
|
-
description = "Production-ready community-driven modern Stripe-like API versioning in FastAPI"
|
|
5
|
-
authors = ["Stanislav Zmiev <zmievsa@gmail.com>"]
|
|
6
|
-
license = "MIT"
|
|
7
|
-
readme = "README.md"
|
|
8
|
-
repository = "https://github.com/zmievsa/cadwyn"
|
|
9
|
-
documentation = "https://docs.cadwyn.dev"
|
|
10
|
-
keywords = [
|
|
11
|
-
"python",
|
|
12
|
-
"api",
|
|
13
|
-
"json-schema",
|
|
14
|
-
"stripe",
|
|
15
|
-
"versioning",
|
|
16
|
-
"code-generation",
|
|
17
|
-
"hints",
|
|
18
|
-
"api-versioning",
|
|
19
|
-
"pydantic",
|
|
20
|
-
"fastapi",
|
|
21
|
-
"python310",
|
|
22
|
-
"python311",
|
|
23
|
-
"python312",
|
|
24
|
-
]
|
|
25
|
-
classifiers = [
|
|
26
|
-
"Intended Audience :: Information Technology",
|
|
27
|
-
"Intended Audience :: System Administrators",
|
|
28
|
-
"Operating System :: OS Independent",
|
|
29
|
-
"Programming Language :: Python",
|
|
30
|
-
"Programming Language :: Python :: 3",
|
|
31
|
-
"Programming Language :: Python :: 3.10",
|
|
32
|
-
"Programming Language :: Python :: 3.11",
|
|
33
|
-
"Programming Language :: Python :: 3.12",
|
|
34
|
-
"Topic :: Internet",
|
|
35
|
-
"Topic :: Software Development :: Libraries :: Application Frameworks",
|
|
36
|
-
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
37
|
-
"Topic :: Software Development :: Libraries",
|
|
38
|
-
"Topic :: Software Development",
|
|
39
|
-
"Typing :: Typed",
|
|
40
|
-
"Development Status :: 5 - Production/Stable",
|
|
41
|
-
"Environment :: Web Environment",
|
|
42
|
-
"Framework :: AsyncIO",
|
|
43
|
-
"Framework :: FastAPI",
|
|
44
|
-
"Framework :: Pydantic",
|
|
45
|
-
"Intended Audience :: Developers",
|
|
46
|
-
"License :: OSI Approved :: MIT License",
|
|
47
|
-
"Topic :: Internet :: WWW/HTTP :: HTTP Servers",
|
|
48
|
-
"Topic :: Internet :: WWW/HTTP",
|
|
49
|
-
]
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
[tool.poetry.dependencies]
|
|
53
|
-
python = "^3.10"
|
|
54
|
-
typing-extensions = "*"
|
|
55
|
-
fastapi = ">=0.110.0"
|
|
56
|
-
starlette = ">=0.36.3"
|
|
57
|
-
pydantic = ">=1.0.0"
|
|
58
|
-
typer = {version = ">=0.7.0", optional = true}
|
|
59
|
-
better-ast-comments = "~1.2.1"
|
|
60
|
-
jinja2 = ">=3.1.2"
|
|
61
|
-
|
|
62
|
-
[tool.poetry.extras]
|
|
63
|
-
cli = ["typer"]
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
[tool.poetry.group.dev.dependencies]
|
|
67
|
-
ruff = "*"
|
|
68
|
-
pytest = ">=7.2.1"
|
|
69
|
-
pytest-cov = ">=4.0.0"
|
|
70
|
-
uvicorn = "*"
|
|
71
|
-
devtools = "*"
|
|
72
|
-
pdbpp = "^0.10.3"
|
|
73
|
-
httpx = "*"
|
|
74
|
-
pytest-fixture-classes = ">=1.0.3"
|
|
75
|
-
pre-commit = ">=3.4.0"
|
|
76
|
-
dirty-equals = ">=0.6.0"
|
|
77
|
-
mkdocs = ">=1.5.2"
|
|
78
|
-
mkdocs-material = ">=9.3.1"
|
|
79
|
-
python-multipart = ">=0.0.6"
|
|
80
|
-
mkdocs-simple-hooks = ">=0.1.5"
|
|
81
|
-
pytest-sugar = "^1.0.0"
|
|
82
|
-
|
|
83
|
-
[tool.poetry.scripts]
|
|
84
|
-
cadwyn = "cadwyn.__main__:app"
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
[tool.pytest.ini_options]
|
|
88
|
-
asyncio_mode = "auto"
|
|
89
|
-
|
|
90
|
-
[tool.coverage.report]
|
|
91
|
-
skip_covered = true
|
|
92
|
-
skip_empty = true
|
|
93
|
-
# Taken from https://coverage.readthedocs.io/en/7.1.0/excluding.html#advanced-exclusion
|
|
94
|
-
exclude_lines = [
|
|
95
|
-
"pragma: no cover",
|
|
96
|
-
"assert_never\\(",
|
|
97
|
-
"if self.debug:",
|
|
98
|
-
"if settings.DEBUG",
|
|
99
|
-
"raise AssertionError",
|
|
100
|
-
"raise NotImplementedError",
|
|
101
|
-
"if False:",
|
|
102
|
-
"assert_never",
|
|
103
|
-
"if 0:",
|
|
104
|
-
"class .*\\bProtocol\\):",
|
|
105
|
-
"if __name__ == .__main__.:",
|
|
106
|
-
"if TYPE_CHECKING:",
|
|
107
|
-
"@(abc\\.)?abstractmethod",
|
|
108
|
-
"@(typing\\.)?overload",
|
|
109
|
-
"__rich_repr__",
|
|
110
|
-
"__repr__",
|
|
111
|
-
]
|
|
112
|
-
omit = ["./docs/plugin.py", "./site/plugin.py", "./tests/_data/_temp/**/*", "tests/tutorial/data/**/*", "scripts/*.py"]
|
|
113
|
-
|
|
114
|
-
[tool.pyright]
|
|
115
|
-
reportMissingImports = true
|
|
116
|
-
strictListInference = true
|
|
117
|
-
strictDictionaryInference = true
|
|
118
|
-
strictSetInference = true
|
|
119
|
-
reportPropertyTypeMismatch = true
|
|
120
|
-
reportImportCycles = true
|
|
121
|
-
reportUntypedFunctionDecorator = "warning"
|
|
122
|
-
reportUntypedClassDecorator = "warning"
|
|
123
|
-
reportUntypedBaseClass = "warning"
|
|
124
|
-
reportDeprecated = "warning"
|
|
125
|
-
reportInvalidTypeVarUse = true
|
|
126
|
-
reportUnnecessaryCast = true
|
|
127
|
-
reportUnnecessaryComparison = true
|
|
128
|
-
reportUnnecessaryContains = true
|
|
129
|
-
reportAssertAlwaysTrue = true
|
|
130
|
-
reportUnsupportedDunderAll = true
|
|
131
|
-
reportUnnecessaryTypeIgnoreComment = true
|
|
132
|
-
reportMissingSuperCall = true
|
|
133
|
-
reportFunctionMemberAccess = false
|
|
134
|
-
reportCircularImports = true
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
[tool.ruff]
|
|
138
|
-
target-version = "py310"
|
|
139
|
-
line-length = 120
|
|
140
|
-
extend-exclude = ["scripts/*.py"]
|
|
141
|
-
|
|
142
|
-
[tool.ruff.lint]
|
|
143
|
-
select = [
|
|
144
|
-
"F", # pyflakes
|
|
145
|
-
"E", # pycodestyle errors
|
|
146
|
-
"W", # pycodestyle warnings
|
|
147
|
-
"C90", # mccabe
|
|
148
|
-
"I", # isort
|
|
149
|
-
"N", # pep8-naming
|
|
150
|
-
"UP", # pyupgrade
|
|
151
|
-
"YTT", # flake8-2020
|
|
152
|
-
"S", # flake8-bandit
|
|
153
|
-
"BLE", # flake8-blind-except
|
|
154
|
-
"FBT003", # flake8-boolean-trap
|
|
155
|
-
"B", # flake8-bugbear
|
|
156
|
-
"COM", # flake8-commas
|
|
157
|
-
"C4", # flake8-comprehensions
|
|
158
|
-
"T10", # flake8-debugger
|
|
159
|
-
"ISC", # flake8-implicit-str-concat
|
|
160
|
-
"G010", # Logging statement uses warn instead of warning
|
|
161
|
-
"G201", # Logging .exception(...) should be used instead of .error(..., exc_info=True)
|
|
162
|
-
"G202", # Logging statement has redundant exc_info
|
|
163
|
-
"INP", # flake8-no-pep420
|
|
164
|
-
"PIE", # flake8-pie
|
|
165
|
-
"T20", # flake8-print
|
|
166
|
-
"PYI", # flake8-pyi
|
|
167
|
-
"PT", # flake8-pytest-style
|
|
168
|
-
"Q", # flake8-quotes
|
|
169
|
-
"RSE", # flake8-raise
|
|
170
|
-
"RET", # flake8-return
|
|
171
|
-
"SIM", # flake8-simplify
|
|
172
|
-
"TCH", # flake8-type-checking
|
|
173
|
-
"ARG", # flake8-unused-arguments
|
|
174
|
-
"PTH", # flake8-use-pathlib
|
|
175
|
-
"ERA", # flake8-eradicate
|
|
176
|
-
"PGH", # pygrep-hooks
|
|
177
|
-
"PLC0414", # Import alias does not rename original package
|
|
178
|
-
"PLE", # Error
|
|
179
|
-
"PLW", # Warning
|
|
180
|
-
"TRY", # tryceratops
|
|
181
|
-
"FLY", # flynt
|
|
182
|
-
"RUF", # ruff-specific rules
|
|
183
|
-
"ANN001", # missing type annotation for arguments
|
|
184
|
-
"ANN002", # missing type annotation for *args
|
|
185
|
-
"ANN003", # missing type annotation for **kwargs
|
|
186
|
-
]
|
|
187
|
-
unfixable = [
|
|
188
|
-
"ERA001", # eradicate: found commented out code (can be dangerous if fixed automatically)
|
|
189
|
-
]
|
|
190
|
-
ignore = [
|
|
191
|
-
"D203", # 1 blank line required before class docstring
|
|
192
|
-
"ARG001", # Unused first argument
|
|
193
|
-
"ARG002", # Unused method argument
|
|
194
|
-
"TRY003", # Avoid specifying long messages outside the exception class
|
|
195
|
-
"TRY300", # Consider moving statement into the else clause
|
|
196
|
-
"PT019", # Fixture without value is injected as parameter, use @pytest.mark.usefixtures instead
|
|
197
|
-
# (usefixtures doesn't play well with IDE features such as auto-renaming)
|
|
198
|
-
"SIM108", # Use ternary operator instead of if-else block (ternaries lie to coverage)
|
|
199
|
-
"RET505", # Unnecessary `else` after `return` statement
|
|
200
|
-
"N805", # First argument of a method should be named `self` (pydantic validators don't play well with this)
|
|
201
|
-
"UP007", # Use `X | Y` for type annotations (we need this for testing and our runtime logic)
|
|
202
|
-
|
|
203
|
-
# The following rules are recommended to be ignored by ruff when using ruff format
|
|
204
|
-
"ISC001", # Checks for implicitly concatenated strings on a single line
|
|
205
|
-
"ISC002", # Checks for implicitly concatenated strings that span multiple lines
|
|
206
|
-
"W191", # Checks for indentation that uses tabs
|
|
207
|
-
"E111", # Checks for indentation with a non-multiple of 4 spaces
|
|
208
|
-
"E114", # Checks for indentation of comments with a non-multiple of 4 spaces
|
|
209
|
-
"E117", # Checks for over-indented code
|
|
210
|
-
"D206", # Checks for docstrings that are indented with tabs
|
|
211
|
-
"D300", # Checks for docstrings that use '''single quotes''' instead of """double quotes"""
|
|
212
|
-
"Q000", # Checks for inline strings that use single quotes or double quotes
|
|
213
|
-
"Q001", # Checks for multiline strings that use single quotes or double quotes
|
|
214
|
-
"Q002", # Checks for docstrings that use single quotes or double quotes
|
|
215
|
-
"Q003", # Checks for strings that include escaped quotes
|
|
216
|
-
"COM812", # Checks for the absence of trailing commas
|
|
217
|
-
"COM819", # Checks for the presence of prohibited trailing commas
|
|
218
|
-
"RET506", # Unnecessary `elif` after `raise` statement
|
|
219
|
-
]
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
[tool.ruff.lint.per-file-ignores]
|
|
223
|
-
"tests/*" = [
|
|
224
|
-
"S", # ignore bandit security issues in tests
|
|
225
|
-
"B018", # ignore useless expressions in tests
|
|
226
|
-
"PT012", # ignore complex with pytest.raises clauses
|
|
227
|
-
"RUF012", # ignore mutable class attributes ClassVar typehint requirement
|
|
228
|
-
"ANN001", # Missing type annotation for function argument
|
|
229
|
-
"ANN002", # Missing type annotation for *args
|
|
230
|
-
"ANN003", # Missing type annotation for **kwargs
|
|
231
|
-
"PGH003", # Use specific rule codes when ignoring type issues
|
|
232
|
-
"B008", # Do not perform function call in argument defaults
|
|
233
|
-
]
|
|
234
|
-
"cadwyn/_utils.py" = [
|
|
235
|
-
"ERA001", # Found commented-out code (it's not actually commented out. It's just comments)
|
|
236
|
-
]
|
|
237
|
-
|
|
238
|
-
[tool.ruff.lint.mccabe]
|
|
239
|
-
max-complexity = 14
|
|
240
|
-
|
|
241
|
-
[tool.ruff.format]
|
|
242
|
-
quote-style = "double"
|
|
243
|
-
indent-style = "space"
|
|
244
|
-
|
|
245
|
-
[build-system]
|
|
246
|
-
requires = ["poetry-core>=1.0.0"]
|
|
247
|
-
build-backend = "poetry.core.masonry.api"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|