xolars
Xarray + polars: an xarray Dataset paired with one
Polars frame per dimension, kept aligned to the Dataset's
coordinate order — including under isel/sel selection and zarr + parquet
round-trips.
Install
uv add xolars # or: pip install xolars
Usage
import numpy as np
import polars as pl
import xarray as xr
from xolars import Xolars
ds = xr.Dataset(
{"expr": (["gene_id", "sample_id"], np.arange(12.0).reshape(3, 4))},
coords={"gene_id": ["G1", "G2", "G3"], "sample_id": ["S1", "S2", "S3", "S4"]},
)
genes = pl.DataFrame({"gene_id": ["G1", "G2", "G3"], "chrom": ["c1", "c2", "c3"]})
xol = Xolars(ds=ds, df={"gene_id": genes})
# Selection filters the Dataset AND every per-dimension frame, together:
sub = xol.sel(gene_id=["G3", "G1"])
assert list(sub.df["gene_id"]["gene_id"]) == list(sub.ds["gene_id"].values)
# Persist to zarr (Dataset) + parquet (per-dim frames), then reopen lazily:
xol.write("mydata.xolars", mode="w")
reloaded = Xolars.open("mydata.xolars") # frames are pl.LazyFrame
eager = reloaded.collect() # -> pl.DataFrame
Xolars is a frozen, generic container: Xolars[pl.LazyFrame] after open,
Xolars[pl.DataFrame] after collect. Construction validates that each frame's
dim column exactly matches the Dataset coordinate (same set, same multiplicity)
and reorders rows to the Dataset's order.
Development
uv sync # create .venv with runtime + dev deps
uv run pytest -q # tests
uv run prek run --all-files # ruff + pyrefly + hygiene hooks
uv run prek install # enable git hooks locally
Releasing
Releases run via the manual Release GitHub Actions workflow
(workflow_dispatch), which uses commitizen
to bump the version from conventional commits, tag, create a GitHub release, and
publish to PyPI via OIDC trusted publishing. Before the workflow can succeed,
the following one-time setup is required on GitHub (out of scope for the initial
extraction):
- Push this repository to
https://github.com/d-laub/xolars. - Add a
GH_ACTIONSrepository secret (a PAT able to push tomain) so the bump commit + tag can be pushed past branch protection. - Configure a
pypienvironment and enable PyPI trusted publishing for thexolarsproject pointing at thepublishjob.
Metadata
Release files for xolars 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| xolars-0.3.0.tar.gz | 6.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| xolars-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.2 kB
Release files / xolars-0.3.0.tar.gz
| Download URL | xolars-0.3.0.tar.gz |
|---|---|
| Size | 6.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
228153477909949fed7aae0cd4bae088181b0c7a110c8941f9ee2d79a664db9c
|
|
BLAKE2b-256 checksum How to use checksums |
465c0f869d11e2111c024815e4d3277a0f86d832b71a3574b65d8e7be4e98295
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.25 {"installer":{"name":"uv","version":"0.11.25","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / xolars-0.3.0-py3-none-any.whl
| Download URL | xolars-0.3.0-py3-none-any.whl |
|---|---|
| Size | 7.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0659ec9d5bf3d9d4d858bcf6bd317a923fff4ad34563d33c9a4cb7e50eff19db
|
|
BLAKE2b-256 checksum How to use checksums |
d5ff63500b091ed0a53218907a2e900cc3d48d076861deabcc4d1f58f443ad88
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.25 {"installer":{"name":"uv","version":"0.11.25","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|