-
-
Notifications
You must be signed in to change notification settings - Fork 288
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
Extensible codecs for V3 #1588
Extensible codecs for V3 #1588
Conversation
No code changes to Zarrita were made.
Hello @normanrz! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:
Comment last updated at 2023-12-06 10:51:06 UTC |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mostly reviewed the entrypoints stuff since the rest seemed to be reorganization / porting from zarrita. Looks really nice!
@@ -59,24 +53,8 @@ def _structure_chunk_key_encoding_metadata(d: Dict[str, Any], _t) -> ChunkKeyEnc | |||
) | |||
|
|||
def _structure_codec_metadata(d: Dict[str, Any], _t=None) -> CodecMetadata: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not for now but it would be nice if the codec metadata was a TypedDict
so we could expect for keys like "name".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
name
is really the only shared attribute among all codecs. Even configuration
is optional. I don't think there'd be much value in a TypedDict. This piece of code is in the middle of the deserialization; lots of untyped magic happening here anyways :-)
Co-authored-by: Joe Hamman <jhamman1@gmail.com>
@frozen | ||
class _AsyncArrayProxy: | ||
array: AsyncArray | ||
|
||
def __getitem__(self, selection: Selection) -> _AsyncArraySelectionProxy: | ||
return _AsyncArraySelectionProxy(self.array, selection) | ||
|
||
|
||
@frozen | ||
class _AsyncArraySelectionProxy: | ||
array: AsyncArray | ||
selection: Selection | ||
|
||
async def get(self) -> np.ndarray: | ||
return await self.array.getitem(self.selection) | ||
|
||
async def set(self, value: np.ndarray): | ||
return await self.array.setitem(self.selection, value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* Pull Zarrita into Zarr-Python @ 78274781ad64aef95772eb4b083f7ea9b7d03d06 No code changes to Zarrita were made. * apply zarr lint rules * zarrita -> v3 * v3/abc [wip] * use abcs plus implementation notes * working on making codecs extensible * adds index_location * adds support for codec entry points * adds tests from zarrita * fixes types * Apply suggestions from code review Co-authored-by: Joe Hamman <jhamman1@gmail.com> * remove test codec from pyproject.toml --------- Co-authored-by: Joseph Hamman <joe@earthmover.io> Co-authored-by: Joe Hamman <jhamman1@gmail.com>
Makes codecs extensible in the v3 branch by adding a codec registry.