Skip to content

Commit

Permalink
Fix heading anchors in relnotes (#1605)
Browse files Browse the repository at this point in the history
  • Loading branch information
flying-sheep authored Aug 23, 2024
1 parent 0c459a0 commit 07ca87c
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 13 deletions.
8 changes: 6 additions & 2 deletions .azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@ jobs:
path: $(uv_cache_dir)
displayName: Cache pip packages

- script: uv pip install --system --compile "anndata[dev,test] @ ."
# This prevents broken and slow back-tracking in dependency resolution
- script: printf "llvmlite>=0.43\nscanpy>=1.10.0rc1" | tee /tmp/constraints.txt
displayName: "Create constraints file for `pre-release` and `latest` jobs"

- script: uv pip install --system --compile "anndata[dev,test] @ ." -c /tmp/constraints.txt
displayName: "Install dependencies"
condition: eq(variables['DEPENDENCIES_VERSION'], 'latest')

Expand All @@ -61,7 +65,7 @@ jobs:
displayName: "Install minimum dependencies"
condition: eq(variables['DEPENDENCIES_VERSION'], 'minimum')
- script: uv pip install -v --system --compile --pre "anndata[dev,test] @ ." "scanpy>=1.10.0rc1"
- script: uv pip install -v --system --compile --pre "anndata[dev,test] @ ." -c /tmp/constraints.txt
displayName: "Install dependencies release candidates"
condition: eq(variables['DEPENDENCIES_VERSION'], 'pre-release')

Expand Down
6 changes: 2 additions & 4 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"tutorials/notebooks/*.rst",
# exclude all 0.x.y.md files, but not index.md
"release-notes/[!i]*.md",
"news.md", # is `include`d into index.md
]
pygments_style = "sphinx"

Expand All @@ -62,6 +63,7 @@
"IPython.sphinxext.ipython_console_highlighting",
"patch_sphinx_toolbox_autoprotocol",
"sphinx_toolbox.more_autodoc.autoprotocol",
"patch_myst_cite",
]
myst_enable_extensions = [
"html_image", # So README.md can be used on github and sphinx docs
Expand Down Expand Up @@ -109,10 +111,6 @@
("py:class", "anndata._core.sparse_dataset.BaseCompressedSparseDataset"),
("py:obj", "numpy._typing._array_like._ScalarType_co"),
]
suppress_warnings = [
"ref.citation",
"myst.header", # https://github.com/executablebooks/MyST-Parser/issues/262
]


def setup(app: Sphinx):
Expand Down
33 changes: 33 additions & 0 deletions docs/extensions/patch_myst_cite.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
"""Override MyST’s cite role with one that works."""

from __future__ import annotations

from types import MappingProxyType
from typing import TYPE_CHECKING

from docutils import nodes, utils

if TYPE_CHECKING:
from collections.abc import Mapping, Sequence
from typing import Any

from docutils.parsers.rst.states import Inliner
from sphinx.application import Sphinx


def cite_role( # noqa: PLR0917
name: str,
rawsource: str,
text: str,
lineno: int,
inliner: Inliner,
options: Mapping[str, Any] = MappingProxyType({}),
content: Sequence[str] = (),
) -> tuple[list[nodes.Node], list[nodes.system_message]]:
key = utils.unescape(text)
node = nodes.citation_reference(f"[{key}]_", key)
return [node], []


def setup(app: Sphinx):
app.add_role("cite", cite_role, override=True)
2 changes: 1 addition & 1 deletion docs/news.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Muon paper published {small}`2022-02-02`

Muon has been published in Genome Biology [Bredikhin22]_.
Muon has been published in Genome Biology {cite}`Bredikhin22`.
Muon is a framework for multimodal data built on top of `AnnData`.

Check out [Muon](https://muon.readthedocs.io/en/latest/) and its datastructure [MuData](https://mudata.readthedocs.io/en/latest/).
Expand Down
4 changes: 0 additions & 4 deletions docs/references.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,3 @@ References
Murphy (2012,
*Machine Learning: A Probabilistic Perspective*,
MIT Press https://mitpress.mit.edu/9780262018029/machine-learning/.
.. [Wolf18] Wolf *et al.* (2018),
*Scanpy: large-scale single-cell gene expression data analysis*,
Genome Biology https://doi.org/10.1186/s13059-017-1382-0.
2 changes: 1 addition & 1 deletion docs/release-notes/0.10.8.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(0.10.8)=
(v0.10.8)=
### 0.10.8 {small}`2024-06-20`

#### Bugfix
Expand Down
2 changes: 1 addition & 1 deletion docs/release-notes/0.10.9.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(0.10.9)=
(v0.10.9)=
### 0.10.9 {small}`the future`

#### Bugfix
Expand Down

0 comments on commit 07ca87c

Please sign in to comment.