-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Description
Summary
Running pytest with --cov flag fails when importing climate_ref due to an incompatibility between ecgtools and pydantic 2.11+.
Error
PydanticSchemaGenerationError: Unable to generate pydantic-core schema for
<class 'pydantic.deprecated.decorator.ValidatedFunction.create_model.<locals>.DecoratorBaseModel'>
Root Cause
The ecgtools package uses the deprecated @pydantic.validate_arguments decorator which was removed/broken in pydantic 2.11:
# ecgtools/builder.py:148
@pydantic.validate_arguments
def build(self, ...):Import Chain
conftest.pyimportsclimate_ref.clicliimportsdatasetsdatasetsimportsecgtools.Builderecgtoolsuses deprecated@pydantic.validate_arguments- pydantic 2.11+ fails to generate schema
Current State
climate-ref-corerequirespydantic>=2.10.6- Installed:
pydantic 2.11.4 ecgtools 2024.7.31has no upper bound on pydantic- Tests pass without
--cov, only coverage collection triggers the import error make test-refworks (coverage shows 88.77%)
Potential Solutions
-
Pin pydantic < 2.11 in project dependencies
"pydantic>=2.10.6,<2.11" -
Wait for ecgtools fix - upstream needs to migrate from deprecated decorator
-
Lazy import ecgtools - defer import until actually needed, avoiding the conftest import chain
Environment
- pydantic: 2.11.4
- ecgtools: 2024.7.31
- Python: 3.11.14
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels