Skip to content

Remove deprecated use of Pydantic #1600

@candleindark

Description

@candleindark

The latest version of Pydantic, 2.11, is causing errors such as:

=========================== short test summary info ============================
FAILED dandi/cli/tests/test_cmd_ls.py::test_ls_bids_file - KeyError: 'identifier'
FAILED dandi/cli/tests/test_cmd_ls.py::test_ls_zarrbids_file - KeyError: 'identifier'
FAILED dandi/cli/tests/test_cmd_ls.py::test_smoke_local_schema - KeyError: 'digest'
FAILED dandi/cli/tests/test_cmd_validate.py::test_validate_bids_error[invalid_asl003] - AssertionError: assert 'NON_BIDS_PATH_PLACEHOLDER' in 'Error: Accessing this attribute on the instance is deprecated, and will be removed in Pydantic V3. Instead, you should access this attribute from the model class. Deprecated in Pydantic V2.11 to be removed in V3.0.\n'
 +  where 'Error: Accessing this attribute on the instance is deprecated, and will be removed in Pydantic V3. Instead, you should access this attribute from the model class. Deprecated in Pydantic V2.11 to be removed in V3.0.\n' = <Result SystemExit(1)>.output
FAILED dandi/cli/tests/test_cmd_validate.py::test_validate_bids_error[invalid_pet001] - AssertionError: assert 'NON_BIDS_PATH_PLACEHOLDER' in 'Error: Accessing this attribute on the instance is deprecated, and will be removed in Pydantic V3. Instead, you should access this attribute from the model class. Deprecated in Pydantic V2.11 to be removed in V3.0.\n'
 +  where 'Error: Accessing this attribute on the instance is deprecated, and will be removed in Pydantic V3. Instead, you should access this attribute from the model class. Deprecated in Pydantic V2.11 to be removed in V3.0.\n' = <Result SystemExit(1)>.output
FAILED dandi/tests/test_metadata.py::test_bids_nwb_metadata_integration - pydantic.warnings.PydanticDeprecatedSince211: Accessing this attribute on the instance is deprecated, and will be removed in Pydantic V3. Instead, you should access this attribute from the model class. Deprecated in Pydantic V2.11 to be removed in V3.0.
FAILED dandi/tests/test_metadata.py::test_prepare_metadata[metadata2asset.json-metadata0] - pydantic.warnings.PydanticDeprecatedSince211: Accessing this attribute on the instance is deprecated, and will be removed in Pydantic V3. Instead, you should access this attribute from the model class. Deprecated in Pydantic V2.11 to be removed in V3.0.
FAILED dandi/tests/test_metadata.py::test_prepare_metadata[metadata2asset_simple1.json-metadata1] - pydantic.warnings.PydanticDeprecatedSince211: Accessing this attribute on the instance is deprecated, and will be removed in Pydantic V3. Instead, you should access this attribute from the model class. Deprecated in Pydantic V2.11 to be removed in V3.0.
FAILED dandi/tests/test_metadata.py::test_prepare_metadata[metadata2asset_3.json-metadata2] - pydantic.warnings.PydanticDeprecatedSince211: Accessing this attribute on the instance is deprecated, and will be removed in Pydantic V3. Instead, you should access this attribute from the model class. Deprecated in Pydantic V2.11 to be removed in V3.0.
FAILED dandi/tests/test_metadata.py::test_prepare_metadata[metadata2asset_cellline.json-metadata3] - pydantic.warnings.PydanticDeprecatedSince211: Accessing this attribute on the instance is deprecated, and will be removed in Pydantic V3. Instead, you should access this attribute from the model class. Deprecated in Pydantic V2.11 to be removed in V3.0.
FAILED dandi/tests/test_metadata.py::test_nwb2asset - pydantic.warnings.PydanticDeprecatedSince211: Accessing this attribute on the instance is deprecated, and will be removed in Pydantic V3. Instead, you should access this attribute from the model class. Deprecated in Pydantic V2.11 to be removed in V3.0.
FAILED dandi/tests/test_upload.py::test_upload_download - dandi.exceptions.UploadError: failed to extract metadata: Accessing this attribute on the instance is deprecated, and will be removed in Pydantic V3. Instead, you should access this attribute from the model class. Deprecated in Pydantic V2.11 to be removed in V3.0.
FAILED dandi/tests/test_upload.py::test_upload_bids_invalid - pydantic.warnings.PydanticDeprecatedSince211: Accessing this attribute on the instance is deprecated, and will be removed in Pydantic V3. Instead, you should access this attribute from the model class. Deprecated in Pydantic V2.11 to be removed in V3.0.

Remove deprecated uses of Pydantic.

See https://github.com/dandi/dandi-cli/actions/runs/14181958193/job/39729884379 for details of the errors.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions