Contributor quickstart guide#

After getting the source code from GitHub, there are three steps to start contributing:

  1. Set up a development environment

    Using conda, or some flavor of the many virtual environment management tools, you can make sure the development version of SciPy does not interfere with any other local installations of SciPy on your machine.

  2. Build SciPy

    SciPy uses compiled code for speed, which means you might need extra dependencies to complete this step depending on your system.

  3. Perform development tasks

    These can include any changes you want to make to the source code, running tests, building the documentation, running benchmarks, etc.

Basic workflow#

Note

We strongly recommend using a virtual environment setup, such as venv or conda.

Since SciPy contains parts written in C, C++, and Fortran that need to be compiled before use, make sure you have the necessary compilers and Python development headers installed. If you are using conda, these will be installed automatically. If you are using pip, check which system-level dependencies you might need.

First, fork a copy of the main SciPy repository in GitHub onto your own account and then create your local repository via:

git clone git@github.com:YOURUSERNAME/scipy.git scipy
cd scipy
git submodule update --init
git remote add upstream https://github.com/scipy/scipy.git

Next, set up your development environment.

With conda installed (through Miniforge or Mambaforge, Miniconda or Anaconda), execute the following commands at the terminal from the base directory of your SciPy clone:

# Create an environment with all development dependencies
conda env create -f environment.yml  # works with `mamba` too
# Activate the environment
conda activate scipy-dev

Your command prompt now lists the name of your new environment, like so (scipy-dev)$.

With system-level dependencies installed, execute the following commands at the terminal from the base directory of your SciPy clone:

# Create the virtual environment
python -m venv scipy-dev
# Activate the environment
source $HOME/.venvs/scipy-dev/bin/activate
# Install python-level dependencies
python -m pip install numpy pytest cython pythran pybind11 meson ninja

Your command prompt now lists the name of your new environment, like so (scipy-dev)$.

Finally, build SciPy for development. On Linux and OSX, you should use:

python dev.py build

If you run into a build issue, or need more detailed build documentation including building on Windows, see Building from sources.

Otherwise, if the build has finished successfully, you should now be able to run the SciPy tests. You can run the full test suite running:

python dev.py test

Notice that this will take some time, so you might want to test only the part of SciPy you will be working on. For details on how to do that and a more complete setup walkthrough, see Development workflow.

Some of the tests in SciPy are very slow and need to be separately enabled. See The dev.py interface for details.

Other workflows#

This is only one possible way to set up your development environment out of many. For more detailed instructions, see the SciPy contributor guide.