diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index ca5f7f6..c9c14d3 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -15,7 +15,7 @@ repos:
hooks:
- id: blacken-docs
- repo: https://github.com/pre-commit/mirrors-prettier
- rev: v3.0.0-alpha.4
+ rev: v3.0.0-alpha.6
hooks:
- id: prettier
# Newer versions of node don't work on systems that have an older version of GLIBC
@@ -25,7 +25,7 @@ repos:
# https://github.com/jupyterlab/jupyterlab/issues/12675
language_version: "17.9.1"
- repo: https://github.com/charliermarsh/ruff-pre-commit
- rev: v0.0.252
+ rev: v0.0.254
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
diff --git a/docs/_templates/autosummary/class.rst b/docs/_templates/autosummary/class.rst
index 17dc123..e4665df 100644
--- a/docs/_templates/autosummary/class.rst
+++ b/docs/_templates/autosummary/class.rst
@@ -39,9 +39,6 @@ Attributes
{% for item in attributes %}
-{{ item }}
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
.. autoattribute:: {{ [objname, item] | join(".") }}
{%- endfor %}
@@ -56,9 +53,6 @@ Methods
{% for item in methods %}
{%- if item != '__init__' %}
-{{ item }}
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
.. automethod:: {{ [objname, item] | join(".") }}
{%- endif -%}
{%- endfor %}
diff --git a/docs/conf.py b/docs/conf.py
index 10ade76..6ffb711 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -87,6 +87,7 @@
}
intersphinx_mapping = {
+ "python": ("https://docs.python.org/3", None),
"anndata": ("https://anndata.readthedocs.io/en/stable/", None),
"numpy": ("https://numpy.org/doc/stable/", None),
}
@@ -109,6 +110,7 @@
html_theme_options = {
"repository_url": repository_url,
"use_repository_button": True,
+ "path_to_docs": "docs/",
}
pygments_style = "default"
diff --git a/docs/extensions/typed_returns.py b/docs/extensions/typed_returns.py
index 9447813..1135204 100644
--- a/docs/extensions/typed_returns.py
+++ b/docs/extensions/typed_returns.py
@@ -1,24 +1,27 @@
# code from https://github.com/theislab/scanpy/blob/master/docs/extensions/typed_returns.py
# with some minor adjustment
+from __future__ import annotations
+
import re
+from collections.abc import Generator, Iterable
from sphinx.application import Sphinx
from sphinx.ext.napoleon import NumpyDocstring
-def _process_return(lines):
+def _process_return(lines: Iterable[str]) -> Generator[str, None, None]:
for line in lines:
- m = re.fullmatch(r"(?P\w+)\s+:\s+(?P[\w.]+)", line)
- if m:
- # Once this is in scanpydoc, we can use the fancy hover stuff
+ if m := re.fullmatch(r"(?P\w+)\s+:\s+(?P[\w.]+)", line):
yield f'-{m["param"]} (:class:`~{m["type"]}`)'
else:
yield line
-def _parse_returns_section(self, section):
- lines_raw = list(_process_return(self._dedent(self._consume_to_next_section())))
- lines = self._format_block(":returns: ", lines_raw)
+def _parse_returns_section(self: NumpyDocstring, section: str) -> list[str]:
+ lines_raw = self._dedent(self._consume_to_next_section())
+ if lines_raw[0] == ":":
+ del lines_raw[0]
+ lines = self._format_block(":returns: ", list(_process_return(lines_raw)))
if lines and lines[-1]:
lines.append("")
return lines
diff --git a/pyproject.toml b/pyproject.toml
index a0f9b0d..0baf883 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -33,7 +33,7 @@ dev = [
]
doc = [
"sphinx>=4",
- "sphinx-book-theme>=0.3.3",
+ "sphinx-book-theme>=1.0.0",
"myst-nb",
"sphinxcontrib-bibtex>=1.0.0",
"sphinx-autodoc-typehints",