Uh oh!
There was an error while loading. Please reload this page.
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 |
jhamman
left a comment
There was a problem hiding this comment.
I mostly reviewed the entrypoints stuff since the rest seemed to be reorganization / porting from zarrita. Looks really nice!
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| @@ -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.
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.
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) |
* 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.