Installation

sparho ships as a single binary wheel via maturin

  • PyO3 (ABI3 — one wheel per OS/arch, all Python ≥ 3.11). You do not need a Rust toolchain to install from PyPI.

From PyPI (planned for v0.1.0)

pip install sparho

The [celer] extra pulls in celer as a fast coordinate-descent Lasso solver:

pip install "sparho[celer]"

From source

A Rust toolchain (stable, ≥ 1.75) and Python ≥ 3.11 are required. Editable development installs use uv and maturin develop:

git clone https://github.com/dvillacis/sparho.git
cd sparho
uv sync --extra dev
uv run maturin develop --release
uv run pytest

Optional extras

Extra

Purpose

celer

Fast coordinate-descent solver adapters.

dev

pytest, ruff, mypy, pre-commit.

docs

Sphinx + Furo + sphinx-gallery + numpydoc + myst-parser.

bench

libsvmdata, pandas, matplotlib for the benchmark scripts.

Verifying the install

import sparho
print(sparho.__version__)

from sparho import _core
import numpy as np

z = np.array([0.5, -0.2, 1.5])
print(_core.prox_l1(z, 0.3))  # → [0.2, 0.0, 1.2]

If the Rust extension fails to load, re-run maturin develop --release (source install) or report the wheel architecture mismatch on the issue tracker.