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

Migrate to pydantic v2 #28

Open
wolny opened this issue Apr 3, 2024 · 1 comment
Open

Migrate to pydantic v2 #28

wolny opened this issue Apr 3, 2024 · 1 comment

Comments

@wolny
Copy link

wolny commented Apr 3, 2024

No description provided.

@wolny wolny changed the title Migrat to pydantic v2 Migrate to pydantic v2 Apr 3, 2024
@wolny
Copy link
Author

wolny commented Apr 3, 2024

@sdvillal unfortunately the migration to v2 is not that simple. After upgrading geojson-pydantic installing pydantic-extra-types (needed for additional types like Color which we use in AnnotationModel and running the bump-pydantic migration tool, we're getting the same errors as before when creating a mock dataset:

Traceback (most recent call last):
  File "/Users/adrianwolny/workspace/pado/pado/demo.py", line 2, in <module>
    ds = mock_dataset(None)
  File "/Users/adrianwolny/workspace/pado/pado/mock.py", line 98, in mock_dataset
    ip = mock_images(images_urlpath, num_images)
  File "/Users/adrianwolny/workspace/pado/pado/mock.py", line 206, in mock_images
    image = Image(
  File "/Users/adrianwolny/workspace/pado/pado/images/image.py", line 149, in __init__
    self._metadata = self._load_metadata()
  File "/Users/adrianwolny/workspace/pado/pado/images/image.py", line 336, in _load_metadata
    return ImageMetadata(
  File "/Users/adrianwolny/miniconda3/envs/pasu/lib/python3.9/site-packages/pydantic/main.py", line 171, in __init__
    self.__pydantic_validator__.validate_python(data, self_instance=self)
pydantic_core._pydantic_core.ValidationError: 1 validation error for ImageMetadata
objective_power
  Input should be a valid string [type=string_type, input_value=40, input_type=int]
    For further information visit https://errors.pydantic.dev/2.6/v/string_type

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

No branches or pull requests

1 participant