Installation

The easiest way to install is:

pip install dit

If you want to install dit within a conda environment, you can simply do:

conda install -c conda-forge dit

Optional features are grouped into extras:

Extra

Provides

optional

matplotlib (plots), plotly (interactive plots), colorama (colored PID tables), numdifftools (numerical gradients/Hessians), pint (units), pycddlib-standalone + pypoman (polytope vertex enumeration), scikit-learn (fast nearest-neighbor estimators)

jax

JAX optimization backend with autodiff (jax, jaxlib, optimistix, slsqp-jax)

torch

PyTorch optimization backend with autodiff and GPU support

pytensor

PyTensor optimization backend with autodiff

symbolic

sympy-valued (symbolic) distributions

broja

ECOS cone solver for the BROJA partial information decomposition

music

music21, for the empirical Bach / Corelli example distributions

test

pytest, hypothesis, and plugins for running the test suite

docs

Sphinx and friends for building the documentation

dev

everything above, plus ruff and ty

For example:

pip install "dit[optional,jax]"

For development, we recommend uv:

git clone https://github.com/dit/dit.git
cd dit
uv sync --extra dev

This installs dit in editable mode with all development dependencies (tests, docs, linting, type checking, and optional backends).

Testing

# Using uv (recommended)
uv run pytest

# Or with pip
pip install -e ".[test]"
pytest

By default the test suite skips tests marked slow and very_slow. To run them as well, override the marker selection:

uv run pytest -m ""

Building the documentation

uv run sphinx-build -W --keep-going -b html docs docs/_build/html