Skip to content

Contributing

Developer Installation¤

  1. Clone the git repository and navigate to that directory

  2. Install a virtual environment. We currently support python versions from 3.11 to 3.15.

    Using conda:

    conda create --name equine python==3.11
    conda activate equine
    

    Or, alternatively, using uv:

    uv venv --python 3.11
    source .venv/bin/activate
    
  3. Install the code with the dev extra (the test dependencies plus pre-commit and codespell)

    pip install -e .'[dev]'
    

    If you created the environment with uv, you can use uv pip instead:

    uv pip install -e '.[dev]'
    

    On Python 3.15, torch is published only on PyTorch's own package index until torch 2.15 reaches PyPI; install it from there first, e.g. pip install torch --index-url https://download.pytorch.org/whl/cpu. On macOS with Python 3.15, use torch >= 2.15 (torch 2.14 crashes there when used from several threads, and EQUINE warns at import); until it is released, use https://download.pytorch.org/whl/test/cpu, or for tox EQUINE_TORCH_INDEX=https://download.pytorch.org/whl/test/cpu tox -r -e py315 (-r rebuilds an environment that already has an older torch).

  4. Activate the pre-commit hooks

    pre-commit install
    pre-commit run
    

  5. For local testing, install tox (pip install tox).

    Optionally, also install tox-uv (pip install tox tox-uv) to have tox use uv to build its environments and install dependencies. This is drop-in (no tox config changes) and significantly faster — it's the same backend CI uses.

We prefer that any contributed code be outfitted with contracts from icontract and tested with hypothesis. This combination frequently means that the tests require few (if any) actual post-checks -- if the contracts are well-written, then hypothesis can generate reasonable tests that will explore the bounds of the contracts for each method. Assuming that tests pass, then make a pull request.

Continuous Integration¤

There are a number of Github Actions enabled to ensure high code quality upon commiting. * Tests must be added and all tests must pass (100%) before closing a pull request * Total coverage should be 97% or higher * We enforce a code style via ruff (formatting + linting, including import sorting) and codespell. If formatting issues are found, tox -e format usually fixes them automatically. * A job runs the suite with every dependency at the lowest version pyproject.toml allows (tox -e floors, which needs tox-uv). When code needs a newer release of a dependency, raise its floor. * A job type-checks src/ with pyright (tox -e pyright): it must report no errors, and the public API must keep a 100% type-completeness score. The test suite is not type-checked.

Documentation¤

In the MIT-LL Responsible AI GitHub organization, we use the numpy/scipy format for docstrings.

We use mkdocs to build our documentation and autodocumented API. Most of these files can be found in the docs folder, and the dependencies to generate your own version of the documentation can be installed via:

pip install -e .'[docs]'

You can test new documentation by issuing mkdocs serve from the root directory. Once it has built, you can check out the new documentation by connecting your browser to localhost:8000.