cadwyn 3.15.4__py3-none-any.whl → 3.15.5__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.

cadwyn/applications.py CHANGED
@@ -1,3 +1,4 @@
1
+ import dataclasses
1
2
  import datetime
2
3
  from collections.abc import Callable, Coroutine, Sequence
3
4
  from datetime import date
@@ -34,6 +35,11 @@ CURR_DIR = Path(__file__).resolve()
34
35
  logger = getLogger(__name__)
35
36
 
36
37
 
38
+ @dataclasses.dataclass(slots=True)
39
+ class FakeDependencyOverridesProvider:
40
+ dependency_overrides: dict[Callable[..., Any], Callable[..., Any]]
41
+
42
+
37
43
  class Cadwyn(FastAPI):
38
44
  _templates = Jinja2Templates(directory=CURR_DIR.parent / "static")
39
45
 
@@ -92,6 +98,7 @@ class Cadwyn(FastAPI):
92
98
  latest_schemas_package = extra.pop("latest_schemas_package", None) or self.versions.head_schemas_package
93
99
  self.versions.head_schemas_package = latest_schemas_package
94
100
  self._latest_schemas_package = cast(ModuleType, latest_schemas_package)
101
+ self._dependency_overrides_provider = FakeDependencyOverridesProvider({})
95
102
 
96
103
  super().__init__(
97
104
  debug=debug,
@@ -166,6 +173,20 @@ class Cadwyn(FastAPI):
166
173
  default_response_class=default_response_class,
167
174
  )
168
175
 
176
+ @property
177
+ def dependency_overrides(self) -> dict[Callable[..., Any], Callable[..., Any]]:
178
+ # This is only necessary because we cannot send self to versioned router generator
179
+ # because it takes a deepcopy of the router and self.versions.head_schemas_package is a module
180
+ # which cannot be copied.
181
+ return self._dependency_overrides_provider.dependency_overrides
182
+
183
+ @dependency_overrides.setter
184
+ def dependency_overrides( # pyright: ignore[reportIncompatibleVariableOverride]
185
+ self,
186
+ value: dict[Callable[..., Any], Callable[..., Any]],
187
+ ) -> None:
188
+ self._dependency_overrides_provider.dependency_overrides = value
189
+
169
190
  @property # pragma: no cover
170
191
  @deprecated("It is going to be deleted in the future. Use VersionBundle.head_schemas_package instead")
171
192
  def latest_schemas_package(self):
@@ -209,7 +230,7 @@ class Cadwyn(FastAPI):
209
230
  )
210
231
 
211
232
  def generate_and_include_versioned_routers(self, *routers: APIRouter) -> None:
212
- root_router = APIRouter()
233
+ root_router = APIRouter(dependency_overrides_provider=self._dependency_overrides_provider)
213
234
  for router in routers:
214
235
  root_router.include_router(router)
215
236
  router_versions = generate_versioned_routers(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cadwyn
3
- Version: 3.15.4
3
+ Version: 3.15.5
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
@@ -4,7 +4,7 @@ cadwyn/_asts.py,sha256=OF1qQKPqTbgYhH1tYF-MB8CCU0r6YITZpMFegzmk0Ic,10118
4
4
  cadwyn/_compat.py,sha256=yAPmfGl2vVEYXlNHHPMoa2JkEJCVPjbP_Uz0WOIVOp4,5494
5
5
  cadwyn/_package_utils.py,sha256=trxTYLmppv-10SKhScfyDQJh21rsQGFoLaOtHycKKR0,1443
6
6
  cadwyn/_utils.py,sha256=BFsfZBpdoL5RMAaT1V1cXJVpTZCmwksQ-Le2MTHivGI,4841
7
- cadwyn/applications.py,sha256=vb6nDJnZGgQcC8a8ei6543DQ6KK-jhVXo31GdUC-3yo,14755
7
+ cadwyn/applications.py,sha256=MkZ_vMs6YfnfuWPUzBjNBmrxtDa97etsV0zcnlv-iS0,15749
8
8
  cadwyn/codegen/README.md,sha256=hc7AE87LsEsvbh-wX1H10JEWh-8bLHoe-1CkY3h00FI,879
9
9
  cadwyn/codegen/__init__.py,sha256=JgddDjxMTjSfVrMXHwNu1ODgdn2QfPWpccrRKquBV6k,355
10
10
  cadwyn/codegen/_common.py,sha256=FTI4fqpUFGBMACVlPiDMHTWhqwW_-zQNa_4Qh7m-hCA,5877
@@ -31,8 +31,8 @@ cadwyn/structure/enums.py,sha256=iMokxA2QYJ61SzyB-Pmuq3y7KL7-e6TsnjLVUaVZQnw,954
31
31
  cadwyn/structure/modules.py,sha256=1FK-lLm-zOTXEvn-QtyBH38aDRht5PDQiZrOPCsBlM4,1268
32
32
  cadwyn/structure/schemas.py,sha256=0ylArAkUw626VkUOJSulOwJs7CS6lrGBRECEG5HFD4Q,8897
33
33
  cadwyn/structure/versions.py,sha256=PuXYze89tWvLsOOiuAQtYRi-p1ue2FPfBWWR2bl8hLg,37236
34
- cadwyn-3.15.4.dist-info/LICENSE,sha256=KeCWewiDQYpmSnzF-p_0YpoWiyDcUPaCuG8OWQs4ig4,1072
35
- cadwyn-3.15.4.dist-info/METADATA,sha256=Hp9cctE2SIKT41gA-az7uLKyoeuGZhTe0h2PAYWnMuA,4397
36
- cadwyn-3.15.4.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
37
- cadwyn-3.15.4.dist-info/entry_points.txt,sha256=eO05hLn9GoRzzpwT9GONPmXKsonjuMNssM2D2WHWKGk,46
38
- cadwyn-3.15.4.dist-info/RECORD,,
34
+ cadwyn-3.15.5.dist-info/LICENSE,sha256=KeCWewiDQYpmSnzF-p_0YpoWiyDcUPaCuG8OWQs4ig4,1072
35
+ cadwyn-3.15.5.dist-info/METADATA,sha256=tMGbnU7byw_9yGiPDo-rM0V5gHCKVcVcSRiccCnwJsA,4397
36
+ cadwyn-3.15.5.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
37
+ cadwyn-3.15.5.dist-info/entry_points.txt,sha256=eO05hLn9GoRzzpwT9GONPmXKsonjuMNssM2D2WHWKGk,46
38
+ cadwyn-3.15.5.dist-info/RECORD,,