cadwyn 4.2.3__py3-none-any.whl → 4.2.4__py3-none-any.whl

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.

@@ -376,6 +376,7 @@ def _add_data_migrations_to_route(
376
376
  head_route,
377
377
  dependant_for_request_migrations,
378
378
  request_param_name=route.dependant.request_param_name,
379
+ background_tasks_param_name=route.dependant.background_tasks_param_name,
379
380
  response_param_name=route.dependant.response_param_name,
380
381
  )(route.endpoint)
381
382
  route.dependant.call = route.endpoint
@@ -10,7 +10,7 @@ from datetime import date
10
10
  from enum import Enum
11
11
  from typing import Any, ClassVar, ParamSpec, TypeAlias, TypeVar
12
12
 
13
- from fastapi import HTTPException, params
13
+ from fastapi import BackgroundTasks, HTTPException, params
14
14
  from fastapi import Request as FastapiRequest
15
15
  from fastapi import Response as FastapiResponse
16
16
  from fastapi._compat import ModelField, _normalize_errors
@@ -352,7 +352,8 @@ class VersionBundle:
352
352
  head_route: APIRoute,
353
353
  *,
354
354
  exit_stack: AsyncExitStack,
355
- embed_body_fields: bool = False,
355
+ embed_body_fields: bool,
356
+ background_tasks: BackgroundTasks | None,
356
357
  ) -> dict[str, Any]:
357
358
  method = request.method
358
359
  for v in reversed(self.versions):
@@ -377,6 +378,7 @@ class VersionBundle:
377
378
  dependency_overrides_provider=head_route.dependency_overrides_provider,
378
379
  async_exit_stack=exit_stack,
379
380
  embed_body_fields=embed_body_fields,
381
+ background_tasks=background_tasks,
380
382
  )
381
383
  if result.errors:
382
384
  raise CadwynHeadRequestValidationError(
@@ -434,6 +436,7 @@ class VersionBundle:
434
436
  dependant_for_request_migrations: Dependant,
435
437
  *,
436
438
  request_param_name: str,
439
+ background_tasks_param_name: str | None,
437
440
  response_param_name: str,
438
441
  ) -> Callable[[Endpoint[_P, _R]], Endpoint[_P, _R]]:
439
442
  def wrapper(endpoint: Endpoint[_P, _R]) -> Endpoint[_P, _R]:
@@ -441,6 +444,10 @@ class VersionBundle:
441
444
  async def decorator(*args: Any, **kwargs: Any) -> _R:
442
445
  request_param: FastapiRequest = kwargs[request_param_name]
443
446
  response_param: FastapiResponse = kwargs[response_param_name]
447
+ background_tasks: BackgroundTasks | None = kwargs.get(
448
+ background_tasks_param_name, # pyright: ignore[reportArgumentType, reportCallIssue]
449
+ None,
450
+ )
444
451
  method = request_param.method
445
452
  response = Sentinel
446
453
  async with AsyncExitStack() as exit_stack:
@@ -457,6 +464,7 @@ class VersionBundle:
457
464
  head_route,
458
465
  exit_stack=exit_stack,
459
466
  embed_body_fields=route._embed_body_fields,
467
+ background_tasks=background_tasks,
460
468
  )
461
469
 
462
470
  response = await self._convert_endpoint_response_to_version(
@@ -625,6 +633,7 @@ class VersionBundle:
625
633
  *,
626
634
  exit_stack: AsyncExitStack,
627
635
  embed_body_fields: bool,
636
+ background_tasks: BackgroundTasks | None,
628
637
  ) -> dict[str, Any]:
629
638
  request: FastapiRequest = kwargs[request_param_name]
630
639
  if request_param_name == _CADWYN_REQUEST_PARAM_NAME:
@@ -666,6 +675,7 @@ class VersionBundle:
666
675
  head_route,
667
676
  exit_stack=exit_stack,
668
677
  embed_body_fields=embed_body_fields,
678
+ background_tasks=background_tasks,
669
679
  )
670
680
  # Because we re-added it into our kwargs when we did solve_dependencies
671
681
  if _CADWYN_REQUEST_PARAM_NAME in new_kwargs:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cadwyn
3
- Version: 4.2.3
3
+ Version: 4.2.4
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
@@ -9,7 +9,7 @@ cadwyn/changelogs.py,sha256=SdrdAKQ01mpzs-EN_zg-D0TY7wxsibjRjLMhGcI4q80,20066
9
9
  cadwyn/exceptions.py,sha256=VlJKRmEGfFTDtHbOWc8kXK4yMi2N172K684Y2UIV8rI,1832
10
10
  cadwyn/middleware.py,sha256=kUZK2dmoricMbv6knPCIHpXEInX2670XIwAj0v_XQxk,3408
11
11
  cadwyn/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
- cadwyn/route_generation.py,sha256=-4HJWH2AoyGuB4qER-Gjc6kgUYUpzo_FoSkw3Gyi6rU,22872
12
+ cadwyn/route_generation.py,sha256=npAWxhr38_NNZOvXriPt_StdzR4WeL5Xwv505e9Gn9s,22953
13
13
  cadwyn/routing.py,sha256=9AHSojmuLgUAQlLMIqXz-ViZ9n-fljgOsn7oxha7PjM,7341
14
14
  cadwyn/schema_generation.py,sha256=1eJ--nyG8onUROWegCmQQWJ4iJEu1MrTt-8bnLIQyeQ,39992
15
15
  cadwyn/static/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -20,9 +20,9 @@ cadwyn/structure/data.py,sha256=1ALPhBBCE_t4GrxM0Fa3hQ-jkORJgeWNySnZ42bsi0g,7382
20
20
  cadwyn/structure/endpoints.py,sha256=9FFnbqPM9v0CP6J6tGhMNKVvWqA9u3ZjI2Fannr2Rl0,5933
21
21
  cadwyn/structure/enums.py,sha256=bZL-iUOUFi9ZYlMZJw-tAix2yrgCp3gH3N2gwO44LUU,1043
22
22
  cadwyn/structure/schemas.py,sha256=D0BD1D3v9MRdVWchU9JM2zHd0dvB0UgXHDGFCe5aQZc,8209
23
- cadwyn/structure/versions.py,sha256=yS_YyFK5KflV4CUzr13Ygx52r56MlSKG5qpt3Sjaxrc,33124
24
- cadwyn-4.2.3.dist-info/LICENSE,sha256=KeCWewiDQYpmSnzF-p_0YpoWiyDcUPaCuG8OWQs4ig4,1072
25
- cadwyn-4.2.3.dist-info/METADATA,sha256=1i1AeVtzQX5oxRUTXkjO7_sVCEMSef9Hj9br320-Ftg,4393
26
- cadwyn-4.2.3.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
27
- cadwyn-4.2.3.dist-info/entry_points.txt,sha256=eO05hLn9GoRzzpwT9GONPmXKsonjuMNssM2D2WHWKGk,46
28
- cadwyn-4.2.3.dist-info/RECORD,,
23
+ cadwyn/structure/versions.py,sha256=2qe7xFYNdzdWmCZhkf4_zJ7lF0XdtyM1wq6xQ9omb_c,33655
24
+ cadwyn-4.2.4.dist-info/LICENSE,sha256=KeCWewiDQYpmSnzF-p_0YpoWiyDcUPaCuG8OWQs4ig4,1072
25
+ cadwyn-4.2.4.dist-info/METADATA,sha256=p4VPoo3GACrQLJKtvuf4Zw2J2M9JJ3aqn8Faai49I08,4393
26
+ cadwyn-4.2.4.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
27
+ cadwyn-4.2.4.dist-info/entry_points.txt,sha256=eO05hLn9GoRzzpwT9GONPmXKsonjuMNssM2D2WHWKGk,46
28
+ cadwyn-4.2.4.dist-info/RECORD,,
File without changes