From d1610be8bc2389d11eb0fce3747eec162886b1e8 Mon Sep 17 00:00:00 2001
From: "Philipp A." <flying-sheep@web.de>
Date: Fri, 23 Aug 2024 09:31:23 +0200
Subject: [PATCH 1/5] Fix heading anchors in relnotes

---
 docs/release-notes/0.10.8.md | 2 +-
 docs/release-notes/0.10.9.md | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/docs/release-notes/0.10.8.md b/docs/release-notes/0.10.8.md
index 1093d2288..324c9d571 100644
--- a/docs/release-notes/0.10.8.md
+++ b/docs/release-notes/0.10.8.md
@@ -1,4 +1,4 @@
-(0.10.8)=
+(v0.10.8)=
 ### 0.10.8 {small}`2024-06-20`
 
 #### Bugfix
diff --git a/docs/release-notes/0.10.9.md b/docs/release-notes/0.10.9.md
index 6245978f8..55948a2a1 100644
--- a/docs/release-notes/0.10.9.md
+++ b/docs/release-notes/0.10.9.md
@@ -1,4 +1,4 @@
-(0.10.9)=
+(v0.10.9)=
 ### 0.10.9 {small}`the future`
 
 #### Bugfix

From 1992684cadeb69d116b3d1ff2d6d07ab631ac3e8 Mon Sep 17 00:00:00 2001
From: "Philipp A." <flying-sheep@web.de>
Date: Fri, 23 Aug 2024 09:47:30 +0200
Subject: [PATCH 2/5] Fix references

---
 docs/conf.py                       |  6 ++----
 docs/extensions/patch_myst_cite.py | 33 ++++++++++++++++++++++++++++++
 docs/news.md                       |  2 +-
 docs/references.rst                |  4 ----
 4 files changed, 36 insertions(+), 9 deletions(-)
 create mode 100644 docs/extensions/patch_myst_cite.py

diff --git a/docs/conf.py b/docs/conf.py
index c774315d4..a0e338006 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -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"
 
@@ -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
@@ -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):
diff --git a/docs/extensions/patch_myst_cite.py b/docs/extensions/patch_myst_cite.py
new file mode 100644
index 000000000..3b8afd34a
--- /dev/null
+++ b/docs/extensions/patch_myst_cite.py
@@ -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)
diff --git a/docs/news.md b/docs/news.md
index d68fc74d4..a6faab17e 100644
--- a/docs/news.md
+++ b/docs/news.md
@@ -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/).
diff --git a/docs/references.rst b/docs/references.rst
index 86427809f..5da6d4cd9 100644
--- a/docs/references.rst
+++ b/docs/references.rst
@@ -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.

From dad4418069e089b0c0e84d9544b7e080169602be Mon Sep 17 00:00:00 2001
From: "Philipp A." <flying-sheep@web.de>
Date: Fri, 23 Aug 2024 10:06:25 +0200
Subject: [PATCH 3/5] constraints

---
 .azure-pipelines.yml | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml
index 05b420d93..6b67b16a7 100644
--- a/.azure-pipelines.yml
+++ b/.azure-pipelines.yml
@@ -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: echo "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] @ ." -r /tmp/constraints.txt
         displayName: "Install dependencies"
         condition: eq(variables['DEPENDENCIES_VERSION'], 'latest')
 
@@ -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] @ ." -r /tmp/constraints.txt
         displayName: "Install dependencies release candidates"
         condition: eq(variables['DEPENDENCIES_VERSION'], 'pre-release')
 

From bf203f93f718f2de1b8b9412526bd31a1c73118c Mon Sep 17 00:00:00 2001
From: "Philipp A." <flying-sheep@web.de>
Date: Fri, 23 Aug 2024 10:07:30 +0200
Subject: [PATCH 4/5] oops

---
 .azure-pipelines.yml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml
index 6b67b16a7..dae35bdb5 100644
--- a/.azure-pipelines.yml
+++ b/.azure-pipelines.yml
@@ -53,7 +53,7 @@ jobs:
       - script: echo "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] @ ." -r /tmp/constraints.txt
+      - script: uv pip install --system --compile "anndata[dev,test] @ ." -c /tmp/constraints.txt
         displayName: "Install dependencies"
         condition: eq(variables['DEPENDENCIES_VERSION'], 'latest')
 
@@ -65,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] @ ." -r /tmp/constraints.txt
+      - 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')
 

From d7cb25686c7562a7eeef260a18d2c4b9c05f4c23 Mon Sep 17 00:00:00 2001
From: "Philipp A." <flying-sheep@web.de>
Date: Fri, 23 Aug 2024 10:11:21 +0200
Subject: [PATCH 5/5] printf

---
 .azure-pipelines.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml
index dae35bdb5..0d9496423 100644
--- a/.azure-pipelines.yml
+++ b/.azure-pipelines.yml
@@ -50,7 +50,7 @@ jobs:
         displayName: Cache pip packages
 
       # This prevents broken and slow back-tracking in dependency resolution
-      - script: echo "llvmlite>=0.43\nscanpy>=1.10.0rc1" | tee /tmp/constraints.txt
+      - 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