Skip to content

Commit f7a8b06

Browse files
authored
Merge branch 'master' into dask-utils
2 parents 23eeb46 + abbee76 commit f7a8b06

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+529
-254
lines changed

.github/workflows/publish.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Publish Python Package
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
publish:
9+
runs-on: ubuntu-latest
10+
environment: pypi
11+
permissions:
12+
id-token: write # to authenticate as Trusted Publisher to pypi.org
13+
steps:
14+
- uses: actions/checkout@v3
15+
- uses: actions/setup-python@v4
16+
with:
17+
python-version: "3.x"
18+
cache: "pip"
19+
- run: pip install build
20+
- run: python -m build
21+
- uses: pypa/gh-action-pypi-publish@release/v1

.pre-commit-config.yaml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
repos:
2-
- repo: https://github.com/psf/black
3-
rev: 23.10.0
4-
hooks:
5-
- id: black
62
- repo: https://github.com/astral-sh/ruff-pre-commit
7-
rev: v0.1.1
3+
rev: v0.1.3
84
hooks:
95
- id: ruff
106
args: ["--fix"]
7+
- id: ruff-format
118
- repo: https://github.com/pre-commit/pre-commit-hooks
129
rev: v4.5.0
1310
hooks:

docs/conf.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ def setup(app: Sphinx):
179179
# -- Suppress link warnings ----------------------------------------------------
180180

181181
qualname_overrides = {
182-
"sklearn.neighbors._dist_metrics.DistanceMetric": "sklearn.neighbors.DistanceMetric",
182+
"sklearn.neighbors._dist_metrics.DistanceMetric": "sklearn.metrics.DistanceMetric",
183183
# If the docs are built with an old version of numpy, this will make it work:
184184
"numpy.random.RandomState": "numpy.random.mtrand.RandomState",
185185
"scanpy.plotting._matrixplot.MatrixPlot": "scanpy.pl.MatrixPlot",
@@ -192,8 +192,10 @@ def setup(app: Sphinx):
192192
# Will probably be documented
193193
("py:class", "scanpy._settings.Verbosity"),
194194
("py:class", "scanpy.neighbors.OnFlySymMatrix"),
195-
# Currently undocumented: https://github.com/mwaskom/seaborn/issues/1810
195+
# Currently undocumented
196+
# https://github.com/mwaskom/seaborn/issues/1810
196197
("py:class", "seaborn.ClusterGrid"),
198+
("py:class", "samalg.SAM"),
197199
# Won’t be documented
198200
("py:class", "scanpy.plotting._utils._AxesSubplot"),
199201
("py:class", "scanpy._utils.Empty"),

docs/dev/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ getting-set-up
1111
testing
1212
documentation
1313
ci
14-
release
1514
versioning
15+
release
1616
```
1717

1818
Parts of the guidelines have been adapted from the [pandas](https://pandas.pydata.org/pandas-docs/stable/development/index.html) and [MDAnalysis](https://userguide.mdanalysis.org/stable/contributing.html) guides.

docs/dev/release.md

Lines changed: 48 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,70 @@
11
# Making a release
22

3-
This is a guide on how to make a release of scanpy for maintainers.
3+
First, check out {doc}`versioning` to see which kind of release you want to make.
4+
That page also explains concepts like *pre-releases* and applications thereof.
45

5-
## Checking that PyPI will accept it
6+
## Actually making the release
67

7-
Sometimes PyPI will reject a build.
8-
You can locally check whether the build is acceptable with `twine check`.
8+
1. Go to GitHub’s [releases][] page
9+
2. Click “Draft a new release”
10+
3. Click “Choose a tag” and type the version of the tag you want to release, such as `1.9.6`
11+
4. Click “**+ Create new tag: 1.\<minor>.\<patch>** on publish”
12+
5. If the version is a *pre-release* version, such as `1.7.0rc1` or `1.10.0a1`, tick the “Set as a pre-release” checkbox
913

10-
```shell
11-
# First, make a build
12-
python -m build
14+
[releases]: https://github.com/scverse/scanpy/releases
1315

14-
# Now check that build
15-
twine check dist/* # Assuming dist is otherwise empty
16-
```
16+
## After making a release
1717

18-
## Actually making release
18+
After *any* release has been made:
1919

20-
First, make sure you're working repository is clean and is on the commit you'd like to release from.
21-
Then follow these steps:
20+
- Create a new release notes file for the next bugfix release.
21+
This should be included in both dev and stable branches.
22+
- Create a milestone for the next release (in case you made a bugfix release) or releases (in case of a major/minor release).
23+
For bugfix releases, this should have `on-merge: backport to 0.<minor>.x`,
24+
so the [meeseeksdev][] bot will create a backport PR. See {doc}`versioning` for more info.
25+
- Clear out and close the milestone you just made a release for.
2226

23-
```shell
24-
# Tag the commit with version info
25-
git tag {version} # where version is a version number like "1.7.0"
27+
After a *major* or *minor* release has been made:
28+
29+
- Tweet about it! Announce it on Zulip! Announce it on Discourse! Think about making a bot for this! Maybe actually do that?
30+
- Create a new release notes file for the next minor release. This should only be added to the dev branch.
31+
- Tag the development branch. If you just released `1.7.0`, this would be `1.8.0.dev0`.
32+
- Create a new branch for this release series, like `1.7.x`. This should get a new release notes file.
33+
34+
[meeseeksdev]: https://meeseeksbox.github.io
35+
36+
## Debugging the build process
37+
38+
If you changed something about the build process (e.g. [Hatchling’s build configuration][hatch-build]),
39+
or something about the package’s structure,
40+
you might want to manually check if the build and upload process behaves as expected:
2641

42+
```shell
2743
# Clear out old distributions
2844
rm -r dist
2945

30-
# Build distributions and wheel
46+
# Build source distribution and wheel both
3147
python -m build
32-
# you can check that the previous step worked by installing from it's results
33-
# e.g. pip install dist/scanpy-{version}-py3-none-any.whl
34-
35-
# Once you're confident the build looks good, push the tag to github
36-
git push upstream {version}
37-
38-
# Upload wheel and code distribution to pypi
39-
twine upload dist/scanpy-{version}
40-
```
4148

42-
### Checking the distributions
49+
# Now check those build artifacts
50+
twine check dist/*
4351

44-
If you're feeling cautious, you can:
52+
# List the wheel archive’s contents
53+
bsdtar -tf dist/*.whl
4554

46-
- List the contents of a wheel with: `unzip -l dist/*.whl`
47-
- Make a release candidate. Tag these with `{version}rc1` (e.g. `1.7.0rc1`)
48-
- Upload them to <test.pypi.org> ([tutorial](https://packaging.python.org/en/latest/tutorials/packaging-projects/#uploading-the-distribution-archives))
55+
```
4956

50-
## After making a release
57+
You can also upload the package to <test.pypi.org> ([tutorial][testpypi tutorial])
5158

52-
After a major or minor release has been made:
59+
[testpypi tutorial]: https://packaging.python.org/en/latest/tutorials/packaging-projects/#uploading-the-distribution-archives
5360

54-
- Tweet about it! Announce it on Zulip! Announce it on Discourse! Think about making a bot for this! Maybe actually do that?
55-
- Create a new release notes file for the next minor release. This should only be added to the dev branch.
56-
- Tag the development branch. If you just released `1.7.0`, this would be `1.8.0.dev0`.
57-
- Create a new branch for this release series, like `1.7.x`. This should get a new release notes file.
61+
```
62+
twine upload --repository testpypi dist/*
63+
```
5864

59-
After any release has been made:
65+
The above approximates what the [publish workflow][] does automatically for us.
66+
If you want to replicate the process more exactly, make sure you are careful,
67+
and create a version tag before building (make sure you delete it after uploading to TestPyPI!).
6068

61-
- Create a new release notes file for the next bugfix release. This should be included in both dev and stable branches `release-latest.md`
62-
- Create a milestone for the next release(s). For bugfix releases, this should have `on-merge: backport to 0.8.x` so [meeseeksdev](https://meeseeksbox.github.io) bot will create a backport PR. See {doc}`versioning` for more info.
69+
[hatch-build]: https://hatch.pypa.io/latest/config/build/
70+
[publish workflow]: https://github.com/scverse/scanpy/tree/master/.github/workflows/publish.yml

docs/dev/versioning.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@ At a `point` release, there should be no changes beyond bug fixes.
1717

1818
Valid version numbers are described in [PEP 440](https://peps.python.org/pep-0440/).
1919

20-
[Release candidates](https://peps.python.org/pep-0440/#pre-releases) should have versions like `1.7.0rc1`, `1.7.0rc2`.
21-
[Development versions](https://peps.python.org/pep-0440/#developmental-releases) should look like `1.8.0.dev0`, with a commit hash optionally appended as a local version identifier (e.g. `1.8.0.dev2+g00ad77b`).
20+
[Pre-releases](https://peps.python.org/pep-0440/#pre-releases)
21+
: should have versions like `1.7.0rc1` or `1.7.0rc2`.
22+
[Development versions](https://peps.python.org/pep-0440/#developmental-releases)
23+
: should look like `1.8.0.dev0`, with a commit hash optionally appended as a local version identifier (e.g. `1.8.0.dev2+g00ad77b`).
2224

2325
## Tooling
2426

docs/extensions/typed_returns.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ def process_return(lines):
1616

1717
def scanpy_parse_returns_section(self, section):
1818
lines_raw = list(process_return(self._dedent(self._consume_to_next_section())))
19+
if lines_raw[0] == ":":
20+
# Remove the “:” inserted by sphinx-autodoc-typehints
21+
# https://github.com/tox-dev/sphinx-autodoc-typehints/blob/a5c091f725da8374347802d54c16c3d38833d41c/src/sphinx_autodoc_typehints/patches.py#L66
22+
lines_raw.pop(0)
1923
lines = self._format_block(":returns: ", lines_raw)
2024
if lines and lines[-1]:
2125
lines.append("")

docs/release-notes/1.10.0.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,15 @@
1414

1515
```{rubric} Docs
1616
```
17+
* Fixed a lot of broken usage examples {pr}`2605` {smaller}`P Angerer`
1718

1819
```{rubric} Bug fixes
1920
```
2021

2122
* Updated {func}`~scanpy.read_visium` such that it can read spaceranger 2.0 files {smaller}`L Lehner`
2223
* Fix {func}`~scanpy.pp.normalize_total` {pr}`2466` {smaller}`P Angerer`
2324
* Fix testing package build {pr}`2468` {smaller}`P Angerer`
24-
25+
* Fix setting `sc.settings.verbosity` in some cases {pr}`2605` {smaller}`P Angerer`
2526

2627
```{rubric} Ecosystem
2728
```

docs/release-notes/1.9.6.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
### 1.9.6 {small}`the future`
1+
### 1.9.6 {small}`2023-10-31`
22

33
```{rubric} Bug fixes
44
```
@@ -8,3 +8,4 @@
88
- Fix {func}`scanpy.pl.pca` when `return_fig=True` and `annotate_var_explained=True` {pr}`2682` {smaller}`J Wagner`
99
- Temp fix for {issue}`2680` by skipping `seaborn` version 0.13.0 {pr}`2661` {smaller}`P Angerer`
1010
- Fix {func}`scanpy.pp.highly_variable_genes` to not modify the used layer when `flavor=seurat` {pr}`2698` {smaller}`E Roellin`
11+
- Prevent pandas from causing infinite recursion when setting a slice of a categorical column {pr}`2719` {smaller}`P Angerer`

docs/release-notes/1.9.7.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
### 1.9.7 {small}`the future`
2+
3+
```{rubric} Bug fixes
4+
```

0 commit comments

Comments
 (0)