Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a version switcher for RTD #144

Merged
merged 3 commits into from
Aug 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# nectarchain [![Build Status](https://github.com/cta-observatory/nectarchain/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/cta-observatory/nectarchain/actions/workflows/ci.yml?query=workflow%3ACI+branch%3Amain) [![pypi](https://badge.fury.io/py/nectarchain.svg)](https://pypi.org/project/nectarchain) [![conda](https://anaconda.org/conda-forge/nectarchain/badges/version.svg)](https://anaconda.org/conda-forge/nectarchain) [![codecov](https://codecov.io/github/cta-observatory/nectarchain/graph/badge.svg?token=TDhZlJtbMv)](https://codecov.io/github/cta-observatory/nectarchain)
# nectarchain [![Build Status](https://github.com/cta-observatory/nectarchain/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/cta-observatory/nectarchain/actions/workflows/ci.yml?query=workflow%3ACI+branch%3Amain) [![pypi](https://badge.fury.io/py/nectarchain.svg)](https://pypi.org/project/nectarchain) [![conda](https://anaconda.org/conda-forge/nectarchain/badges/version.svg)](https://anaconda.org/conda-forge/nectarchain) [![codecov](https://codecov.io/github/cta-observatory/nectarchain/graph/badge.svg?token=TDhZlJtbMv)](https://codecov.io/github/cta-observatory/nectarchain/tree/main) [![Documentation Status](https://readthedocs.org/projects/nectarchain/badge/?version=latest)](https://nectarchain.readthedocs.io/en/latest/?badge=latest)

Repository for the high level analysis of the NectarCAM data.
The analysis is heavily based on [ctapipe](https://github.com/cta-observatory/ctapipe), adding custom code for NectarCAM calibration.
Expand Down
12 changes: 12 additions & 0 deletions docs/_static/switcher.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[
{
"name": "dev",
"version": "latest",
"url": "https://nectarchain.readthedocs.io/en/latest/"
},
{
"name": "stable",
"version": "stable",
"url": "https://nectarchain.readthedocs.io/en/stable/"
}
]
27 changes: 27 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
import datetime
import os
import sys
from pathlib import Path

Expand Down Expand Up @@ -116,6 +117,27 @@
# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = True


# -- Version switcher -----------------------------------------------------

# Define the json_url for our version switcher.
json_url = "https://nectarchain.readthedocs.io/en/latest/_static/switcher.json"

# Define the version we use for matching in the version switcher.,
version_match = os.getenv("READTHEDOCS_VERSION")
# If READTHEDOCS_VERSION doesn't exist, we're not on RTD
# If it is an integer, we're in a PR build and the version isn't correct.
if not version_match or version_match.isdigit():
# For local development, infer the version to match from the package.
if "dev" in release or "rc" in release:
version_match = "latest"
else:
version_match = release

# We want to keep the relative reference when on a pull request or locally
json_url = "_static/switcher.json"


# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

Expand Down Expand Up @@ -146,7 +168,12 @@
},
"navigation_with_keys": False,
"github_url": f"https://github.com/cta-observatory/{project}",
"header_links_before_dropdown": 6,
"navbar_start": ["navbar-logo", "version-switcher"],
"switcher": {
"version_match": version_match,
"json_url": json_url,
},
"announcement": """
<p>nectarchain is not stable yet, so expect large and rapid
changes to structure and functionality as we explore various
Expand Down
Loading