Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pydantic v2 migration #3007

Closed
wants to merge 10 commits into from
Closed

pydantic v2 migration #3007

wants to merge 10 commits into from

Conversation

kashif
Copy link
Contributor

@kashif kashif commented Sep 17, 2023

Initial pydantic v2 migraton

@kashif
Copy link
Contributor Author

kashif commented Oct 23, 2023

@ddelange can you help me fix up the tests?

@ddelange
Copy link
Contributor

/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/gluonts/ext/rotbaum/_types.py:28: in FeatureImportanceResult
    @model_validator()
E   TypeError: model_validator() missing 1 required keyword-only argument: 'mode'
mode: Specifies whether to validate the fields before or after validation.

https://docs.pydantic.dev/latest/api/functional_validators

@ddelange
Copy link
Contributor

test/core/test_serde_dataclass.py:22: in <module>
    class Estimator:
/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/gluonts/core/serde/_dataclass.py:139: in dataclass
    return _dataclass(cls, init, repr, eq, order, unsafe_hash, frozen)
/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/gluonts/core/serde/_dataclass.py:155: in _dataclass
    pydantic.dataclasses.dataclass(
/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/pydantic/dataclasses.py:141: in dataclass
    assert init is False, 'pydantic.dataclasses.dataclass only supports init=False'
E   AssertionError: pydantic.dataclasses.dataclass only supports init=False

https://github.com/awslabs/gluonts/actions/runs/6611474968/job/17955418303?pr=3007#step:5:75

@ddelange
Copy link
Contributor

E       pydantic_core._pydantic_core.ValidationError: 1 validation error for CategoricalFeatureInfo
E       cardinality
E         Input should be a valid string [type=string_type, input_value=10, input_type=int]
E           For further information visit https://errors.pydantic.dev/2.4/v/string_type

https://github.com/awslabs/gluonts/actions/runs/6611474968/job/17955418303?pr=3007#step:5:701

@ddelange
Copy link
Contributor

Hi @kashif 👋

I'm trying a less intrusive approach in #3026

@kashif kashif closed this Oct 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants