Skip to content

Installation

pip install class-e

From source, with uv:

git clone git@github.com:rcalderonb6/class-e.git
cd class-e
uv sync --all-extras          # everything, plus the development tools
uv sync --extra jax --extra classy --no-default-groups   # a lean install

Extras

Extra Adds Needed for
plot cplots[matplotlib] evaluate --plots/--report, learning and PCA curves
ui marimo, ipywidgets, polars (includes plot) generate -i, train -i, inspect
jax jax, optax, tinygp, equinox jax and vae backends, gradients
jax-cuda jax[cuda12] on Linux (includes jax) training on NVIDIA GPUs (GPU training)
classy classy from PyPI computing spectra with standard CLASS
cobaya Cobaya class_e.cobaya.ClassE
hf huggingface_hub class-e publish --to hf (downloading from Hugging Face needs nothing extra)
all all of the above everything

Warning

uv sync makes the environment match the command exactly: an extra left out is removed, and so is a package installed by hand with uv pip install. List every extra you want in one command, or use --all-extras.

Development groups

Tools for working on class-e itself; uv only, never published to PyPI.

Group Adds
test pytest
lint ruff, codespell
docs mkdocs, mkdocs-material, mkdocstrings, mkdocs-jupyter
notebooks ipykernel, nbformat, nbconvert (dev/examples/*.ipynb)
dev test, lint and docs; installed by default with uv sync

Add a group with --group notebooks; skip the default one with --no-default-groups.

CLASS

class-e computes with the classy Python wrapper. Install it in the same environment, or point class-e at another build (AxiCLASS, Hi-CLASS, ...): see Custom CLASS builds.