|
5 | 5 | # https://www.sphinx-doc.org/en/master/usage/configuration.html |
6 | 6 |
|
7 | 7 | # -- Path setup -------------------------------------------------------------- |
| 8 | +import shutil |
8 | 9 | import sys |
9 | 10 | from datetime import datetime |
10 | 11 | from importlib.metadata import metadata |
11 | 12 | from pathlib import Path |
12 | 13 |
|
| 14 | +from sphinxcontrib import katex |
| 15 | + |
13 | 16 | HERE = Path(__file__).parent |
14 | 17 | sys.path.insert(0, str(HERE / "extensions")) |
15 | 18 |
|
|
19 | 22 | # NOTE: If you installed your project in editable mode, this might be stale. |
20 | 23 | # If this is the case, reinstall it to refresh the metadata |
21 | 24 | info = metadata("spatialdata-plot") |
22 | | -project_name = info["Name"] |
| 25 | +project = info["Name"] |
23 | 26 | author = info["Author"] |
24 | | -copyright = f"{datetime.now():%Y}, {author}" |
| 27 | +copyright = f"{datetime.now():%Y}, {author}." |
25 | 28 | version = info["Version"] |
26 | | - |
27 | | -# repository_url = f"https://github.com/scverse/{project_name}" |
28 | | - |
| 29 | +urls = dict(pu.split(", ") for pu in info.get_all("Project-URL")) |
| 30 | +repository_url = urls["Source"] |
29 | 31 |
|
30 | 32 | # The full version, including alpha/beta/rc tags |
31 | 33 | release = info["Version"] |
|
38 | 40 | html_context = { |
39 | 41 | "display_github": True, # Integrate GitHub |
40 | 42 | "github_user": "scverse", |
41 | | - "github_repo": "https://github.com/scverse/spatialdata-plot", |
| 43 | + "github_repo": project, |
42 | 44 | "github_version": "main", |
43 | 45 | "conf_py_path": "/docs/", |
44 | 46 | } |
|
55 | 57 | "sphinx.ext.autosummary", |
56 | 58 | "sphinx.ext.napoleon", |
57 | 59 | "sphinxcontrib.bibtex", |
| 60 | + "sphinxcontrib.katex", |
58 | 61 | "sphinx_autodoc_typehints", |
59 | | - "sphinx.ext.mathjax", |
| 62 | + "sphinx_tabs.tabs", |
60 | 63 | "IPython.sphinxext.ipython_console_highlighting", |
61 | | - "sphinx_design", |
| 64 | + "sphinxext.opengraph", |
62 | 65 | *[p.stem for p in (HERE / "extensions").glob("*.py")], |
63 | 66 | ] |
64 | 67 |
|
65 | 68 | autosummary_generate = True |
66 | | -autodoc_process_signature = True |
67 | 69 | autodoc_member_order = "groupwise" |
68 | 70 | default_role = "literal" |
69 | 71 | napoleon_google_docstring = False |
70 | 72 | napoleon_numpy_docstring = True |
71 | 73 | napoleon_include_init_with_doc = False |
72 | 74 | napoleon_use_rtype = True # having a separate entry generally helps readability |
73 | 75 | napoleon_use_param = True |
74 | | -myst_heading_anchors = 3 # create anchors for h1-h3 |
| 76 | +myst_heading_anchors = 6 # create anchors for h1-h6 |
75 | 77 | myst_enable_extensions = [ |
76 | 78 | "amsmath", |
77 | 79 | "colon_fence", |
|
93 | 95 | } |
94 | 96 |
|
95 | 97 | intersphinx_mapping = { |
| 98 | + "python": ("https://docs.python.org/3.13", None), |
96 | 99 | "anndata": ("https://anndata.readthedocs.io/en/stable/", None), |
| 100 | + "scanpy": ("https://scanpy.readthedocs.io/en/stable/", None), |
97 | 101 | "numpy": ("https://numpy.org/doc/stable/", None), |
98 | 102 | "geopandas": ("https://geopandas.org/en/stable/", None), |
99 | 103 | "xarray": ("https://docs.xarray.dev/en/stable/", None), |
|
108 | 112 | exclude_patterns = [ |
109 | 113 | "_build", |
110 | 114 | "Thumbs.db", |
| 115 | + ".DS_Store", |
111 | 116 | "**.ipynb_checkpoints", |
112 | 117 | "tutorials/notebooks/index.md", |
113 | 118 | "tutorials/notebooks/README.md", |
114 | 119 | "tutorials/notebooks/references.md", |
115 | 120 | "tutorials/notebooks/notebooks/paper_reproducibility/*", |
116 | 121 | ] |
117 | | -# Ignore warnings. |
118 | | -nitpicky = False # TODO: solve upstream. |
119 | | -# nitpick_ignore = [ |
120 | | -# ("py:class", "spatial_image.SpatialImage"), |
121 | | -# ("py:class", "multiscale_spatial_image.multiscale_spatial_image.MultiscaleSpatialImage"), |
122 | | -# ] |
123 | 122 |
|
124 | 123 |
|
125 | 124 | # -- Options for HTML output ------------------------------------------------- |
|
128 | 127 | # a list of builtin themes. |
129 | 128 | # |
130 | 129 | html_theme = "sphinx_book_theme" |
131 | | -# html_theme = "sphinx_rtd_theme" |
132 | 130 | html_static_path = ["_static"] |
133 | | -html_title = project_name |
| 131 | +html_css_files = ["css/custom.css"] |
| 132 | +html_title = project |
134 | 133 | html_logo = "_static/img/spatialdata_horizontal.png" |
135 | 134 |
|
136 | | -# html_theme_options = { |
137 | | -# "repository_url": repository_url, |
138 | | -# "use_repository_button": True, |
139 | | -# } |
| 135 | +html_theme_options = { |
| 136 | + "repository_url": repository_url, |
| 137 | + "use_repository_button": True, |
| 138 | + "path_to_docs": "docs/", |
| 139 | + "navigation_with_keys": False, |
| 140 | +} |
140 | 141 |
|
141 | 142 | pygments_style = "default" |
| 143 | +katex_prerender = shutil.which(katex.NODEJS_BINARY) is not None |
| 144 | + |
| 145 | +# Ignore warnings. |
| 146 | +nitpicky = False # TODO: solve upstream. |
142 | 147 |
|
143 | 148 | nitpick_ignore = [ |
144 | 149 | # If building the documentation fails because of a missing link that is outside your control, |
145 | 150 | # you can add an exception to this list. |
146 | 151 | ("py:class", "igraph.Graph"), |
147 | 152 | ] |
148 | | - |
149 | | - |
150 | | -def setup(app): |
151 | | - """App setup hook.""" |
152 | | - app.add_config_value( |
153 | | - "recommonmark_config", |
154 | | - { |
155 | | - "auto_toc_tree_section": "Contents", |
156 | | - "enable_auto_toc_tree": True, |
157 | | - "enable_math": True, |
158 | | - "enable_inline_math": False, |
159 | | - "enable_eval_rst": True, |
160 | | - }, |
161 | | - True, |
162 | | - ) |
163 | | - app.add_css_file("css/custom.css") |
0 commit comments