Metadata-Version: 2.1
Name: mysquishy
Version: 0.1.0
Summary: Recompress zarr chunks in-place
Author-email: Juan Nunez-Iglesias <jni@fastmail.com>
Maintainer-email: Juan Nunez-Iglesias <jni@fastmail.com>
License: Copyright (c) 2023 Juan Nunez-Iglesias
        
        Permission is hereby granted, free of charge, to any person obtaining a copy of
        this software and associated documentation files (the "Software"), to deal in
        the Software without restriction, including without limitation the rights to
        use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
        of the Software, and to permit persons to whom the Software is furnished to do
        so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3 :: Only
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Provides-Extra: dev
Provides-Extra: test
License-File: LICENSE.txt

# mysquishy

"I shall call him Squishy and he shall be mine and he shall be my Squishy."
— Dory

<img width="200" alt="mysquishy" src="https://user-images.githubusercontent.com/492549/220297427-736a3628-b1aa-429b-bf0d-f921c75b3172.png">

## Change the compression of a zarr array in-place.

This works by loading the chunk bytes, decoding them, recoding them, and saving
them. At the end, the .zarray file at the root is updated.

Note that this only works for single arrays: there should be a .zarray file at
the root. It is left as an exercise for the reader to figure out how to
recompress every array in a zarr group.

Contributions are very welcome.

## ⚠️  BAD SQUISHY! ⚠️

<img width="200" alt="Bad Squishy!" src="https://user-images.githubusercontent.com/492549/220299563-744d1958-2f2f-4763-a6e1-27c3bd7967f8.png">

This is currently just a proof of concept and it will leave your zarr arrays in
an inconsistent/broken state if it is interrupted! And/or there might be bugs.
It makes no effort to account for missing keys, for example. As above,
contributions are very welcome but in the meantime be careful! Make a tiny zarr
example similar to your data and check that it works fine there before
deploying it properly.

## Usage

From Python:

```python
nbytes_before, nbytes_after = mysquishy.squish('path/to/array.zarr')
```

From the command line:

```
mysquishy path/to/array.zarr
```
