From 3513a715d0bcfd31a5e488fb1c357395849bb06a Mon Sep 17 00:00:00 2001 From: Jarrod Millman Date: Fri, 29 Jul 2022 15:36:28 -0700 Subject: Require sphinx>=4.2 (#411) --- .github/workflows/test.yml | 75 +++------------------------------------------- README.rst | 2 +- doc/install.rst | 2 +- numpydoc/__init__.py | 26 ---------------- setup.py | 2 +- 5 files changed, 7 insertions(+), 100 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e144eab..437afca 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,72 +12,7 @@ jobs: strategy: matrix: os: [Ubuntu] - python-version: ["3.7", "3.8", "3.9"] - sphinx-version: - [ - "sphinx==3.0", - "sphinx==3.5", - "sphinx==4.0", - "sphinx==4.5", - "sphinx==5.0", - "sphinx>=5.0", - ] - steps: - - uses: actions/checkout@v3 - - - name: Python setup - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - - name: Setup environment - run: | - python -m pip install --upgrade pip wheel setuptools - python -m pip install -r requirements/test.txt -r doc/requirements.txt - python -m pip install codecov - python -m pip install ${{ matrix.sphinx-version }} - python -m pip list - - - name: Downgrade Jinja2 for sphinx<4 - if: ${{ matrix.sphinx-version }} == 'sphinx<4.0.2' - run: python -m pip install jinja2==3.0.3 markupsafe==2.0.1 pydata-sphinx-theme==0.8.0 docutils==0.17.1 - - - name: Install - run: | - python -m pip install . - pip list - - - name: Run test suite - run: | - pytest -v --pyargs . - - - name: Test coverage - run: | - codecov - - - name: Make sure CLI works - run: | - python -m numpydoc numpydoc.tests.test_main._capture_stdout - echo '! python -m numpydoc numpydoc.tests.test_main._invalid_docstring' | bash - python -m numpydoc --validate numpydoc.tests.test_main._capture_stdout - echo '! python -m numpydoc --validate numpydoc.tests.test_main._docstring_with_errors' | bash - - - name: Setup for doc build - run: | - sudo apt-get update - sudo apt install texlive texlive-latex-extra latexmk dvipng - - - name: Build documentation - run: | - make -C doc html SPHINXOPTS="-nT" - make -C doc latexpdf SPHINXOPTS="-nT" - - test-new: - runs-on: ${{ matrix.os }}-latest - strategy: - matrix: - os: [Ubuntu] - python-version: ["3.10"] + python-version: ["3.7", "3.8", "3.9", "3.10"] sphinx-version: ["sphinx==4.2", "sphinx==4.5", "sphinx==5.0", "sphinx>=5.0"] steps: @@ -125,13 +60,15 @@ jobs: run: | make -C doc html SPHINXOPTS="-nT" make -C doc latexpdf SPHINXOPTS="-nT" + base: runs-on: ${{ matrix.os }}-latest strategy: matrix: os: [ubuntu, macos, windows] python-version: ["3.11-dev"] - sphinx-version: ["sphinx==4.0", "sphinx==4.5"] + sphinx-version: + ["sphinx==4.2", "sphinx==4.5", "sphinx==5.0", "sphinx>=5.0"] steps: - uses: actions/checkout@v3 @@ -147,10 +84,6 @@ jobs: python -m pip install ${{ matrix.sphinx-version }} python -m pip list - - name: Downgrade Jinja2 for sphinx<4 - if: ${{ matrix.sphinx-version }} == 'sphinx<4.0.2' - run: python -m pip install jinja2==3.0.3 markupsafe==2.0.1 pydata-sphinx-theme==0.8.0 - - name: Install run: | python -m pip install . diff --git a/README.rst b/README.rst index 7d6c34e..e9bdabb 100644 --- a/README.rst +++ b/README.rst @@ -18,7 +18,7 @@ docstrings formatted according to the NumPy documentation format. The extension also adds the code description directives ``np:function``, ``np-c:function``, etc. -numpydoc requires Python 3.7+ and sphinx 3.0+. +numpydoc requires Python 3.7+ and sphinx 4.2+. For usage information, please refer to the `documentation `_. diff --git a/doc/install.rst b/doc/install.rst index 28b75a0..a0bc076 100644 --- a/doc/install.rst +++ b/doc/install.rst @@ -5,7 +5,7 @@ Getting started Installation ============ -This extension requires Python 3.7+, sphinx 3.0+ and is available from: +This extension requires Python 3.7+, sphinx 4.2+ and is available from: * `numpydoc on PyPI `_ * `numpydoc on GitHub `_ diff --git a/numpydoc/__init__.py b/numpydoc/__init__.py index 31cc424..97f5305 100644 --- a/numpydoc/__init__.py +++ b/numpydoc/__init__.py @@ -5,32 +5,6 @@ formatted according to the NumPy documentation format. from ._version import __version__ -def _verify_sphinx_jinja(): - """Ensure sphinx and jinja versions are compatible. - - Jinja2>=3.1 requires Sphinx>=4.0.2. Raises exception if this condition is - not met. - - TODO: This check can be removed when the minimum supported sphinx version - for numpydoc sphinx>=4.0.2 - """ - import sphinx, jinja2 - from packaging import version - - if version.parse(sphinx.__version__) <= version.parse("4.0.2"): - if version.parse(jinja2.__version__) >= version.parse("3.1"): - from sphinx.errors import VersionRequirementError - - raise VersionRequirementError( - "\n\nSphinx<4.0.2 is incompatible with Jinja2>=3.1.\n" - "If you wish to continue using sphinx<4.0.2 you need to pin " - "Jinja2<3.1." - ) - - -_verify_sphinx_jinja() - - def setup(app, *args, **kwargs): from .numpydoc import setup diff --git a/setup.py b/setup.py index 1b292c3..e5c13d0 100644 --- a/setup.py +++ b/setup.py @@ -52,7 +52,7 @@ setup( author_email="pav@iki.fi", url="https://numpydoc.readthedocs.io", license="BSD", - install_requires=["sphinx>=3.0", "Jinja2>=2.10"], + install_requires=["sphinx>=4.2", "Jinja2>=2.10"], python_requires=">=3.7", extras_require={ "testing": [ -- cgit v1.2.1