Skip to content

Commit 016f405

Browse files
committed
fix(deps): explicitly pin Pydantic to support Pyodide WASM
Pyodide natively supports pydantic 2.12.5 and pydantic-core 2.41.5 in its built-in registry. By pinning the dependencies to these exact versions, the browser worker can fetch them natively instead of failing to compile C-extensions from PyPI. This also eliminates the need for mock bypasses (try/except blocks) in models.py to handle older Pydantic versions.
1 parent 18a236e commit 016f405

4 files changed

Lines changed: 9 additions & 12 deletions

File tree

‎pyproject.toml‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ description = "OpenAPI 3.2.0 Python Client"
99
readme = "README.md"
1010
requires-python = ">=3.9,<3.14"
1111
dependencies = [
12-
"pydantic>=2.0",
12+
"pydantic==2.12.5",
13+
"pydantic-core==2.41.5",
1314
"libcst",
1415
"urllib3",
1516
"python-cdd>=0.0.98",

‎src/openapi_client/cli.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,8 @@ def scaffold_package(out_dir: Path):
154154
name = "generated-client"
155155
version = "0.0.1"
156156
dependencies = [
157-
"pydantic>=2.0",
157+
"pydantic==2.12.5",
158+
"pydantic-core==2.41.5",
158159
"urllib3",
159160
]
160161
""",

‎src/openapi_client/models.py‎

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -346,11 +346,4 @@ class OpenAPI(OpenAPIBase):
346346
# Rebuild models due to forward references
347347
for model in list(locals().values()):
348348
if isinstance(model, type) and issubclass(model, BaseModel) and model != BaseModel:
349-
if hasattr(model, "model_rebuild"):
350-
try:
351-
model.model_rebuild()
352-
except AttributeError: # pragma: no cover
353-
if hasattr(model, "update_forward_refs"): # pragma: no cover
354-
model.update_forward_refs() # pragma: no cover
355-
elif hasattr(model, "update_forward_refs"): # pragma: no cover
356-
model.update_forward_refs() # pragma: no cover
349+
model.model_rebuild()

‎uv.lock‎

Lines changed: 4 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)