Skip to content

Commit

Permalink
docs: show second level in left sidebar (#221)
Browse files Browse the repository at this point in the history
* docs: add numpy to intersphinx inventory
  • Loading branch information
redeboer committed Jan 31, 2022
1 parent 52990a7 commit bf62824
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ def fetch_logo(url: str, output_path: str) -> None:
"thebe": True,
"thebelab": True,
},
"show_navbar_depth": 2,
"theme_dev_mode": True,
}
html_title = "AmpForm"
Expand Down Expand Up @@ -254,6 +255,19 @@ def get_version(package_name: str) -> str:
return "stable"


def get_minor_version(package_name: str) -> str:
installed_version = get_version(package_name)
if installed_version == "stable":
return installed_version
matches = re.match(r"^([0-9]+\.[0-9]+).*$", installed_version)
if matches is None:
raise ValueError(
"Could not find documentation for"
f" {package_name} v{installed_version}"
)
return matches[1]


intersphinx_mapping = {
"attrs": (f"https://www.attrs.org/en/{get_version('attrs')}", None),
"compwa-org": ("https://compwa-org.readthedocs.io", None),
Expand All @@ -270,6 +284,7 @@ def get_version(package_name: str) -> str:
f"https://mpl-interactions.readthedocs.io/en/{get_version('mpl-interactions')}",
None,
),
"numpy": (f"https://numpy.org/doc/{get_minor_version('numpy')}", None),
"pwa": ("https://pwa.readthedocs.io", None),
"python": ("https://docs.python.org/3", None),
"qrules": (
Expand Down

0 comments on commit bf62824

Please sign in to comment.