Skip to content

Minimum version of pydantic seems not sufficient #218

@phackstock

Description

@phackstock

When trying to import ixmp4 (or pyam) in the below example with pydantic version 2.9, we get the following error:

>>> import pyam
Traceback (most recent call last):
  File "/home/hackstock/.local/lib/python3.11/site-packages/ixmp4/db/filters.py", line 336, in __init__
    super().__init__(**data)
  File "/home/hackstock/.local/lib/python3.11/site-packages/pydantic/main.py", line 212, in __init__
    validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pydantic_core._pydantic_core.ValidationError: 1 validation error for OptimizationScalarFilter
unit__id
  Extra inputs are not permitted [type=extra_forbidden, input_value=None, input_type=NoneType]
    For further information visit https://errors.pydantic.dev/2.9/v/extra_forbidden

Updating to pydantic v2.12 seems to resolve the issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions