Open a ZIP like a table.
cozip adds a Parquet manifest to an ordinary ZIP and puts a small fixed index at byte 0. A reader fetches the index and manifest first, then requests only the payload bytes it needs.
A cozip remains a valid ZIP file: unzip, zipfile.ZipFile, and ordinary ZIP
tools still work.
import tempfile
from pathlib import Path
import numpy as np
import pyarrow as pa
import rasterio
import cozip
# 1. Three tiny GeoTIFFs: all-zeros, all-ones, all-twos. (your dataset)
tmp = Path(tempfile.mkdtemp())
labels = ["zeros", "ones", "twos"]
paths = [tmp / f"{label}.tif" for label in labels]
profile = dict(driver="GTiff", dtype="uint8", count=1, width=64, height=64,
crs="EPSG:4326", transform=rasterio.Affine.identity())
for v, p in enumerate(paths):
with rasterio.open(p, "w", **profile) as dst:
dst.write(np.full((64, 64), v, "uint8"), 1)
# 2. Pack with a table.
archive = str(tmp / "dataset.zip")
cozip.write(archive, pa.table({
"path": [str(p) for p in paths],
"name": [p.name for p in paths],
"split": ["train", "val", "train"],
"label": labels,
}))
# 3. Read manifest
manifest = cozip.read(archive)
for _, row in manifest[manifest["split"] == "train"].iterrows():
with rasterio.open(row["cozip:location"]) as src:
print(row["name"], src.read(1).mean())path says where each file lives on disk. name is how it appears inside the
archive. Everything else is optional metadata. The writer adds offset and
size; the reader can also add cozip:location, a
GDAL VSI path.
| Language | Install | Role | Docs |
|---|---|---|---|
| Python | pip install cozip |
read + write | python/ |
| R | install.packages("cozip", repos = "https://asterisk-labs.r-universe.dev") |
read + write | r/ |
| Julia | Pkg.Registry.add("https://github.com/asterisk-labs/AsteriskRegistry"); Pkg.add("Cozip") |
read + write | julia/ |
| JavaScript | npm install @asterisk-labs/cozip |
reader | javascript/ |
| C | vendor core/ (libzip, zlib and karu bundled; the reader links libcurl and OpenSSL) |
core writer + Flat reader | core/ |
| DuckDB (optional) | INSTALL cozip FROM community; LOAD cozip; |
SQL over stored files | asterisk-labs/cozip_reader |
core/ writes archives and reads Flat manifests through the vendored
karu. Python, R and Julia use that
library; javascript/ has its own HTTP reader. The optional
cozip_reader extension queries
stored files with SQL. The C API also supports TACO writing.
All follow SPEC.md.
See SPEC.md. Any conforming reader handles any conforming writer.
Install the cozip skill so coding agents know its format rules, binding APIs and TACO writer contract.
npx skills add asterisk-labs/cozipMIT.