Skip to content

DOC: zarr.errors changes in v3 #3009

Open
@christine-e-smit

Description

@christine-e-smit

Describe the issue linked to the documentation

It looks like you've completely changed the exceptions under zarr.errors in the transition from v2 to v3. Our v2 code catches zarr.errors.PathNotFoundError to determine if a zarr store exists, but v3 appears to be using python's FileNotFound exception now. This makes a lot of sense, but it is a change that anyone who catches v2 exceptions will need to know about.

Here's the errors in v2:

>>> import inspect
>>> import zarr
>>> for name,cls in inspect.getmembers(zarr.errors,inspect.isclass):
...     print(cls)
...     
<class 'zarr.errors.ArrayIndexError'>
<class 'zarr.errors.ArrayNotFoundError'>
<class 'zarr.errors.BadCompressorError'>
<class 'zarr.errors.BoundsCheckError'>
<class 'zarr.errors.ContainsArrayError'>
<class 'zarr.errors.ContainsGroupError'>
<class 'zarr.errors.CopyError'>
<class 'zarr.errors.FSPathExistNotDir'>
<class 'zarr.errors.GroupNotFoundError'>
<class 'zarr.errors.MetadataError'>
<class 'zarr.errors.NegativeStepError'>
<class 'zarr.errors.PathNotFoundError'>
<class 'zarr.errors.ReadOnlyError'>
<class 'zarr.errors.VindexInvalidSelectionError'>
<class 'zarr.errors._BaseZarrError'>
<class 'zarr.errors._BaseZarrIndexError'>

And here's v3:

>>> import inspect
>>> import zarr
>>> for name,cls in inspect.getmembers(zarr.errors,inspect.isclass):
...     print(cls)
...     
typing.Any
<class 'zarr.errors.BaseZarrError'>
<class 'zarr.errors.ContainsArrayAndGroupError'>
<class 'zarr.errors.ContainsArrayError'>
<class 'zarr.errors.ContainsGroupError'>
<class 'zarr.errors.MetadataValidationError'>
<class 'zarr.errors.NodeTypeValidationError'>

Given that there are many fewer v3 exceptions, I'm guessing you decided to clean up and consolidate your exception classes.

Suggested fix for documentation

I think that in the 3.0 Migration Guide, the section "Getting ready for 3.0", number 2 should include something short about the zarr.errors library. Unless you have an easy to understand grand philosophy for how you made these changes, I'm happy to submit a pull request with some generic language.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements to the documentationhelp wantedIssue could use help from someone with familiarity on the topic

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions