Skip to content

Commit

Permalink
Update instance repo (PR 154) (#42)
Browse files Browse the repository at this point in the history
* Update instance repo from cookiecutter template

* Update instance repo from cookiecutter template

* Update instance repo from cookiecutter template

* Update instance repo from cookiecutter template

* Update instance repo from cookiecutter template

* Update instance repo from cookiecutter template

* Update instance repo from cookiecutter template

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
scverse-bot and github-actions[bot] authored Mar 7, 2023
1 parent d006d41 commit 9ce0ca0
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 16 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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]
Expand Down
6 changes: 0 additions & 6 deletions docs/_templates/autosummary/class.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ Attributes

{% for item in attributes %}

{{ item }}
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. autoattribute:: {{ [objname, item] | join(".") }}
{%- endfor %}

Expand All @@ -56,9 +53,6 @@ Methods
{% for item in methods %}
{%- if item != '__init__' %}

{{ item }}
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. automethod:: {{ [objname, item] | join(".") }}
{%- endif -%}
{%- endfor %}
Expand Down
2 changes: 2 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
}
Expand All @@ -109,6 +110,7 @@
html_theme_options = {
"repository_url": repository_url,
"use_repository_button": True,
"path_to_docs": "docs/",
}

pygments_style = "default"
Expand Down
17 changes: 10 additions & 7 deletions docs/extensions/typed_returns.py
Original file line number Diff line number Diff line change
@@ -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<param>\w+)\s+:\s+(?P<type>[\w.]+)", line)
if m:
# Once this is in scanpydoc, we can use the fancy hover stuff
if m := re.fullmatch(r"(?P<param>\w+)\s+:\s+(?P<type>[\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
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 9ce0ca0

Please sign in to comment.