cadwyn 3.6.0.dev0__py3-none-any.whl → 3.6.1__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,6 +1,6 @@
1
1
  from collections.abc import Callable, Coroutine, Sequence
2
2
  from types import ModuleType
3
- from typing import Any
3
+ from typing import TYPE_CHECKING, Any, cast
4
4
 
5
5
  from fastapi import APIRouter, routing
6
6
  from fastapi.datastructures import Default
@@ -63,14 +63,10 @@ class Cadwyn(HeaderRoutingFastAPI):
63
63
  **extra: Any,
64
64
  ) -> None:
65
65
  # TODO: Remove argument entirely in any major version.
66
- self.versions = versions
67
66
  latest_schemas_package = extra.pop("latest_schemas_package", None) or self.versions.latest_schemas_package
68
- if latest_schemas_package is None:
69
- raise CadwynError(
70
- "VersionBundle.latest_schemas_package is None but is required for Cadwyn's correct functioning."
71
- )
72
- self.latest_schemas_package: ModuleType = latest_schemas_package
67
+ self.latest_schemas_package = cast(ModuleType, latest_schemas_package)
73
68
  self.versions.latest_schemas_package = latest_schemas_package
69
+ self.versions = versions
74
70
 
75
71
  super().__init__(
76
72
  api_version_header_name=api_version_header_name,
cadwyn/exceptions.py CHANGED
@@ -15,7 +15,7 @@ class CadwynLatestRequestValidationError(CadwynError):
15
15
  self.body = body
16
16
  self.version = version
17
17
  super().__init__(
18
- f"We failed to migrate the request with version={str(self.version)}. "
18
+ f"We failed to migrate the request with version={self.version!s}. "
19
19
  "This means that there is some error in your migrations or schema structure that makes it impossible "
20
20
  "to migrate the request of that version to latest.\n"
21
21
  f"body={self.body}\n\nerrors={json.dumps(self.errors, indent=4, ensure_ascii=False)}"
cadwyn/routing.py CHANGED
@@ -1,7 +1,6 @@
1
1
  import functools
2
2
  import inspect
3
3
  import re
4
- import sys
5
4
  import typing
6
5
  import warnings
7
6
  from collections import defaultdict
@@ -44,11 +43,10 @@ from starlette.routing import (
44
43
  from typing_extensions import Self, assert_never
45
44
 
46
45
  from cadwyn._compat import model_fields, rebuild_fastapi_body_param
47
- from cadwyn._package_utils import get_package_path_from_module, get_version_dir_path
46
+ from cadwyn._package_utils import get_version_dir_path
48
47
  from cadwyn._utils import Sentinel, UnionType, get_another_version_of_cls
49
48
  from cadwyn.exceptions import (
50
49
  CadwynError,
51
- ModuleIsNotVersionedError,
52
50
  RouteAlreadyExistsError,
53
51
  RouterGenerationError,
54
52
  RouterPathParamsModifiedError,
@@ -340,10 +340,7 @@ class VersionBundle:
340
340
  for defined_version in self.version_dates:
341
341
  if defined_version <= version:
342
342
  return defined_version
343
- else:
344
- raise CadwynError(
345
- "You tried to migrate to version that is earlier than the first version which is prohibited."
346
- )
343
+ raise CadwynError("You tried to migrate to version that is earlier than the first version which is prohibited.")
347
344
 
348
345
  @functools.cached_property
349
346
  def _version_changes_to_version_mapping(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cadwyn
3
- Version: 3.6.0.dev0
3
+ Version: 3.6.1
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=jFdnbkDDu_10YhJemDUVMut_XoqwIvGMtCQpDeitCiM,10206
4
4
  cadwyn/_compat.py,sha256=6QwtzbXn53mIhEFfEizmFjd-f894oLsM6ITxqq2rCpc,5408
5
5
  cadwyn/_package_utils.py,sha256=trxTYLmppv-10SKhScfyDQJh21rsQGFoLaOtHycKKR0,1443
6
6
  cadwyn/_utils.py,sha256=nBBE9PGo9MuHlCgbX8JPz9XcQxF7zIbVtKaBEsgfhGc,4861
7
- cadwyn/applications.py,sha256=-h6kh71tUnERryBXrt-_5wFkC1jYCRxssyRm8gJGf9g,5359
7
+ cadwyn/applications.py,sha256=-QmOBejDYnwuRiZFuZbRoeIJ0fE_8D9AnUMk2PeAHrA,5185
8
8
  cadwyn/codegen/README.md,sha256=V2Kz2IOz1cTxrC-RnQ7YbWEVCIGYr3tR4IPCvepeq0M,1047
9
9
  cadwyn/codegen/__init__.py,sha256=JgddDjxMTjSfVrMXHwNu1ODgdn2QfPWpccrRKquBV6k,355
10
10
  cadwyn/codegen/_common.py,sha256=j-K0zMINmOKPhwsKjtfmrUrNzgEU4gM2EEFC7wvpCdU,5696
@@ -16,10 +16,10 @@ cadwyn/codegen/_plugins/class_renaming.py,sha256=5ka2W1c18i4maNbEkEpELvGLEFbd8tt
16
16
  cadwyn/codegen/_plugins/import_auto_adding.py,sha256=00zGK99cT-bq2eXKDlYBR5-Z3uHLOGU7dbhB0YFFrt0,2613
17
17
  cadwyn/codegen/_plugins/latest_version_aliasing.py,sha256=9MPW-FMOcjBZ7L05T0sxwSDCfFZHAn6xZV_E1KImbUA,3946
18
18
  cadwyn/codegen/_plugins/module_migrations.py,sha256=TeWJk4Iu4SRQ9K2iI3v3sCs1110jrltKlPdfU9mXIsQ,722
19
- cadwyn/exceptions.py,sha256=0g9qHYYDVpBjRwv7Fvg8yVESTPQ0x2nBtSWHDF-VFGk,1445
19
+ cadwyn/exceptions.py,sha256=JUHFjxWl2XlnweVnSpq3mWFUNU0ocyXBBleMMQyCyBk,1442
20
20
  cadwyn/main.py,sha256=kt2Vn7TIA4ZnD_xrgz57TOjUk-4zVP8SV8nuTZBEaaU,218
21
21
  cadwyn/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
22
- cadwyn/routing.py,sha256=q_Voby_93oeq-Mp0SQOSWp0xB81NMmfFWTEZZXVyNfk,35009
22
+ cadwyn/routing.py,sha256=njVzrVOruO-WFI74f3JIfATivSiz1C5EJuWjjZyaseI,34937
23
23
  cadwyn/structure/__init__.py,sha256=BjFPlQYCw8ds_4zxdCi2LimarUGqSzyTNmOdT-FkGms,661
24
24
  cadwyn/structure/common.py,sha256=6Z4nI97XPWTCinn6np73m-rLPyYNrz2fWXKJlqjsiaQ,269
25
25
  cadwyn/structure/data.py,sha256=u5-pJ48BRnPSt2JbH6AefHGddTEE5z7YBnyv0iGw3dQ,6133
@@ -27,9 +27,9 @@ cadwyn/structure/endpoints.py,sha256=VngfAydGBwekhV2tBOtNDPVgl3X1IgYxUCw--VZ5cQY
27
27
  cadwyn/structure/enums.py,sha256=iMokxA2QYJ61SzyB-Pmuq3y7KL7-e6TsnjLVUaVZQnw,954
28
28
  cadwyn/structure/modules.py,sha256=1FK-lLm-zOTXEvn-QtyBH38aDRht5PDQiZrOPCsBlM4,1268
29
29
  cadwyn/structure/schemas.py,sha256=5hExJEdvEFPK4Cv8G_Gh6E6ltiNMyId_UjGIJz3jz0o,8802
30
- cadwyn/structure/versions.py,sha256=CFjMFIFCbCGmiB7etT9b7kbcwUjXsSuXvpsEAvoQoLI,32833
31
- cadwyn-3.6.0.dev0.dist-info/LICENSE,sha256=KeCWewiDQYpmSnzF-p_0YpoWiyDcUPaCuG8OWQs4ig4,1072
32
- cadwyn-3.6.0.dev0.dist-info/METADATA,sha256=Cupe9mJglEPJ8A0omuoCH3OHyAgKeNknwy8cWP1buyc,4120
33
- cadwyn-3.6.0.dev0.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
34
- cadwyn-3.6.0.dev0.dist-info/entry_points.txt,sha256=eO05hLn9GoRzzpwT9GONPmXKsonjuMNssM2D2WHWKGk,46
35
- cadwyn-3.6.0.dev0.dist-info/RECORD,,
30
+ cadwyn/structure/versions.py,sha256=6M_saZPlzEQ0LNRQywhtrw-YPdjT0P18EEPTRg1dR8Y,32785
31
+ cadwyn-3.6.1.dist-info/LICENSE,sha256=KeCWewiDQYpmSnzF-p_0YpoWiyDcUPaCuG8OWQs4ig4,1072
32
+ cadwyn-3.6.1.dist-info/METADATA,sha256=DoAIPVvJTgh-572j5LPWqhxOc7Uz2TIzv6k2UjX2G50,4115
33
+ cadwyn-3.6.1.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
34
+ cadwyn-3.6.1.dist-info/entry_points.txt,sha256=eO05hLn9GoRzzpwT9GONPmXKsonjuMNssM2D2WHWKGk,46
35
+ cadwyn-3.6.1.dist-info/RECORD,,