diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 6625375e..3ef9acee 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -22,9 +22,14 @@ jobs: matrix: os: [ubuntu-latest] python-version: [3.6, 3.7, 3.8] + sphinx: [">=3,<4", ">=4,<5"] include: - os: windows-latest python-version: 3.7 + sphinx: ">=3,<4" + - os: macos-latest + python-version: 3.9 + sphinx: ">=4,<5" runs-on: ${{ matrix.os }} steps: diff --git a/docs/conf.py b/docs/conf.py index 4817e87f..e618d6d4 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -60,7 +60,6 @@ # "linkify", # "substitution", ] -myst_url_schemes = ("http", "https", "mailto") # -- Options for HTML output ------------------------------------------------- diff --git a/setup.py b/setup.py index 6a5e3173..883a1fdb 100644 --- a/setup.py +++ b/setup.py @@ -28,13 +28,13 @@ license="BSD", packages=find_packages(), install_requires=[ - "pyyaml", - "docutils>=0.15", - "sphinx>=2,<4", - "click", - "pydata-sphinx-theme~=0.6.0", "beautifulsoup4>=4.6.1,<5", + "click~=7.1", + "docutils>=0.15,<0.17", 'importlib-resources>=3.0,<3.5; python_version < "3.7"', + "pydata-sphinx-theme~=0.6.0", + "pyyaml", + "sphinx>=3,<5", ], extras_require={ "code_style": ["pre-commit~=2.7.0"], @@ -44,10 +44,11 @@ "folium", "numpy", "matplotlib", - "myst-nb~=0.11.1", + "myst-nb~=0.13", "nbclient", "pandas", "plotly", + "sphinx~=4.0", # Force Sphinx to be the latest version "sphinx-design", "sphinx-copybutton", "sphinx-togglebutton>=0.2.1", @@ -56,12 +57,12 @@ "sphinxext-opengraph", ], "testing": [ - "myst_nb~=0.11.1", - "sphinx_thebe", "coverage", + "myst_nb~=0.13", "pytest~=6.0.1", "pytest-cov", "pytest-regressions~=2.0.1", + "sphinx_thebe", ], "live-dev": ["sphinx-autobuild", "web-compile~=0.2.1"], }, diff --git a/sphinx_book_theme/__init__.py b/sphinx_book_theme/__init__.py index 83d6ef92..4b55e47c 100644 --- a/sphinx_book_theme/__init__.py +++ b/sphinx_book_theme/__init__.py @@ -9,7 +9,7 @@ import importlib_resources as resources from bs4 import BeautifulSoup as bs -from docutils.parsers.rst import directives +from docutils.parsers.rst.directives.body import Sidebar from docutils import nodes from sphinx.application import Sphinx from sphinx.locale import get_translation @@ -254,7 +254,7 @@ def _string_or_bool(var): return var is None -class Margin(directives.body.Sidebar): +class Margin(Sidebar): """Goes in the margin to the right of the page.""" optional_arguments = 1 diff --git a/sphinx_book_theme/_templates/sidebar-logo.html b/sphinx_book_theme/_templates/sidebar-logo.html index a74a1f5a..a56680bc 100644 --- a/sphinx_book_theme/_templates/sidebar-logo.html +++ b/sphinx_book_theme/_templates/sidebar-logo.html @@ -1,7 +1,11 @@ diff --git a/tests/test_build/page-onetitle.html b/tests/test_build/page-onetitle.sphinx3.html similarity index 100% rename from tests/test_build/page-onetitle.html rename to tests/test_build/page-onetitle.sphinx3.html diff --git a/tests/test_build/page-onetitle.sphinx4.html b/tests/test_build/page-onetitle.sphinx4.html new file mode 100644 index 00000000..ba51ee6f --- /dev/null +++ b/tests/test_build/page-onetitle.sphinx4.html @@ -0,0 +1,21 @@ +
+
+ + + Contents +
+ +
diff --git a/tests/test_build/page-onetitlenoheadings.html b/tests/test_build/page-onetitlenoheadings.sphinx3.html similarity index 100% rename from tests/test_build/page-onetitlenoheadings.html rename to tests/test_build/page-onetitlenoheadings.sphinx3.html diff --git a/tests/test_build/page-onetitlenoheadings.sphinx4.html b/tests/test_build/page-onetitlenoheadings.sphinx4.html new file mode 100644 index 00000000..64879a1a --- /dev/null +++ b/tests/test_build/page-onetitlenoheadings.sphinx4.html @@ -0,0 +1,2 @@ +
+
diff --git a/tests/test_build/test_build_book.html b/tests/test_build/test_build_book.sphinx3.html similarity index 100% rename from tests/test_build/test_build_book.html rename to tests/test_build/test_build_book.sphinx3.html diff --git a/tests/test_build/test_build_book.sphinx4.html b/tests/test_build/test_build_book.sphinx4.html new file mode 100644 index 00000000..1f59c340 --- /dev/null +++ b/tests/test_build/test_build_book.sphinx4.html @@ -0,0 +1,112 @@ + diff --git a/tox.ini b/tox.ini index 9a341539..4040f990 100644 --- a/tox.ini +++ b/tox.ini @@ -16,11 +16,11 @@ envlist = py37-sphinx3 [testenv] usedevelop=true -[testenv:py{36,37,38}-sphinx{2,3}] +[testenv:py{36,37,38}-sphinx{3,4}] extras = testing deps = - sphinx2: sphinx>=2,<3 sphinx3: sphinx>=3,<4 + sphinx4: sphinx>=4,<5 commands = pytest {posargs} [testenv:py{36,37,38}-pre-commit]