Scanpy provides extensive developer documentation, most of which applies to this project, too. This document will not reproduce the entire content from there. Instead, it aims at summarizing the most important information to get you started on contributing.
We assume that you are already familiar with git and with making pull requests on GitHub. If not, please refer to the scanpy developer guide.
Installing dev dependencies#
In addition to the packages needed to use this package, you need additional python packages to run tests and build
the documentation. It’s easy to install them using
pip install -e ".[dev,test,doc]"
This package uses pre-commit to enforce consistent code-styles. On every commit, pre-commit checks will either automatically fix issues with the code, or raise an error message.
To enable pre-commit locally, simply run
in the root of the repository. Pre-commit will automatically download all dependencies when it is run for the first time.
Alternatively, you can rely on the pre-commit.ci service enabled on GitHub. If you didn’t run
pushing changes to GitHub it will automatically commit fixes to your pull request, or show an error message.
If pre-commit.ci added a commit on a branch you still have been working on locally, simply use
git pull --rebase
to integrate the changes into yours. While the pre-commit.ci is useful, we strongly encourage installing and running pre-commit locally first to understand its usage.
Remember to first install the package with
pip install '-e[dev,test]'
Most IDEs integrate with pytest and provide a GUI to run tests. Alternatively, you can run all tests from the command line by executing
in the root of the repository.
Continuous integration will automatically run the tests on all pull requests and test against the minimum and maximum supported Python version.
Additionally, there’s a CI job that tests against pre-releases of all dependencies (if there are any). The purpose of this check is to detect incompatibilities of new package versions early on and gives you time to fix the issue or reach out to the developers of the dependency before the package is released to a wider audience.
Publishing a release#
Updating the version number#
Scirpy uses hatch-vcs to automaticlly retrieve the version number from the git tag. To make a new release, navigate to the “Releases” page of this project on GitHub. Specify vX.X.X as a tag name and create a release. For more information, see managing GitHub releases. This will automatically create a git tag and trigger a Github workflow that creates a release on PyPI.
Please write documentation for new or changed features and use-cases. This project uses sphinx with the following features:
the myst extension allows to write documentation in markdown/Markedly Structured Text
Sphinx autodoc typehints, to automatically reference annotated input and output types
See the scanpy developer docs for more information on how to write documentation.
Tutorials with myst-nb and jupyter notebooks#
The documentation is set-up to render jupyter notebooks stored in the
docs/notebooks directory using myst-nb.
Currently, only notebooks in
.ipynb format are supported that will be included with both their input and output cells.
It is your reponsibility to update and re-run the notebook whenever necessary.
If you are interested in automatically running notebooks as part of the continuous integration, please check
out this feature request in the
If you refer to objects from other packages, please add an entry to
docs/conf.py. Only if you do so can sphinx automatically create a link to the external documentation.
If building the documentation fails because of a missing link that is outside your control, you can add an entry to the
Building the docs locally#