1
1
# Contributing guide
2
2
3
3
Scanpy provides extensive [ developer documentation] [ scanpy developer guide ] , most of which applies to this project, too.
4
- This document will not reproduce the entire content from there. Instead, it aims at summarizing the most important
5
- information to get you started on contributing.
4
+ This document will not reproduce the entire content from there.
5
+ Instead, it aims at summarizing the most important information to get you started on contributing.
6
6
7
- We assume that you are already familiar with git and with making pull requests on GitHub. If not, please refer
8
- to the [ scanpy developer guide] [ ] .
7
+ We assume that you are already familiar with git and with making pull requests on GitHub.
8
+ If not, please refer to the [ scanpy developer guide] [ ] .
9
+
10
+ [ scanpy developer guide ] : https://scanpy.readthedocs.io/en/latest/dev/index.html
9
11
10
12
## Installing dev dependencies
11
13
@@ -27,6 +29,8 @@ source .venv/bin/activate
27
29
pip install -e " .[dev,test,doc]"
28
30
```
29
31
32
+ [ hatch environments ] : https://hatch.pypa.io/latest/tutorials/environment/basic-usage/
33
+
30
34
## Code-style
31
35
32
36
This package uses [ pre-commit] [ ] to enforce consistent code-styles.
@@ -41,10 +45,11 @@ To enable pre-commit locally, simply run
41
45
pre-commit install
42
46
```
43
47
44
- in the root of the repository. Pre-commit will automatically download all dependencies when it is run for the first time.
48
+ in the root of the repository.
49
+ Pre-commit will automatically download all dependencies when it is run for the first time.
45
50
46
- Alternatively, you can rely on the [ pre-commit.ci] [ ] service enabled on GitHub. If you didn't run ` pre-commit ` before
47
- pushing changes to GitHub it will automatically commit fixes to your pull request, or show an error message.
51
+ Alternatively, you can rely on the [ pre-commit.ci] [ ] service enabled on GitHub.
52
+ If you didn't run ` pre-commit ` before pushing changes to GitHub it will automatically commit fixes to your pull request, or show an error message.
48
53
49
54
If pre-commit.ci added a commit on a branch you still have been working on locally, simply use
50
55
@@ -55,15 +60,21 @@ git pull --rebase
55
60
to integrate the changes into yours.
56
61
While the [ pre-commit.ci] [ ] is useful, we strongly encourage installing and running pre-commit locally first to understand its usage.
57
62
58
- Finally, most editors have an _ autoformat on save_ feature. Consider enabling this option for [ ruff] [ ruff-editors ]
59
- and [ prettier] [ prettier-editors ] .
63
+ Finally, most editors have an _ autoformat on save_ feature.
64
+ Consider enabling this option for [ ruff] [ ruff-editors ] and [ prettier] [ prettier-editors ] .
65
+
66
+ [ pre-commit ] : https://pre-commit.com/
67
+ [ pre-commit.ci ] : https://pre-commit.ci/
68
+ [ ruff-editors ] : https://docs.astral.sh/ruff/integrations/
69
+
70
+ [ prettier-editors ] : https://prettier.io/docs/en/editors.html
60
71
61
72
(writing-tests)=
62
73
63
74
## Writing tests
64
75
65
- This package uses the [ pytest] [ ] for automated testing. Please {doc} ` scanpy:dev/testing ` for every function added
66
- to the package.
76
+ This package uses the [ pytest] [ ] for automated testing.
77
+ Please {doc} ` scanpy:dev/testing ` for every function added to the package.
67
78
68
79
Most IDEs integrate with pytest and provide a GUI to run tests.
69
80
Just point yours to one of the environments returned by
@@ -83,63 +94,78 @@ hatch test --all # test with all supported Python versions
83
94
84
95
in the root of the repository.
85
96
97
+ [ pytest ] : https://docs.pytest.org/
98
+
86
99
### Continuous integration
87
100
88
101
Continuous integration will automatically run the tests on all pull requests and test
89
102
against the minimum and maximum supported Python version.
90
103
91
- Additionally, there's a CI job that tests against pre-releases of all dependencies
92
- (if there are any). The purpose of this check is to detect incompatibilities
93
- of new package versions early on and gives you time to fix the issue or reach
94
- out to the developers of the dependency before the package is released to a wider audience.
104
+ Additionally, there's a CI job that tests against pre-releases of all dependencies (if there are any).
105
+ The purpose of this check is to detect incompatibilities of new package versions early on and
106
+ 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.
95
107
96
108
## Publishing a release
97
109
98
110
### Updating the version number
99
111
100
- Before making a release, you need to update the version number in the ` pyproject.toml ` file. Please adhere to [ Semantic Versioning] [ semver ] , in brief
112
+ Before making a release, you need to update the version number in the ` pyproject.toml ` file.
113
+ Please adhere to [ Semantic Versioning] [ semver ] , in brief
101
114
102
115
> Given a version number MAJOR.MINOR.PATCH, increment the:
103
116
>
104
- > 1 . MAJOR version when you make incompatible API changes,
105
- > 2 . MINOR version when you add functionality in a backwards compatible manner, and
106
- > 3 . PATCH version when you make backwards compatible bug fixes.
117
+ > 1 . MAJOR version when you make incompatible API changes,
118
+ > 2 . MINOR version when you add functionality in a backwards compatible manner, and
119
+ > 3 . PATCH version when you make backwards compatible bug fixes.
107
120
>
108
121
> Additional labels for pre-release and build metadata are available as extensions to the MAJOR.MINOR.PATCH format.
109
122
110
123
Once you are done, commit and push your changes and navigate to the "Releases" page of this project on GitHub.
111
- Specify ` vX.X.X ` as a tag name and create a release. For more information, see [ managing GitHub releases] [ ] .
124
+ Specify ` vX.X.X ` as a tag name and create a release.
125
+ For more information, see [ managing GitHub releases] [ ] .
112
126
This will automatically create a git tag and trigger a Github workflow that creates a release on [ PyPI] [ ] .
113
127
128
+ [ semver ] : https://semver.org/
129
+ [ managing GitHub releases ] : https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository
130
+ [ pypi ] : https://pypi.org/
131
+
114
132
## Writing documentation
115
133
116
- Please write documentation for new or changed features and use-cases. This project uses [ sphinx] [ ] with the following features:
134
+ Please write documentation for new or changed features and use-cases.
135
+ This project uses [ sphinx] [ ] with the following features:
117
136
118
- - the [ myst] [ ] extension allows to write documentation in markdown/Markedly Structured Text
137
+ - The [ myst] [ ] extension allows to write documentation in markdown/Markedly Structured Text
119
138
- [ Numpy-style docstrings] [ numpydoc ] (through the [ napoloen] [ numpydoc-napoleon ] extension).
120
139
- Jupyter notebooks as tutorials through [ myst-nb] [ ] (See [ Tutorials with myst-nb] ( #tutorials-with-myst-nb-and-jupyter-notebooks ) )
121
- - [ Sphinx autodoc typehints] [ ] , to automatically reference annotated input and output types
140
+ - [ sphinx- autodoc- typehints] [ ] , to automatically reference annotated input and output types
122
141
- Citations (like {cite: p }` Virshup_2023 ` ) can be included with [ sphinxcontrib-bibtex] ( https://sphinxcontrib-bibtex.readthedocs.io/ )
123
142
124
- See the [ scanpy developer docs] ( https://scanpy.readthedocs.io/en/latest/dev/documentation.html ) for more information
125
- on how to write documentation.
143
+ See the {doc}` scanpy:dev/documentation ` for more information on how to write documentation.
144
+
145
+ [ sphinx ] : https://www.sphinx-doc.org/en/master/
146
+ [ myst ] : https://myst-parser.readthedocs.io/en/latest/intro.html
147
+ [ myst-nb ] : https://myst-nb.readthedocs.io/en/latest/
148
+ [ numpydoc-napoleon ] : https://www.sphinx-doc.org/en/master/usage/extensions/napoleon.html
149
+ [ numpydoc ] : https://numpydoc.readthedocs.io/en/latest/format.html
150
+ [ sphinx-autodoc-typehints ] : https://github.com/tox-dev/sphinx-autodoc-typehints
126
151
127
152
### Tutorials with myst-nb and jupyter notebooks
128
153
129
154
The documentation is set-up to render jupyter notebooks stored in the ` docs/notebooks ` directory using [ myst-nb] [ ] .
130
155
Currently, only notebooks in ` .ipynb ` format are supported that will be included with both their input and output cells.
131
156
It is your responsibility to update and re-run the notebook whenever necessary.
132
157
133
- If you are interested in automatically running notebooks as part of the continuous integration, please check
134
- out [ this feature request] ( https://github.com/scverse/cookiecutter-scverse/issues/40 ) in the ` cookiecutter-scverse `
135
- repository.
158
+ If you are interested in automatically running notebooks as part of the continuous integration,
159
+ please check out [ this feature request] [ issue-render-notebooks ] in the ` cookiecutter-scverse ` repository.
160
+
161
+ [ issue-render-notebooks ] : https://github.com/scverse/cookiecutter-scverse/issues/40
136
162
137
163
#### Hints
138
164
139
- - If you refer to objects from other packages, please add an entry to ` intersphinx_mapping ` in ` docs/conf.py ` . Only
140
- if you do so can sphinx automatically create a link to the external documentation.
141
- - If building the documentation fails because of a missing link that is outside your control, you can add an entry to
142
- the ` nitpick_ignore ` list in ` docs/conf.py `
165
+ - If you refer to objects from other packages, please add an entry to ` intersphinx_mapping ` in ` docs/conf.py ` .
166
+ Only if you do so can sphinx automatically create a link to the external documentation.
167
+ - If building the documentation fails because of a missing link that is outside your control,
168
+ you can add an entry to the ` nitpick_ignore ` list in ` docs/conf.py `
143
169
144
170
(docs-building)=
145
171
@@ -149,27 +175,3 @@ repository.
149
175
hatch docs:build
150
176
hatch docs:open
151
177
```
152
-
153
- <!-- Links -->
154
-
155
- [ scanpy developer guide ] : https://scanpy.readthedocs.io/en/latest/dev/index.html
156
- [ hatch environments ] : https://hatch.pypa.io/latest/tutorials/environment/basic-usage/
157
- [ cookiecutter-scverse-instance ] : https://cookiecutter-scverse-instance.readthedocs.io/en/latest/template_usage.html
158
- [ github quickstart guide ] : https://docs.github.com/en/get-started/quickstart/create-a-repo?tool=webui
159
- [ codecov ] : https://about.codecov.io/sign-up/
160
- [ codecov app ] : https://github.com/apps/codecov
161
- [ pre-commit.ci ] : https://pre-commit.ci/
162
- [ pre-commit ] : https://pre-commit.com/
163
- [ ruff-editors ] : https://docs.astral.sh/ruff/integrations/
164
- [ prettier-editors ] : https://prettier.io/docs/en/editors.html
165
- [ pytest ] : https://docs.pytest.org/
166
- [ semver ] : https://semver.org/
167
- [ readthedocs.org ] : https://readthedocs.org/
168
- [ sphinx ] : https://www.sphinx-doc.org/en/master/
169
- [ myst ] : https://myst-parser.readthedocs.io/en/latest/intro.html
170
- [ myst-nb ] : https://myst-nb.readthedocs.io/en/latest/
171
- [ numpydoc-napoleon ] : https://www.sphinx-doc.org/en/master/usage/extensions/napoleon.html
172
- [ numpydoc ] : https://numpydoc.readthedocs.io/en/latest/format.html
173
- [ sphinx autodoc typehints ] : https://github.com/tox-dev/sphinx-autodoc-typehints
174
- [ pypi ] : https://pypi.org/
175
- [ managing GitHub releases ] : https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository
0 commit comments