cadwyn 3.15.8__tar.gz → 3.15.9__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.

Files changed (37) hide show
  1. {cadwyn-3.15.8 → cadwyn-3.15.9}/PKG-INFO +2 -2
  2. {cadwyn-3.15.8 → cadwyn-3.15.9}/cadwyn/_asts.py +2 -2
  3. {cadwyn-3.15.8 → cadwyn-3.15.9}/cadwyn/codegen/_plugins/class_rebuilding.py +2 -2
  4. {cadwyn-3.15.8 → cadwyn-3.15.9}/cadwyn/middleware.py +4 -4
  5. {cadwyn-3.15.8 → cadwyn-3.15.9}/cadwyn/route_generation.py +2 -2
  6. {cadwyn-3.15.8 → cadwyn-3.15.9}/cadwyn/structure/versions.py +8 -4
  7. {cadwyn-3.15.8 → cadwyn-3.15.9}/pyproject.toml +2 -2
  8. {cadwyn-3.15.8 → cadwyn-3.15.9}/LICENSE +0 -0
  9. {cadwyn-3.15.8 → cadwyn-3.15.9}/README.md +0 -0
  10. {cadwyn-3.15.8 → cadwyn-3.15.9}/cadwyn/__init__.py +0 -0
  11. {cadwyn-3.15.8 → cadwyn-3.15.9}/cadwyn/__main__.py +0 -0
  12. {cadwyn-3.15.8 → cadwyn-3.15.9}/cadwyn/_compat.py +0 -0
  13. {cadwyn-3.15.8 → cadwyn-3.15.9}/cadwyn/_package_utils.py +0 -0
  14. {cadwyn-3.15.8 → cadwyn-3.15.9}/cadwyn/_utils.py +0 -0
  15. {cadwyn-3.15.8 → cadwyn-3.15.9}/cadwyn/applications.py +0 -0
  16. {cadwyn-3.15.8 → cadwyn-3.15.9}/cadwyn/codegen/README.md +0 -0
  17. {cadwyn-3.15.8 → cadwyn-3.15.9}/cadwyn/codegen/__init__.py +0 -0
  18. {cadwyn-3.15.8 → cadwyn-3.15.9}/cadwyn/codegen/_common.py +0 -0
  19. {cadwyn-3.15.8 → cadwyn-3.15.9}/cadwyn/codegen/_main.py +0 -0
  20. {cadwyn-3.15.8 → cadwyn-3.15.9}/cadwyn/codegen/_plugins/__init__.py +0 -0
  21. {cadwyn-3.15.8 → cadwyn-3.15.9}/cadwyn/codegen/_plugins/class_migrations.py +0 -0
  22. {cadwyn-3.15.8 → cadwyn-3.15.9}/cadwyn/codegen/_plugins/class_renaming.py +0 -0
  23. {cadwyn-3.15.8 → cadwyn-3.15.9}/cadwyn/codegen/_plugins/import_auto_adding.py +0 -0
  24. {cadwyn-3.15.8 → cadwyn-3.15.9}/cadwyn/codegen/_plugins/module_migrations.py +0 -0
  25. {cadwyn-3.15.8 → cadwyn-3.15.9}/cadwyn/exceptions.py +0 -0
  26. {cadwyn-3.15.8 → cadwyn-3.15.9}/cadwyn/main.py +0 -0
  27. {cadwyn-3.15.8 → cadwyn-3.15.9}/cadwyn/py.typed +0 -0
  28. {cadwyn-3.15.8 → cadwyn-3.15.9}/cadwyn/routing.py +0 -0
  29. {cadwyn-3.15.8 → cadwyn-3.15.9}/cadwyn/static/__init__.py +0 -0
  30. {cadwyn-3.15.8 → cadwyn-3.15.9}/cadwyn/static/docs.html +0 -0
  31. {cadwyn-3.15.8 → cadwyn-3.15.9}/cadwyn/structure/__init__.py +0 -0
  32. {cadwyn-3.15.8 → cadwyn-3.15.9}/cadwyn/structure/common.py +0 -0
  33. {cadwyn-3.15.8 → cadwyn-3.15.9}/cadwyn/structure/data.py +0 -0
  34. {cadwyn-3.15.8 → cadwyn-3.15.9}/cadwyn/structure/endpoints.py +0 -0
  35. {cadwyn-3.15.8 → cadwyn-3.15.9}/cadwyn/structure/enums.py +0 -0
  36. {cadwyn-3.15.8 → cadwyn-3.15.9}/cadwyn/structure/modules.py +0 -0
  37. {cadwyn-3.15.8 → cadwyn-3.15.9}/cadwyn/structure/schemas.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cadwyn
3
- Version: 3.15.8
3
+ Version: 3.15.9
4
4
  Summary: Production-ready community-driven modern Stripe-like API versioning in FastAPI
5
5
  Home-page: https://github.com/zmievsa/cadwyn
6
6
  License: MIT
@@ -33,7 +33,7 @@ Classifier: Topic :: Software Development :: Libraries :: Python Modules
33
33
  Classifier: Typing :: Typed
34
34
  Provides-Extra: cli
35
35
  Requires-Dist: better-ast-comments (>=1.2.1,<1.3.0)
36
- Requires-Dist: fastapi (>=0.110.0)
36
+ Requires-Dist: fastapi (>=0.115.2)
37
37
  Requires-Dist: issubclass (>=0.1.2,<0.2.0)
38
38
  Requires-Dist: jinja2 (>=3.1.2)
39
39
  Requires-Dist: pydantic (>=1.0.0)
@@ -101,7 +101,7 @@ def transform_generic_alias(value: GenericAliasUnion) -> Any:
101
101
  return f"{get_fancy_repr(get_origin(value))}[{', '.join(get_fancy_repr(a) for a in get_args(value))}]"
102
102
 
103
103
 
104
- def transform_none(_: NoneType) -> Any:
104
+ def transform_none(_: Any) -> Any:
105
105
  return "None"
106
106
 
107
107
 
@@ -231,7 +231,7 @@ def delete_keyword_from_call(attr_name: str, call: ast.Call):
231
231
  def get_ast_keyword_from_argument_name_and_value(name: str, value: Any):
232
232
  if not isinstance(value, ast.AST):
233
233
  value = ast.parse(get_fancy_repr(value), mode="eval").body
234
- return ast.keyword(arg=name, value=value)
234
+ return ast.keyword(arg=name, value=value) # pyright: ignore[reportArgumentType, reportCallIssue]
235
235
 
236
236
 
237
237
  def pop_docstring_from_cls_body(cls_body: list[ast.stmt]) -> list[ast.stmt]:
@@ -80,9 +80,9 @@ def _modify_schema_cls(
80
80
  cls_node.name = model_info.name
81
81
 
82
82
  field_definitions = [
83
- ast.AnnAssign(
83
+ ast.AnnAssign( # pyright: ignore[reportCallIssue]
84
84
  target=ast.Name(name, ctx=ast.Store()),
85
- annotation=copy.deepcopy(field.annotation_ast),
85
+ annotation=copy.deepcopy(field.annotation_ast), # pyright: ignore[reportArgumentType]
86
86
  # We do this because next plugins **might** use a transformer which will edit the ast within the field
87
87
  # and break rendering
88
88
  value=copy.deepcopy(field.value_ast),
@@ -64,11 +64,11 @@ class HeaderVersioningMiddleware(BaseHTTPMiddleware):
64
64
  request=request,
65
65
  dependant=self.version_header_validation_dependant,
66
66
  async_exit_stack=async_exit_stack,
67
+ embed_body_fields=False,
67
68
  )
68
- values, errors, *_ = solved_result
69
- if errors:
70
- return self.default_response_class(status_code=422, content=_normalize_errors(errors))
71
- api_version = cast(date, values[self.api_version_header_name.replace("-", "_")])
69
+ if solved_result.errors:
70
+ return self.default_response_class(status_code=422, content=_normalize_errors(solved_result.errors))
71
+ api_version = cast(date, solved_result.values[self.api_version_header_name.replace("-", "_")])
72
72
  self.api_version_var.set(api_version)
73
73
 
74
74
  response = await call_next(request)
@@ -445,7 +445,7 @@ def _extract_internal_request_schemas_from_router(
445
445
 
446
446
  def _extract_internal_request_schemas_from_annotations(annotations: dict[str, Any]):
447
447
  for key, annotation in annotations.items():
448
- if isinstance(annotation, type(Annotated[int, int])):
448
+ if isinstance(annotation, type(Annotated[int, int])): # pyright: ignore[reportArgumentType]
449
449
  args = get_args(annotation)
450
450
  if isinstance(args[1], type) and issubclass( # pragma: no branch
451
451
  args[1],
@@ -525,7 +525,7 @@ class _AnnotationTransformer:
525
525
  ):
526
526
  if route.response_model is not None and not ignore_response_model:
527
527
  route.response_model = self._change_version_of_annotations(route.response_model, version_dir)
528
- route.response_field = fastapi.utils.create_response_field(
528
+ route.response_field = fastapi.utils.create_model_field(
529
529
  name="Response_" + route.unique_id,
530
530
  type_=route.response_model,
531
531
  mode="serialization",
@@ -449,6 +449,8 @@ class VersionBundle:
449
449
  current_version: VersionDate,
450
450
  head_route: APIRoute,
451
451
  exit_stack: AsyncExitStack,
452
+ *,
453
+ embed_body_fields: bool,
452
454
  ) -> dict[str, Any]:
453
455
  method = request.method
454
456
  for v in reversed(self.versions):
@@ -465,19 +467,20 @@ class VersionBundle:
465
467
  request.scope["headers"] = tuple((key.encode(), value.encode()) for key, value in request_info.headers.items())
466
468
  del request._headers
467
469
  # Remember this: if len(body_params) == 1, then route.body_schema == route.dependant.body_params[0]
468
- dependencies, errors, _, _, _ = await solve_dependencies(
470
+ result = await solve_dependencies(
469
471
  request=request,
470
472
  response=response,
471
473
  dependant=head_dependant,
472
474
  body=request_info.body,
473
475
  dependency_overrides_provider=head_route.dependency_overrides_provider,
474
476
  async_exit_stack=exit_stack,
477
+ embed_body_fields=embed_body_fields,
475
478
  )
476
- if errors:
479
+ if result.errors:
477
480
  raise CadwynHeadRequestValidationError(
478
- _normalize_errors(errors), body=request_info.body, version=current_version
481
+ _normalize_errors(result.errors), body=request_info.body, version=current_version
479
482
  )
480
- return dependencies
483
+ return result.values
481
484
 
482
485
  def _migrate_response(
483
486
  self,
@@ -755,6 +758,7 @@ class VersionBundle:
755
758
  api_version,
756
759
  head_route,
757
760
  exit_stack=exit_stack,
761
+ embed_body_fields=route._embed_body_fields,
758
762
  )
759
763
  # Because we re-added it into our kwargs when we did solve_dependencies
760
764
  if _CADWYN_REQUEST_PARAM_NAME in new_kwargs:
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "cadwyn"
3
- version = "3.15.8"
3
+ version = "3.15.9"
4
4
  description = "Production-ready community-driven modern Stripe-like API versioning in FastAPI"
5
5
  authors = ["Stanislav Zmiev <zmievsa@gmail.com>"]
6
6
  license = "MIT"
@@ -52,7 +52,7 @@ classifiers = [
52
52
  [tool.poetry.dependencies]
53
53
  python = "^3.10"
54
54
  typing-extensions = "*"
55
- fastapi = ">=0.110.0"
55
+ fastapi = ">=0.115.2"
56
56
  starlette = ">=0.36.3"
57
57
  pydantic = ">=1.0.0"
58
58
  typer = { version = ">=0.7.0", optional = true }
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