Skip to content

For Developers

This guide is for developers who want to contribute to InstaNovo or set up a development environment.

InstaNovo is built for Python >=3.10, <3.14 and tested on Linux, Windows and macOS.

Setting up with uv

This project uses uv to manage Python dependencies.

  1. Install uv: If you don't have uv installed, follow the official installation instructions.

  2. Fork and clone the repository:

    git clone https://github.com/YOUR-USERNAME/InstaNovo.git
    cd InstaNovo
    
  3. Install dependencies:

    If you have an NVIDIA GPU:

    uv sync --extra cu126
    uv run pre-commit install
    

    If you are on a CPU-only, or macOS machine:

    uv sync --extra cpu
    uv run pre-commit install
    

    To also install the documentation dependencies:

    uv sync --extra cu126 --group docs
    
  4. Activate the virtual environment:

    source .venv/bin/activate
    

Metal Performance Shaders

InstaNovo now has support for Metal Performance Shaders (MPS) for Apple silicon devices. If you would like to use InstaNovo with MPS, please set mps to True in the configuration files (instanovo/configs/) and set the environment variable:

PYTORCH_ENABLE_MPS_FALLBACK=1

This allows the CPU to be used for functionality not yet supported on MPS.

Development workflows

Testing

InstaNovo uses pytest for testing.

  1. Download test data:

    uv run instanovo/scripts/get_zenodo_record.py
    
  2. Run tests:

    python -m pytest --cov-report=html --cov --random-order --verbose .
    
  3. View coverage report:

    python -m coverage report -m
    

Linting

We use pre-commit hooks to maintain code quality. To run the linters on all files:

pre-commit run --all-files

Building the documentation

To build and serve the documentation locally:

uv sync --extra cu126 --group docs
git config --global --add safe.directory "$(dirname "$(pwd)")"
rm -rf docs/API
python ./docs/gen_ref_nav.py
mkdocs build --verbose --site-dir docs_public
mkdocs serve