Skip to content

Migrate from pydantic v1 to v2 #40

@max-tet

Description

@max-tet

Summary

The codebase currently uses pydantic v1 (evidenced by pydantic.error_wrappers.ValidationError and .dict() calls). Pydantic v1 is end-of-life. Migrate to pydantic v2.

Motivation

  • Pydantic v1 is no longer maintained
  • Prerequisite for Replace gconf with pydantic-settings #41 (replace gconf with pydantic-settings v2)
  • Several test failures are related to pydantic v1 incompatibilities (e.g. @property fields causing 'property' object is not iterable in .dict())

Scope

  • Update pydantic dependency to v2
  • Replace deprecated APIs:
    • .dict().model_dump()
    • .json().model_dump_json()
    • .parse_obj().model_validate()
    • validatorfield_validator
    • pydantic.error_wrappers.ValidationErrorpydantic.ValidationError
  • Fix any model definitions that rely on v1 behavior (e.g. orm_modefrom_attributes)
  • Update shard_core/data_model/backend/shard_model.py which has @property fields that break v1's .dict()

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

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