Contributing to scikit-sparse

Thank you for your interest in contributing! This project uses a hybrid development environment consisting of Mamba (or Conda, for C-libraries and the Python interpreter) and uv (for Python package management).

Prerequisites

Ensure you have the following installed:

Setting Up the Development Environment

We use Mamba to provide the SuiteSparse C-libraries and the C++ compiler.

Create the Environment

From the project root, run:

mamba env create -f environment.yml
mamba activate sksparse-dev

Install scikit-sparse (Editable)

We use uv to install the Python dependencies and compile the Cython extensions. This command installs the project in “editable” mode along with all development tools (pytest, ruff, sphinx).

uv pip install -e ".[dev]"

Note

If the install fails to find SuiteSparse headers, ensure your CONDA_PREFIX is set correctly (echo $CONDA_PREFIX). Our setup.py is configured to prioritize this path.

Development Workflow

New features, bug fixes, and documentation improvements should be developed in a separate branch off of the dev branch (e.g. feature/my-new-feature). Once your changes are ready, submit a pull request for review. Follow the NumPy/SciPy contribution guidelines for best practices on documentation and commit messages.

Code Linting and Formatting

We use ruff for linting. It is installed as part of the [dev] dependencies. It runs automatically on pre-commit, but you can also run it manually:

ruff check .

Running Tests

We use pytest for all unit tests.

pytest

Rebuilding Extensions

If you modify .pyx or .pxd files, you must re-run the uv install command to trigger a re-compilation of the Cython extensions:

uv pip install -e ".[dev]"

Building Documentation

The documentation is built using Sphinx and the Furo theme.

cd doc
make html

The results will be available in doc/_build/html/index.html.

Benchmarks

We use asv for benchmarking. See the ./benchmarks/ directory. To run the benchmarks, run the following command from the project root:

asv run

See also the SciPy benchmark guidelines for best practices on writing benchmarks. We do not use spin, so refer to the asv commands therein.