refactor: define codec and data type classes upstream in a subpackage#3875
refactor: define codec and data type classes upstream in a subpackage#3875d-v-b wants to merge 2 commits intozarr-developers:mainfrom
Conversation
|
@zarr-developers/python-core-devs does anyone object to the basic proposal here: to upstream our basic codec + data type APIs? I think the current situation is untenable so I'd like to see it fixed. This PR is one approach, but I'm open to alternatives. |
| from zarr_interfaces.data_type.v1 import ZDType | ||
| ``` | ||
|
|
||
| Interfaces are versioned under a `v1` namespace to support future evolution |
There was a problem hiding this comment.
I wonder if the versioning will create confusion, because it is another version apart from the zarr package and the zarr data format versions.
There was a problem hiding this comment.
I hope it's not confusing! the goal here is to allow zarr-python to gracefully evolve things like the codec API. Since different codec APIs would not interact, we could define the current ABC-based API under v1, and a newer protocol-based API under v2. I think only codec and data type developers would need to know about this, and I would count on that crowd being able to know what the versions mean.
Projects that want to implement their own codecs or data types have to import base classes from
zarr-python. This meanszarr-pythoncan practically never depend on any externally-defined codecs or data types without creating a circular dependency (unacceptable). See #3867.To remedy this situation, this PR defines our codec and data type ABCs in a separate package called
zarr-interfaces.zarr-interfacesis a sub-package in this repo. The interfaces inzarr-interfacesare in versioned namespaces, which makes evolution of these APIs straightforward. Projects that want to implement a zarr-compatible codec or data type should depend onzarr-interfacesinstead of depending onzarr-pythonitself. This will allowzarr-pythonto optionally depend on externally-defined codecs and data types.I'm opening this as a draft because I'm not sure about quite a few things, and I would appreciate feedback on the basic direction.
TODO:
docs/user-guide/*.mdchanges/