Development Guidelines


  1. Clone this repository with git:

git clone
cd xarray_extras
  1. Install anaconda or miniconda (OS-dependent)

  2. conda env create -n xarray_extras --file ci/requirements.yml
    conda activate xarray_extras
  3. Install C compilation stack:

    conda install gcc_linux-64
    conda install clang_osx-64

    You need to manually install the Microsoft C compiler tools. Refer to CPython documentation.

To keep a fork in sync with the upstream source:

cd xarray_extras
git remote add upstream
git remote -v
git fetch -a upstream
git checkout main
git pull upstream main
git push origin main


Test using py.test:

python build_ext --inplace
py.test xarray_extras

Code Formatting

xarray_extras uses several code linters (flake8, black, isort, pyupgrade, mypy), which are enforced by CI. Developers should run them locally before they submit a PR, through the single command

pre-commit run --all-files

This makes sure that linter versions and options are aligned for all developers.

Optionally, you may wish to setup the pre-commit hooks to run automatically when you make a git commit. This can be done by running:

pre-commit install

from the root of the xarray_extras repository. Now the code linters will be run each time you commit changes. You can skip these checks with git commit --no-verify or with the short version git commit -n.