|
a |
|
b/docs/conf.py |
|
|
1 |
#!/usr/bin/env python |
|
|
2 |
# mypy: ignore-errors |
|
|
3 |
|
|
|
4 |
import sys |
|
|
5 |
from datetime import datetime |
|
|
6 |
from importlib.metadata import metadata |
|
|
7 |
from pathlib import Path |
|
|
8 |
|
|
|
9 |
HERE = Path(__file__).parent |
|
|
10 |
sys.path[:0] = [str(HERE.parent), str(HERE / "extensions")] |
|
|
11 |
|
|
|
12 |
needs_sphinx = "4.3" |
|
|
13 |
|
|
|
14 |
info = metadata("ehrapy") |
|
|
15 |
project_name = info["Name"] |
|
|
16 |
author = info["Author"] |
|
|
17 |
copyright = f"{datetime.now():%Y}, {author}." |
|
|
18 |
version = info["Version"] |
|
|
19 |
urls = dict(pu.split(", ") for pu in info.get_all("Project-URL")) |
|
|
20 |
repository_url = urls["Source"] |
|
|
21 |
release = info["Version"] |
|
|
22 |
github_repo = "ehrapy" |
|
|
23 |
|
|
|
24 |
extensions = [ |
|
|
25 |
"myst_parser", |
|
|
26 |
"sphinx.ext.autodoc", |
|
|
27 |
"sphinx.ext.intersphinx", |
|
|
28 |
"sphinx.ext.viewcode", |
|
|
29 |
"nbsphinx", |
|
|
30 |
"nbsphinx_link", |
|
|
31 |
"sphinx.ext.mathjax", |
|
|
32 |
"sphinx.ext.napoleon", |
|
|
33 |
"sphinx_autodoc_typehints", # needs to be after napoleon |
|
|
34 |
"sphinx.ext.autosummary", |
|
|
35 |
"sphinx_copybutton", |
|
|
36 |
"sphinx_gallery.load_style", |
|
|
37 |
"sphinx_remove_toctrees", |
|
|
38 |
"sphinx_design", |
|
|
39 |
] |
|
|
40 |
|
|
|
41 |
# remove_from_toctrees = ["tutorials/notebooks/*", "api/reference/*"] |
|
|
42 |
|
|
|
43 |
# for sharing urls with nice info |
|
|
44 |
ogp_site_url = "https://ehrapy.readthedocs.io/en/latest/" |
|
|
45 |
ogp_image = "https://ehrapy.readthedocs.io/en/latest//_static/logo.png" |
|
|
46 |
|
|
|
47 |
# nbsphinx specific settings |
|
|
48 |
exclude_patterns = [ |
|
|
49 |
"_build", |
|
|
50 |
"Thumbs.db", |
|
|
51 |
".DS_Store", |
|
|
52 |
"auto_*/**.ipynb", |
|
|
53 |
"auto_*/**.md5", |
|
|
54 |
"auto_*/**.py", |
|
|
55 |
"**.ipynb_checkpoints", |
|
|
56 |
] |
|
|
57 |
nbsphinx_execute = "never" |
|
|
58 |
|
|
|
59 |
templates_path = ["_templates"] |
|
|
60 |
# source_suffix = ".md" |
|
|
61 |
|
|
|
62 |
autosummary_generate = True |
|
|
63 |
autodoc_member_order = "bysource" |
|
|
64 |
napoleon_google_docstring = True # for pytorch lightning |
|
|
65 |
napoleon_numpy_docstring = True |
|
|
66 |
napoleon_include_init_with_doc = False |
|
|
67 |
napoleon_use_rtype = True # having a separate entry generally helps readability |
|
|
68 |
napoleon_use_param = True |
|
|
69 |
napoleon_custom_sections = [("Params", "Parameters")] |
|
|
70 |
todo_include_todos = False |
|
|
71 |
numpydoc_show_class_members = False |
|
|
72 |
annotate_defaults = True # scanpydoc option, look into why we need this |
|
|
73 |
myst_enable_extensions = [ |
|
|
74 |
"colon_fence", |
|
|
75 |
"dollarmath", |
|
|
76 |
"amsmath", |
|
|
77 |
] |
|
|
78 |
|
|
|
79 |
master_doc = "index" |
|
|
80 |
|
|
|
81 |
intersphinx_mapping = { |
|
|
82 |
"anndata": ("https://anndata.readthedocs.io/en/stable/", None), |
|
|
83 |
"ipython": ("https://ipython.readthedocs.io/en/stable/", None), |
|
|
84 |
"matplotlib": ("https://matplotlib.org/", None), |
|
|
85 |
"numpy": ("https://numpy.org/doc/stable/", None), |
|
|
86 |
"pandas": ("https://pandas.pydata.org/docs/", None), |
|
|
87 |
"python": ("https://docs.python.org/3", None), |
|
|
88 |
"scipy": ("https://docs.scipy.org/doc/scipy/reference/", None), |
|
|
89 |
"pynndescent": ("https://pynndescent.readthedocs.io/en/latest/", None), |
|
|
90 |
"sklearn": ("https://scikit-learn.org/stable/", None), |
|
|
91 |
"torch": ("https://pytorch.org/docs/master/", None), |
|
|
92 |
"scanpy": ("https://scanpy.readthedocs.io/en/stable/", None), |
|
|
93 |
"pytorch_lightning": ("https://pytorch-lightning.readthedocs.io/en/stable/", None), |
|
|
94 |
"pyro": ("http://docs.pyro.ai/en/stable/", None), |
|
|
95 |
"pymde": ("https://pymde.org/", None), |
|
|
96 |
"flax": ("https://flax.readthedocs.io/en/latest/", None), |
|
|
97 |
"jax": ("https://jax.readthedocs.io/en/latest/", None), |
|
|
98 |
"lamin": ("https://lamin.ai/docs", None), |
|
|
99 |
"lifelines": ("https://lifelines.readthedocs.io/en/latest/", None), |
|
|
100 |
} |
|
|
101 |
|
|
|
102 |
language = "en" |
|
|
103 |
|
|
|
104 |
typehints_defaults = "comma" |
|
|
105 |
|
|
|
106 |
pygments_style = "default" |
|
|
107 |
pygments_dark_style = "native" |
|
|
108 |
|
|
|
109 |
|
|
|
110 |
# html_show_sourcelink = True |
|
|
111 |
html_theme = "furo" |
|
|
112 |
|
|
|
113 |
html_title = "ehrapy" |
|
|
114 |
html_logo = "_static/ehrapy_logos/ehrapy_pure.png" |
|
|
115 |
|
|
|
116 |
html_theme_options = { |
|
|
117 |
"sidebar_hide_name": True, |
|
|
118 |
"light_css_variables": { |
|
|
119 |
"color-brand-primary": "#003262", |
|
|
120 |
"color-brand-content": "#003262", |
|
|
121 |
"admonition-font-size": "var(--font-size-normal)", |
|
|
122 |
"admonition-title-font-size": "var(--font-size-normal)", |
|
|
123 |
"code-font-size": "var(--font-size--small)", |
|
|
124 |
}, |
|
|
125 |
} |
|
|
126 |
html_static_path = ["_static"] |
|
|
127 |
html_css_files = ["css/overwrite.css", "css/sphinx_gallery.css"] |
|
|
128 |
html_show_sphinx = False |
|
|
129 |
|
|
|
130 |
|
|
|
131 |
nbsphinx_prolog = r""" |
|
|
132 |
.. raw:: html |
|
|
133 |
|
|
|
134 |
{{% set docname = env.doc2path(env.docname, base=None).split("/")[-1] %}} |
|
|
135 |
|
|
|
136 |
.. raw:: html |
|
|
137 |
|
|
|
138 |
<style> |
|
|
139 |
p {{ |
|
|
140 |
margin-bottom: 0.5rem; |
|
|
141 |
}} |
|
|
142 |
/* Main index page overview cards */ |
|
|
143 |
/* https://github.com/spatialaudio/nbsphinx/pull/635/files */ |
|
|
144 |
.jp-RenderedHTMLCommon table, |
|
|
145 |
div.rendered_html table {{ |
|
|
146 |
border: none; |
|
|
147 |
border-collapse: collapse; |
|
|
148 |
border-spacing: 0; |
|
|
149 |
font-size: 12px; |
|
|
150 |
table-layout: fixed; |
|
|
151 |
color: inherit; |
|
|
152 |
}} |
|
|
153 |
|
|
|
154 |
body:not([data-theme=light]) .jp-RenderedHTMLCommon tbody tr:nth-child(odd), |
|
|
155 |
body:not([data-theme=light]) div.rendered_html tbody tr:nth-child(odd) {{ |
|
|
156 |
background: rgba(255, 255, 255, .1); |
|
|
157 |
}} |
|
|
158 |
</style> |
|
|
159 |
|
|
|
160 |
.. raw:: html |
|
|
161 |
|
|
|
162 |
<div class="admonition note"> |
|
|
163 |
<p class="admonition-title">Note</p> |
|
|
164 |
<p> |
|
|
165 |
This page was generated from |
|
|
166 |
<a class="reference external" href="https://github.com/theislab/ehrapy/tree/{version}/">{docname}</a>. |
|
|
167 |
Some tutorial content may look better in light mode. |
|
|
168 |
</p> |
|
|
169 |
</div> |
|
|
170 |
""".format(version=version, docname="{{ docname|e }}") |
|
|
171 |
nbsphinx_thumbnails = { |
|
|
172 |
"tutorials/notebooks/ehrapy_introduction": "_static/ehrapy_logos/ehrapy_pure.png", |
|
|
173 |
"tutorials/notebooks/mimic_2_introduction": "_static/tutorials/catheter.png", |
|
|
174 |
"tutorials/notebooks/mimic_2_fate": "_static/tutorials/fate.png", |
|
|
175 |
"tutorials/notebooks/mimic_2_survival_analysis": "_static/tutorials/survival.png", |
|
|
176 |
"tutorials/notebooks/mimic_2_effect_estimation": "_static/tutorials/effect_estimation.png", |
|
|
177 |
"tutorials/notebooks/mimic_2_causal_inference": "_static/tutorials/causal_inference.png", |
|
|
178 |
"tutorials/notebooks/medcat": "_static/tutorials/nlp.png", |
|
|
179 |
"tutorials/notebooks/ml_usecases": "_static/tutorials/machine_learning.png", |
|
|
180 |
"tutorials/notebooks/ontology_mapping": "_static/tutorials/ontology.png", |
|
|
181 |
"tutorials/notebooks/fhir": "_static/tutorials/fhir.png", |
|
|
182 |
"tutorials/notebooks/cohort_tracking": "_static/tutorials/cohort_tracking.png", |
|
|
183 |
"tutorials/notebooks/bias": "_static/tutorials/bias.png", |
|
|
184 |
"tutorials/notebooks/out_of_core": "_static/tutorials/out_of_core.png", |
|
|
185 |
"tutorials/notebooks/patient_trajectory": "_static/tutorials/patient_trajectory.png", |
|
|
186 |
} |