Skip to content

Commit

Permalink
MAINT: Compatibility with pydata-sphinx-theme (#453)
Browse files Browse the repository at this point in the history
Fix compatibility issues between latest pydata-sphinx-theme and sphinx 6.

Increase granularity of CI to test across necessary sphinx & Python version combos.
  • Loading branch information
larsoner committed Mar 3, 2023
1 parent ef731f0 commit 9c59a46
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 18 deletions.
16 changes: 15 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,21 @@ jobs:
os: [Ubuntu]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11-dev"]
sphinx-version:
["sphinx==4.2", "sphinx==4.5", "sphinx==5.0", "sphinx>=5.0"]
[
"sphinx==4.2",
"sphinx==4.5",
"sphinx==5.0",
"sphinx==5.3",
"sphinx==6.0",
"sphinx>6.0",
]
exclude:
- os: Ubuntu
python-version: "3.7"
sphinx-version: "sphinx==6.0"
- os: Ubuntu
python-version: "3.7"
sphinx-version: "sphinx>6.0"
steps:
- uses: actions/checkout@v3

Expand Down
24 changes: 9 additions & 15 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,23 +81,17 @@

html_theme = "pydata_sphinx_theme"
html_theme_options = {
"github_url": "https://github.com/numpy/numpydoc",
"show_prev_next": False,
"navbar_end": ["search-field.html", "navbar-icon-links.html"],
"navbar_end": ["theme-switcher", "search-field.html", "navbar-icon-links.html"],
"icon_links": [
{
"name": "GitHub",
"url": "https://github.com/numpy/numpydoc",
"icon": "fab fa-github-square",
"type": "fontawesome",
},
],
}
# NOTE: The following is required for supporting of older sphinx toolchains.
# The "theme-switcher" templated should be added directly to navbar_end
# above and the following lines removed when the minimum supported
# version of pydata_sphinx_theme is 0.9.0
# Add version switcher for versions of pydata_sphinx_theme that support it
import packaging
import pydata_sphinx_theme

if packaging.version.parse(pydata_sphinx_theme.__version__) >= packaging.version.parse(
"0.9.0"
):
html_theme_options["navbar_end"].insert(0, "theme-switcher")


html_sidebars = {
"**": [],
Expand Down
3 changes: 1 addition & 2 deletions requirements/doc.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
numpy>=1.21
matplotlib>=3.5
pydata-sphinx-theme>=0.11
# TODO: Remove <6 here and in actions when pydata-sphinx-theme handles sphinx 6
sphinx>=5.2,<6
sphinx>=5.2

0 comments on commit 9c59a46

Please sign in to comment.