Metadata-Version: 2.4
Name: datazip
Version: 0.2.0
Summary: Seamless serialization and deserialization of complex Python objects — a more flexible and readable alternative to pickle for data science workflows.
Author-email: Alex Engel <alex@colectric.com>
License: MIT License
        
        Copyright (c) 2026 Alex Engel
        
        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.
License-File: LICENSE
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Requires-Python: >=3.12
Requires-Dist: orjson>=3.8
Requires-Dist: tzdata>=2022.7; platform_system == 'Windows'
Provides-Extra: dev
Requires-Dist: coverage>=5.3; extra == 'dev'
Requires-Dist: pandas>=2.0; extra == 'dev'
Requires-Dist: plotly>5.10; extra == 'dev'
Requires-Dist: polars>=0.20; extra == 'dev'
Requires-Dist: pyarrow>=9; extra == 'dev'
Requires-Dist: pytest>=6.2; extra == 'dev'
Provides-Extra: docs
Requires-Dist: matplotlib>=3.7; extra == 'docs'
Requires-Dist: mkdocs-material>=9.0; extra == 'docs'
Requires-Dist: mkdocs>=1.5; extra == 'docs'
Requires-Dist: mkdocstrings[python]>=0.24; extra == 'docs'
Description-Content-Type: text/markdown

# DataZip
[![Actions status]( https://github.com/colectric-dev/datazip/workflows/CI/badge.svg)](https://github.com/colectric-dev/datazip/actions)
[![GitHub Pages Status]( https://github.com/colectric-dev/datazip/workflows/docs/badge.svg)](https://colectric-dev.github.io/datazip/)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)



**DataZip** is a Python library that extends [`zipfile.ZipFile`](https://docs.python.org/3/library/zipfile.html#zipfile.ZipFile) to provide seamless serialization and deserialization of complex Python objects — a more flexible and readable alternative to pickle for data science workflows.

## Why DataZip?

- **Human-inspectable archives**: DataZip files are standard `.zip` files. You can open them with any archive tool and inspect the contents.
- **Broad type support**: Works out of the box with pandas DataFrames/Series, NumPy arrays, Polars DataFrames, datetimes, paths, sets, frozensets, complex numbers, and custom classes.
- **Efficient storage**: Tabular data is stored as Parquet; arrays as `.npy`. JSON is used for metadata and simple types.
- **No pickle by default**: Most types are serialized without pickle, making files safer and more portable.
- **Custom class integration**: Any class that implements `__getstate__`/`__setstate__` (the standard pickle protocol) works automatically. The `IOMixin` makes it even simpler.

## Quick Example

```python
from io import BytesIO
import pandas as pd
from datazip import DataZip

# Write
buffer = BytesIO()
with DataZip(buffer, "w") as z:
    z["df"] = pd.DataFrame({"x": [1, 2, 3], "y": [4, 5, 6]})
    z["config"] = {"threshold": 0.5, "labels": ["a", "b"]}
    z["values"] = {1, 2, frozenset([3, 4])}

# Read
with DataZip(buffer, "r") as z:
    df = z["df"]
    config = z["config"]
```

## Supported Types

| Category | Types                                                            |
|---|------------------------------------------------------------------|
| Primitives | `str`, `int`, `float`, `bool`, `None`, `complex`                 |
| Collections | `dict`, `list`, `tuple`, `set`, `frozenset`, `deque`, `defaultdict` |
| Date/Time | `datetime`, `pandas.Timestamp`                                   |
| Paths | `pathlib.Path`                                                   |
| NumPy | `numpy.ndarray`                                                  |
| Pandas | `pandas.DataFrame`, `pandas.Series`                              |
| Polars | `polars.DataFrame`, `polars.LazyFrame`, `polars.Series`          |
| Custom | Any class with `__getstate__`/`__setstate__`                     |
| Optional | Plotly figures                                 |


See the [Installation](installation.md) page for full details including optional dependencies.
