Metadata-Version: 2.4
Name: powerailabs-squeeze
Version: 0.4.3
Summary: Compress: shrink verbose context (JSON/logs/prose) 60-90% — reversibly. compress() returns a handle; expand() restores the original.
Author: Raghav Mishra
License-Expression: Apache-2.0
License-File: LICENSE
License-File: NOTICE
Requires-Python: >=3.11
Requires-Dist: powerailabs-core<0.2,>=0.1
Description-Content-Type: text/markdown

# powerailabs-squeeze

Shrink verbose context — JSON, logs, code, prose — without throwing anything away. Compression
returns a *handle*; the original is always restorable. Content-aware: each type gets a
purpose-built, **deterministic** compressor — **no LLM, no model download, byte-reproducible**.

**Up to 97% smaller, 100% reversible — zero dependencies, deterministic output.**

![PyPI](https://img.shields.io/pypi/v/powerailabs-squeeze) ![license](https://img.shields.io/badge/license-Apache_2.0-blue) · `pip install powerailabs-squeeze`

```python
from powerailabs.squeeze import compress

small, handle = compress(huge_json, kind="auto")                 # detect + route
small, handle = compress(source_code, kind="code", fidelity="aggressive")
small, handle = compress(logs, kind="logs", target_tokens=400)   # compress to a budget
original = handle.expand()                                        # restore, byte-for-byte
```

**Inbound** — usually `contextkit` calls it for you (`Block(evict="compress")` via the
`contextkit[squeeze]` extra); it satisfies core's `Compressor` protocol by shape, so contextkit
never imports it. Routes JSON / logs / **code** / prose; a `fidelity` dial (lossless / balanced /
aggressive) trades structure for size. Reversibility comes from a content-addressed store you can
swap — `squeeze.store.SQLiteStore` (persistent) or a bounded `MemoryStore(max_items=...)` via
`use_store(...)`.

**The deterministic default — swap in any backend.** squeeze is the zero-dependency, no-download
compressor that ships with the stack; because it's wired through the `Compressor` protocol (not a
hard import), you can replace it globally with any other backend — including a heavier ML-based
compressor — via `contextkit.use_compressor(...)`. squeeze stays the choice when you want
reproducible, offline, audit-friendly output with nothing to download. Ratios are content-dependent
(logs compress most, structured JSON least) — see the [benchmarks](https://github.com/PowerAI-Labs/powerailabs/blob/main/docs/benchmarks.md).

See [`docs/squeeze.md`](https://github.com/PowerAI-Labs/powerailabs/blob/main/docs/squeeze.md) · [CHANGELOG](https://github.com/PowerAI-Labs/powerailabs/blob/main/packages/powerailabs-squeeze/CHANGELOG.md). *Part of the PowerAI Labs stack — [github.com/PowerAI-Labs/powerailabs](https://github.com/PowerAI-Labs/powerailabs). Apache-2.0; provided "as is", without warranty — use at your own risk (LICENSE §7–8).*
