Replies: 1 comment 3 replies
-
|
Hi @danking.
That is awesome! If you are happy to share, what is the codec?
Our main motivation with
It might not be too difficult to additionally support runtime registration of extensions in
@keewis might have some helpful insight here. I believe he wrote a sparse array codec in Rust for direct use in |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello! Thank you for your work on Zarrs!
I have tried to define, in Rust, a new Array-to-Bytes codec. I want to distribute this codec as a Python package.
I've implemented a
ArrayToBytesCodecTraitsas well as aArrayPartialDecoderTraits. Using these classes, fully inside Rust, after callingArrayBuilder::array_to_bytes_codec, I'm able to read and write to a Zarr file using my new codec. Yay!I now want to expose this class, via PyO3, in a small Python package. This is where I am stuck.
Zarrs seems to use
inventoryfor defining new codecs. AFAIK, I can't use that approach becauseinventorydefines, at compile-time, the available codecs. I do not want to distribute an entire copy of the zarrs-python binary library inside my package. I just want to use enough of it to define my codec.The other route is to just directly integrate with the Zarr Python package. Zarr seems to expect codec-authors to subclass the Python class
ArrayBytesCodecand define an entrypoint. It seems, in order to create an array with a particular codec, I specify acompressorincreate_array.Unfortunately, I can't find a Zarrs-python struct which corresponds to
ArraySpec. I also can't seem to find a way to convert from a Pythonnp.dtypeto a ZarrsDataType.Am I misusing Zarrs-python? In retrospect, it seems like it would have been simpler to write a thin PyO3 shim which uses rust-numpy to consume/produce ndarrays and Vec from/to Python.
Beta Was this translation helpful? Give feedback.
All reactions