|
a |
|
b/docs/conf.py |
|
|
1 |
# Configuration file for the Sphinx documentation builder. |
|
|
2 |
# |
|
|
3 |
# This file only contains a selection of the most common options. For a full |
|
|
4 |
# list see the documentation: |
|
|
5 |
# https://www.sphinx-doc.org/en/master/usage/configuration.html |
|
|
6 |
|
|
|
7 |
# -- Path setup -------------------------------------------------------------- |
|
|
8 |
import sys |
|
|
9 |
from datetime import datetime |
|
|
10 |
from pathlib import Path |
|
|
11 |
|
|
|
12 |
# If extensions (or modules to document with autodoc) are in another directory, |
|
|
13 |
# add these directories to sys.path here. If the directory is relative to the |
|
|
14 |
# documentation root, use os.path.abspath to make it absolute, like shown here. |
|
|
15 |
import moscot |
|
|
16 |
|
|
|
17 |
sys.path.insert(0, str(Path(__file__).parent / "extensions")) |
|
|
18 |
|
|
|
19 |
# -- Project information ----------------------------------------------------- |
|
|
20 |
|
|
|
21 |
project = moscot.__name__ |
|
|
22 |
author = moscot.__author__ |
|
|
23 |
version = moscot.__version__ |
|
|
24 |
copyright = f"{datetime.now():%Y}, Theislab" |
|
|
25 |
|
|
|
26 |
# -- General configuration --------------------------------------------------- |
|
|
27 |
|
|
|
28 |
# Add any Sphinx extension module names here, as strings. They can be |
|
|
29 |
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom |
|
|
30 |
# ones. |
|
|
31 |
extensions = [ |
|
|
32 |
"sphinx.ext.autodoc", |
|
|
33 |
"sphinx.ext.napoleon", |
|
|
34 |
"sphinx.ext.viewcode", |
|
|
35 |
"sphinx.ext.mathjax", |
|
|
36 |
"sphinx.ext.intersphinx", |
|
|
37 |
"sphinx.ext.autosummary", |
|
|
38 |
"sphinxcontrib.bibtex", |
|
|
39 |
"sphinx_copybutton", |
|
|
40 |
"sphinx_autodoc_typehints", |
|
|
41 |
"myst_nb", |
|
|
42 |
"sphinx_design", # for cards |
|
|
43 |
"sphinx_tippy", |
|
|
44 |
"typed_returns", |
|
|
45 |
] |
|
|
46 |
intersphinx_mapping = { |
|
|
47 |
"python": ("https://docs.python.org/3", None), |
|
|
48 |
"numpy": ("https://numpy.org/doc/stable/", None), |
|
|
49 |
"scipy": ("https://docs.scipy.org/doc/scipy/", None), |
|
|
50 |
"pandas": ("https://pandas.pydata.org/docs/", None), |
|
|
51 |
"networkx": ("https://networkx.org/documentation/stable/", None), |
|
|
52 |
"jax": ("https://jax.readthedocs.io/en/latest/", None), |
|
|
53 |
"ott": ("https://ott-jax.readthedocs.io/en/latest/", None), |
|
|
54 |
"matplotlib": ("https://matplotlib.org/stable/", None), |
|
|
55 |
"anndata": ("https://anndata.readthedocs.io/en/latest/", None), |
|
|
56 |
"scanpy": ("https://scanpy.readthedocs.io/en/latest/", None), |
|
|
57 |
"squidpy": ("https://squidpy.readthedocs.io/en/latest/", None), |
|
|
58 |
"mudata": ("https://mudata.readthedocs.io/en/latest/", None), |
|
|
59 |
} |
|
|
60 |
master_doc = "index" |
|
|
61 |
pygments_style = "tango" |
|
|
62 |
pygments_dark_style = "monokai" |
|
|
63 |
|
|
|
64 |
nitpicky = True |
|
|
65 |
nitpick_ignore = [ |
|
|
66 |
("py:class", "numpy.float64"), |
|
|
67 |
# see: https://github.com/numpy/numpydoc/issues/275 |
|
|
68 |
("py:class", "None. Remove all items from D."), |
|
|
69 |
("py:class", "a set-like object providing a view on D's items"), |
|
|
70 |
("py:class", "a set-like object providing a view on D's keys"), |
|
|
71 |
("py:class", "v, remove specified key and return the corresponding value."), # noqa: E501 |
|
|
72 |
("py:class", "None. Update D from dict/iterable E and F."), |
|
|
73 |
("py:class", "an object providing a view on D's values"), |
|
|
74 |
("py:class", "a shallow copy of D"), |
|
|
75 |
# ignore these classes until ott-jax adds them to their docs |
|
|
76 |
("py:class", "ott.initializers.quadratic.initializers.BaseQuadraticInitializer"), |
|
|
77 |
("py:class", "ott.initializers.linear.initializers.SinkhornInitializer"), |
|
|
78 |
] |
|
|
79 |
# TODO(michalk8): remove once typing has been cleaned-up |
|
|
80 |
nitpick_ignore_regex = [ |
|
|
81 |
(r"py:class", r"moscot\..*(K|B|O)"), |
|
|
82 |
(r"py:class", r"numpy\._typing.*"), |
|
|
83 |
(r"py:class", r"moscot\..*Protocol.*"), |
|
|
84 |
( |
|
|
85 |
r"py:class", |
|
|
86 |
r"moscot.base.output.BaseSolverOutput", |
|
|
87 |
), # https://github.com/sphinx-doc/sphinx/issues/10974 means there is simply no way around this with generics |
|
|
88 |
] |
|
|
89 |
|
|
|
90 |
|
|
|
91 |
# bibliography |
|
|
92 |
bibtex_bibfiles = ["references.bib"] |
|
|
93 |
bibtex_reference_style = "author_year" |
|
|
94 |
bibtex_default_style = "alpha" |
|
|
95 |
|
|
|
96 |
# Add any paths that contain templates here, relative to this directory. |
|
|
97 |
templates_path = ["_templates"] |
|
|
98 |
source_suffix = { |
|
|
99 |
".rst": "restructuredtext", |
|
|
100 |
".ipynb": "myst-nb", |
|
|
101 |
} |
|
|
102 |
|
|
|
103 |
# myst |
|
|
104 |
nb_execution_mode = "off" |
|
|
105 |
myst_enable_extensions = [ |
|
|
106 |
"colon_fence", |
|
|
107 |
"dollarmath", |
|
|
108 |
"amsmath", |
|
|
109 |
] |
|
|
110 |
myst_heading_anchors = 3 |
|
|
111 |
|
|
|
112 |
|
|
|
113 |
# autodoc + napoleon |
|
|
114 |
autosummary_generate = True |
|
|
115 |
autodoc_member_order = "alphabetical" |
|
|
116 |
autodoc_typehints = "description" |
|
|
117 |
napoleon_google_docstring = False |
|
|
118 |
napoleon_numpy_docstring = True |
|
|
119 |
|
|
|
120 |
# spelling |
|
|
121 |
spelling_lang = "en_US" |
|
|
122 |
spelling_warning = True |
|
|
123 |
spelling_word_list_filename = "spelling_wordlist.txt" |
|
|
124 |
spelling_add_pypi_package_names = True |
|
|
125 |
spelling_exclude_patterns = ["references.rst"] |
|
|
126 |
# see: https://pyenchant.github.io/pyenchant/api/enchant.tokenize.html |
|
|
127 |
spelling_filters = [ |
|
|
128 |
"enchant.tokenize.URLFilter", |
|
|
129 |
"enchant.tokenize.EmailFilter", |
|
|
130 |
"enchant.tokenize.MentionFilter", |
|
|
131 |
] |
|
|
132 |
|
|
|
133 |
# hover |
|
|
134 |
tippy_anchor_parent_selector = "div.content" |
|
|
135 |
tippy_enable_mathjax = True |
|
|
136 |
# no need because of sphinxcontrib-bibtex |
|
|
137 |
tippy_enable_doitips = False |
|
|
138 |
linkcheck_report_timeouts_as_broken = True |
|
|
139 |
linkcheck_ignore = [ |
|
|
140 |
# 403 Client Error |
|
|
141 |
r"https://doi.org/10.1126/science.aad0501", |
|
|
142 |
r"https://resources.aertslab.org/cistarget/tf_lists/", |
|
|
143 |
r"https://doi.org/10.1126/science.aax1971", |
|
|
144 |
r"https://doi.org/10.1093/nar/gkac235", |
|
|
145 |
r"https://www.science.org/doi/abs/10.1126/science.aax1971", |
|
|
146 |
r"https://doi.org/10.1101/2022.01.10.475692", |
|
|
147 |
r"https://www.biorxiv.org/content/10.1101/2023.04.14.536867v1", |
|
|
148 |
r"https://www.biorxiv.org/content/10.1101/2023.05.11.540374v2", |
|
|
149 |
r"https://www.biorxiv.org/content/early/2022/01/11/2022.01.10.475692", |
|
|
150 |
r"https://doi.org/10.1145/2516971.2516977", |
|
|
151 |
r"https://doi.org/10.3390/a13090212", |
|
|
152 |
r"https://www.mdpi.com/1999-4893/13/9/212", |
|
|
153 |
] |
|
|
154 |
|
|
|
155 |
exclude_patterns = ["_build", "**.ipynb_checkpoints", "notebooks/README.rst", "notebooks/CONTRIBUTING.rst"] |
|
|
156 |
|
|
|
157 |
# -- Options for HTML output ------------------------------------------------- |
|
|
158 |
|
|
|
159 |
# The theme to use for HTML and HTML Help pages. See the documentation for |
|
|
160 |
# a list of builtin themes. |
|
|
161 |
html_theme = "furo" |
|
|
162 |
html_static_path = ["_static"] |
|
|
163 |
html_css_files = [ |
|
|
164 |
"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css", |
|
|
165 |
] |
|
|
166 |
|
|
|
167 |
html_show_sphinx = False |
|
|
168 |
html_show_sourcelink = False |
|
|
169 |
html_theme_options = { |
|
|
170 |
"sidebar_hide_name": True, |
|
|
171 |
"light_logo": "img/light_mode_logo.png", |
|
|
172 |
"dark_logo": "img/dark_mode_logo.png", |
|
|
173 |
"light_css_variables": { |
|
|
174 |
"color-brand-primary": "#003262", |
|
|
175 |
"color-brand-content": "#003262", |
|
|
176 |
"admonition-font-size": "var(--font-size-normal)", |
|
|
177 |
"admonition-title-font-size": "var(--font-size-normal)", |
|
|
178 |
"code-font-size": "var(--font-size--small)", |
|
|
179 |
}, |
|
|
180 |
"footer_icons": [ |
|
|
181 |
{ |
|
|
182 |
"name": "GitHub", |
|
|
183 |
"url": "https://github.com/theislab/moscot", |
|
|
184 |
"html": "", |
|
|
185 |
"class": "fab fa-github", |
|
|
186 |
}, |
|
|
187 |
], |
|
|
188 |
} |