|
13 | 13 | # All configuration values have a default; values that are commented out
|
14 | 14 | # serve to show the default.
|
15 | 15 |
|
| 16 | +import inspect |
16 | 17 | import os
|
17 | 18 | import sys
|
18 | 19 |
|
|
41 | 42 | "numpydoc",
|
42 | 43 | "sphinx.ext.autodoc",
|
43 | 44 | "sphinx.ext.viewcode",
|
| 45 | + "sphinx.ext.linkcode", |
44 | 46 | "sphinx.ext.autosummary",
|
45 | 47 | "sphinx.ext.intersphinx",
|
46 | 48 | "sphinx.ext.extlinks",
|
|
50 | 52 | "sphinx_autosummary_accessors",
|
51 | 53 | "IPython.sphinxext.ipython_console_highlighting",
|
52 | 54 | "IPython.sphinxext.ipython_directive",
|
| 55 | + "nbsphinx", |
| 56 | + "sphinxcontrib.srclinks", |
53 | 57 | ]
|
54 | 58 |
|
55 | 59 | extlinks = {
|
|
76 | 80 | copyright = "2021 onwards, Tom Nicholas and its Contributors"
|
77 | 81 | author = "Tom Nicholas"
|
78 | 82 |
|
| 83 | +html_show_sourcelink = True |
| 84 | +srclink_project = "https://github.com/xarray-contrib/datatree" |
| 85 | +srclink_branch = "main" |
| 86 | +srclink_src_path = "docs/source" |
| 87 | + |
79 | 88 | # The version info for the project you're documenting, acts as replacement for
|
80 | 89 | # |version| and |release|, also used in various other places throughout the
|
81 | 90 | # built documents.
|
|
127 | 136 |
|
128 | 137 | intersphinx_mapping = {
|
129 | 138 | "python": ("https://docs.python.org/3.8/", None),
|
| 139 | + "numpy": ("https://numpy.org/doc/stable", None), |
130 | 140 | "xarray": ("https://xarray.pydata.org/en/stable/", None),
|
131 | 141 | }
|
132 | 142 |
|
|
142 | 152 | html_theme_options = {
|
143 | 153 | "repository_url": "https://github.com/xarray-contrib/datatree",
|
144 | 154 | "repository_branch": "main",
|
145 |
| - "path_to_docs": "doc", |
| 155 | + "path_to_docs": "docs/source", |
146 | 156 | "use_repository_button": True,
|
147 | 157 | "use_issues_button": True,
|
148 | 158 | "use_edit_page_button": True,
|
@@ -334,12 +344,12 @@ def linkcode_resolve(domain, info):
|
334 | 344 | else:
|
335 | 345 | linespec = ""
|
336 | 346 |
|
337 |
| - fn = os.path.relpath(fn, start=os.path.dirname(xarray.__file__)) |
| 347 | + fn = os.path.relpath(fn, start=os.path.dirname(datatree.__file__)) |
338 | 348 |
|
339 |
| - if "+" in xarray.__version__: |
| 349 | + if "+" in datatree.__version__: |
340 | 350 | return f"https://github.com/xarray-contrib/datatree/blob/main/datatree/{fn}{linespec}"
|
341 | 351 | else:
|
342 | 352 | return (
|
343 | 353 | f"https://github.com/xarray-contrib/datatree/blob/"
|
344 |
| - f"v{datatree.__version__}/xarray/{fn}{linespec}" |
| 354 | + f"v{datatree.__version__}/datatree/{fn}{linespec}" |
345 | 355 | )
|
0 commit comments