diff options
| -rw-r--r-- | azure-pipelines.yml | 2 | ||||
| -rw-r--r-- | doc/source/conf.py | 9 | ||||
| -rw-r--r-- | doc_requirements.txt | 6 | ||||
| -rw-r--r-- | environment.yml | 8 | ||||
| -rw-r--r-- | tools/refguide_check.py | 19 |
5 files changed, 15 insertions, 29 deletions
diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 761da0833..1c3b06ffb 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -176,7 +176,7 @@ stages: - script: | python -m pip install -r test_requirements.txt # Don't use doc_requirements.txt since that messes up tests - python -m pip install vulture sphinx==4.2.0 numpydoc==1.2.0 + python -m pip install vulture sphinx==4.3.0 numpydoc==1.4.0 displayName: 'Install dependencies; some are optional to avoid test skips' - script: /bin/bash -c "! vulture . --min-confidence 100 --exclude doc/,numpy/distutils/ | grep 'unreachable'" displayName: 'Check for unreachable code paths in Python modules' diff --git a/doc/source/conf.py b/doc/source/conf.py index ef31cfaac..bca0b846a 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -4,7 +4,7 @@ import sys import importlib # Minimum version, enforced by sphinx -needs_sphinx = '3.2.0' +needs_sphinx = '4.3' # This is a nasty hack to use platform-agnostic names for types in the @@ -103,9 +103,6 @@ templates_path = ['_templates'] # The suffix of source filenames. source_suffix = '.rst' -# Will change to `root_doc` in Sphinx 4 -master_doc = 'index' - # General substitutions. project = 'NumPy' copyright = '2008-2022, NumPy Developers' @@ -182,7 +179,6 @@ else: switcher_version = f"doc/{version}" html_theme_options = { - "logo_link": "index", "github_url": "https://github.com/numpy/numpy", "twitter_url": "https://twitter.com/numpy_team", "collapse_navigation": True, @@ -190,7 +186,7 @@ html_theme_options = { {"name": "Learn", "url": "https://numpy.org/numpy-tutorials/"} ], # Add light/dark mode and documentation version switcher: - "navbar_end": ["version-switcher", "navbar-icon-links"], + "navbar_end": ["theme-switcher", "version-switcher", "navbar-icon-links"], "switcher": { "version_match": switcher_version, "json_url": "https://numpy.org/doc/_static/versions.json", @@ -201,6 +197,7 @@ html_title = "%s v%s Manual" % (project, version) html_static_path = ['_static'] html_last_updated_fmt = '%b %d, %Y' html_css_files = ["numpy.css"] +html_context = {"default_mode": "light"} # Prevent sphinx-panels from loading bootstrap css, the pydata-sphinx-theme # already loads it diff --git a/doc_requirements.txt b/doc_requirements.txt index dbc9f40cd..e3c4f6d71 100644 --- a/doc_requirements.txt +++ b/doc_requirements.txt @@ -1,7 +1,7 @@ # doxygen required, use apt-get or dnf -sphinx==4.5.0 -numpydoc==1.3.1 -pydata-sphinx-theme==0.8.1 +sphinx>=4.5.0 +numpydoc==1.4 +pydata-sphinx-theme==0.9.0 sphinx-panels ipython!=8.1.0 scipy diff --git a/environment.yml b/environment.yml index 24bf73839..dd5f17ef9 100644 --- a/environment.yml +++ b/environment.yml @@ -22,17 +22,17 @@ dependencies: - mypy=0.950 - typing_extensions>=4.2.0 # For building docs - - sphinx=4.5.0 + - sphinx>=4.5.0 - sphinx-panels - - numpydoc=1.3.1 + - numpydoc=1.4.0 - ipython - scipy - pandas - matplotlib - - pydata-sphinx-theme=0.8.1 + - pydata-sphinx-theme=0.9.0 - doxygen # NOTE: breathe 4.33.0 collides with sphinx.ext.graphviz - - breathe!=4.33.0 + - breathe>4.33.0 # For linting - pycodestyle=2.7.0 - gitpython diff --git a/tools/refguide_check.py b/tools/refguide_check.py index 47a77ab6d..6174c5060 100644 --- a/tools/refguide_check.py +++ b/tools/refguide_check.py @@ -42,7 +42,6 @@ from contextlib import contextmanager, redirect_stderr from doctest import NORMALIZE_WHITESPACE, ELLIPSIS, IGNORE_EXCEPTION_DETAIL from docutils.parsers.rst import directives -from pkg_resources import parse_version import sphinx import numpy as np @@ -52,20 +51,10 @@ from numpydoc.docscrape_sphinx import get_doc_object SKIPBLOCK = doctest.register_optionflag('SKIPBLOCK') -if parse_version(sphinx.__version__) >= parse_version('1.5'): - # Enable specific Sphinx directives - from sphinx.directives.other import SeeAlso, Only - directives.register_directive('seealso', SeeAlso) - directives.register_directive('only', Only) -else: - # Remove sphinx directives that don't run without Sphinx environment. - # Sphinx < 1.5 installs all directives on import... - directives._directives.pop('versionadded', None) - directives._directives.pop('versionchanged', None) - directives._directives.pop('moduleauthor', None) - directives._directives.pop('sectionauthor', None) - directives._directives.pop('codeauthor', None) - directives._directives.pop('toctree', None) +# Enable specific Sphinx directives +from sphinx.directives.other import SeeAlso, Only +directives.register_directive('seealso', SeeAlso) +directives.register_directive('only', Only) BASE_MODULE = "numpy" |
