Skip to content
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
9 changes: 9 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,15 @@ build:
- curl
- jq
jobs:
post_checkout:
# Read the Docs clones with --depth 50 and without tags, so hatch-vcs cannot find
# the release tag and falls back to a "0.1.dev50" version. That is what reaches
# the docs as Sphinx's ``version`` and ``release``, so without this the published
# documentation for a release reports itself as 0.1.dev50.
#
# --unshallow errors on an already complete clone, so fall back to fetching the
# tags alone rather than ignoring every failure.
- git fetch --tags --unshallow || git fetch --tags
post_create_environment:
- pip install uv
post_install:
Expand Down
46 changes: 0 additions & 46 deletions docs/_static/css/custom.css

This file was deleted.

9 changes: 0 additions & 9 deletions docs/_static/js/custom.js

This file was deleted.

7 changes: 5 additions & 2 deletions docs/citations.rst
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
Use and Citations
=================

.. raw:: html
.. ifconfig:: is_development_build

<p id="dev-version"><strong>Warning:</strong> This is a development version and should not be cited. To find the specific version to cite, please go to <a href="https://pyhf.readthedocs.io/">ReadTheDocs</a>.</p>
.. warning::

This is a development version and should not be cited. To find the specific
version to cite, please go to `ReadTheDocs <https://pyhf.readthedocs.io/>`__.

Citation
--------
Expand Down
36 changes: 30 additions & 6 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
# documentation root, use Path('../relative_path_to_dir').resolve() to make it absolute, like shown here.

import importlib.metadata
import os
import sys
from pathlib import Path

Expand All @@ -36,6 +37,7 @@ def setup(app):
app.add_css_file(
"https://cdnjs.cloudflare.com/ajax/libs/github-fork-ribbon-css/0.2.2/gh-fork-ribbon.min.css"
)
app.add_config_value("is_development_build", default=False, rebuild="env")


# -- General configuration ------------------------------------------------
Expand Down Expand Up @@ -240,11 +242,38 @@ def setup(app):
#
html_theme = "pydata_sphinx_theme"

# Read the Docs provides its own version switcher, so these docs do not need one, but
# its notification addon renders nothing, so the development version still has to say
# so for itself. That covers the GitHub Pages deployment and local builds, neither of
# which is on Read the Docs, along with Read the Docs' own "latest" and its pull
# request previews, which set READTHEDOCS_VERSION to the pull request number. Builds of
# "stable" and of a release tag say nothing.
#
# The theme's own 'show_version_warning_banner' cannot be used for this, as it is only
# rendered when a version switcher 'json_url' is configured.
is_development_build = (
os.environ.get("READTHEDOCS") != "True"
or os.environ.get("READTHEDOCS_VERSION") == "latest"
or os.environ.get("READTHEDOCS_VERSION_TYPE") == "external"
)

_announcement = (
"This is a development version. The latest stable version is at "
'<a href="https://pyhf.readthedocs.io/">pyhf.readthedocs.io</a>.'
if is_development_build
else ""
)

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#
html_theme_options = {"header_links_before_dropdown": 6}
html_theme_options = {
"header_links_before_dropdown": 6,
# c.f. https://pydata-sphinx-theme.readthedocs.io/en/stable/user_guide/announcements.html
"announcement": _announcement,
"sticky_banners": True,
}

# Add any paths that contain custom themes here, relative to this directory.
html_theme_path = []
Expand Down Expand Up @@ -274,12 +303,7 @@ def setup(app):
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ["_static"]

html_css_files = [
"css/custom.css",
]

html_js_files = [
"js/custom.js",
(
"https://views.scientific-python.org/js/plausible.js",
{"data-domain": "pyhf.readthedocs.io", "defer": "defer"},
Expand Down
4 changes: 0 additions & 4 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@
release-notes
contributors

.. raw:: html

<p id="dev-version"><strong>Warning:</strong> This is a development version. The latest stable version is at <a href="https://pyhf.readthedocs.io/">ReadTheDocs</a>.</p>

..
Comment: Splice the JupyterLite example into the README by looking for a particular comment

Expand Down
Loading