Skip to content

Commit

Permalink
Enable version warning banners for docs (#7139)
Browse files Browse the repository at this point in the history
* Enable version warning banners for docs

If the doc version isn't the preferred one, a warning banner is shown
at the top. This also accounts for dev builds.

* Update PyData theme to fixed 0.14.1

0.14.1 fixes a broken version comparison in the javascript of the
version warning banner. See
pydata/pydata-sphinx-theme#1446 for more.

* Revert to proper version_switcher.json URL
  • Loading branch information
lagru committed Sep 22, 2023
1 parent de8f04a commit 27cde7c
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 7 deletions.
4 changes: 2 additions & 2 deletions RELEASE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ the appropriate point in main and the following instructions are still apt.
Once everything works as intended, remove those branches and proceed.

- Edit ``doc/source/_static/docversions.js`` and
``doc/source/_static/version_switcher.json`` in order to
add the release, e.g., `0.15.x`, and commit.
``doc/source/_static/version_switcher.json`` in order to add the release, move the
key value pair `"preferred": true` to the most recent stable version, and commit.

- Update the version number to stable in ``skimage/__init__.py``, and commit.

Expand Down
3 changes: 2 additions & 1 deletion doc/source/_static/version_switcher.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
{
"name": "0.21 (stable)",
"version":"0.21.0",
"url": "https://scikit-image.org/docs/stable/"
"url": "https://scikit-image.org/docs/stable/",
"preferred": true
},
{
"name": "0.20",
Expand Down
12 changes: 10 additions & 2 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,19 +155,27 @@
},
"header_links_before_dropdown": 6,
"icon_links": [
{
"name": "GitHub",
"url": "https://github.com/scikit-image/scikit-image",
"icon": "fa-brands fa-github",
},
{
"name": "PyPI",
"url": "https://pypi.org/project/scikit-image/",
"icon": "fa-solid fa-box",
},
],
"navbar_align": "left",
"navbar_end": ["version-switcher", "navbar-icon-links"],
"show_prev_next": False,
"switcher": {
"json_url": "https://scikit-image.org/docs/dev/_static/version_switcher.json",
"json_url": (
"https://scikit-image.org/docs/dev/_static/version_switcher.json"
),
"version_match": "dev" if "dev" in version else version,
},
"github_url": "https://github.com/scikit-image/scikit-image",
"show_version_warning_banner": True,
# Footer
"footer_start": ["copyright"],
"footer_end": ["sphinx-version", "theme-version"],
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ docs = [
'kaleido',
'scikit-learn>=1.1',
'sphinx_design>=0.3',
'pydata-sphinx-theme>=0.13',
'pydata-sphinx-theme>=0.14.1',
]
optional = [
'SimpleITK',
Expand Down
2 changes: 1 addition & 1 deletion requirements/docs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ plotly>=5.10
kaleido
scikit-learn>=1.1
sphinx_design>=0.3
pydata-sphinx-theme>=0.13
pydata-sphinx-theme>=0.14.1

0 comments on commit 27cde7c

Please sign in to comment.