From 61084740a8e1d1ffe65f5231460e33f8ae19f42f Mon Sep 17 00:00:00 2001 From: Jarrod Millman Date: Wed, 8 Jun 2022 09:49:00 -0700 Subject: [PATCH 1/6] Require sphinx>4 --- .github/workflows/test.yml | 14 ++++---------- README.rst | 2 +- doc/install.rst | 2 +- numpydoc/__init__.py | 26 -------------------------- setup.py | 2 +- 5 files changed, 7 insertions(+), 39 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 39c61a5b..82ed4226 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,7 +13,8 @@ jobs: matrix: os: [Ubuntu] python-version: ["3.7", "3.8", "3.9", "3.10"] - sphinx-version: ["sphinx==3.0", "sphinx==4.0", "sphinx>4.4"] + sphinx-version: + ["sphinx==4.0.2", "sphinx==4.5", "sphinx==5.0", "sphinx>=5.0"] steps: - uses: actions/checkout@v3 @@ -30,10 +31,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 . @@ -70,7 +67,8 @@ jobs: matrix: os: [ubuntu, macos, windows] python-version: ["3.11-dev"] - sphinx-version: ["sphinx==4.0", "sphinx==4.5"] + sphinx-version: + ["sphinx==4.0.2", "sphinx==4.5", "sphinx==5.0", "sphinx>=5.0"] steps: - uses: actions/checkout@v3 @@ -86,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 7d6c34e5..631827a2 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.0.2+. For usage information, please refer to the `documentation `_. diff --git a/doc/install.rst b/doc/install.rst index fb3c26bf..939decd5 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.0.2+ and is available from: * `numpydoc on PyPI `_ * `numpydoc on GitHub `_ diff --git a/numpydoc/__init__.py b/numpydoc/__init__.py index 31cc4249..97f53053 100644 --- a/numpydoc/__init__.py +++ b/numpydoc/__init__.py @@ -5,32 +5,6 @@ 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 1b292c38..ac9a9a30 100644 --- a/setup.py +++ b/setup.py @@ -52,7 +52,7 @@ def read(fname): author_email="pav@iki.fi", url="https://numpydoc.readthedocs.io", license="BSD", - install_requires=["sphinx>=3.0", "Jinja2>=2.10"], + install_requires=["sphinx>=4.0.2", "Jinja2>=2.10"], python_requires=">=3.7", extras_require={ "testing": [ From 7d711c335ac44f692842e3ca0bc69891d4d2deb5 Mon Sep 17 00:00:00 2001 From: Jarrod Millman Date: Wed, 8 Jun 2022 09:54:29 -0700 Subject: [PATCH 2/6] Require sphinx>4.0.2 --- .github/workflows/test.yml | 4 ++-- README.rst | 2 +- doc/install.rst | 2 +- setup.py | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 82ed4226..9ade3ff0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,7 +14,7 @@ jobs: os: [Ubuntu] python-version: ["3.7", "3.8", "3.9", "3.10"] sphinx-version: - ["sphinx==4.0.2", "sphinx==4.5", "sphinx==5.0", "sphinx>=5.0"] + ["sphinx==4.0.3", "sphinx==4.5", "sphinx==5.0", "sphinx>=5.0"] steps: - uses: actions/checkout@v3 @@ -68,7 +68,7 @@ jobs: os: [ubuntu, macos, windows] python-version: ["3.11-dev"] sphinx-version: - ["sphinx==4.0.2", "sphinx==4.5", "sphinx==5.0", "sphinx>=5.0"] + ["sphinx==4.0.3", "sphinx==4.5", "sphinx==5.0", "sphinx>=5.0"] steps: - uses: actions/checkout@v3 diff --git a/README.rst b/README.rst index 631827a2..1502bc28 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 4.0.2+. +numpydoc requires Python 3.7+ and sphinx 4.0.3+. For usage information, please refer to the `documentation `_. diff --git a/doc/install.rst b/doc/install.rst index 939decd5..5e4516ae 100644 --- a/doc/install.rst +++ b/doc/install.rst @@ -5,7 +5,7 @@ Getting started Installation ============ -This extension requires Python 3.7+, sphinx 4.0.2+ and is available from: +This extension requires Python 3.7+, sphinx 4.0.3+ and is available from: * `numpydoc on PyPI `_ * `numpydoc on GitHub `_ diff --git a/setup.py b/setup.py index ac9a9a30..4bd9a389 100644 --- a/setup.py +++ b/setup.py @@ -52,7 +52,7 @@ def read(fname): author_email="pav@iki.fi", url="https://numpydoc.readthedocs.io", license="BSD", - install_requires=["sphinx>=4.0.2", "Jinja2>=2.10"], + install_requires=["sphinx>4.0.2", "Jinja2>=2.10"], python_requires=">=3.7", extras_require={ "testing": [ From 6257b480be0dd1ce653554429f484520a4915de5 Mon Sep 17 00:00:00 2001 From: Jarrod Millman Date: Wed, 8 Jun 2022 10:19:43 -0700 Subject: [PATCH 3/6] Python 3.10 requires sphinx>=4.2 --- .github/workflows/test.yml | 10 ++++++++-- README.rst | 2 +- doc/install.rst | 2 +- setup.py | 2 +- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9ade3ff0..30860eba 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,7 +14,13 @@ jobs: os: [Ubuntu] python-version: ["3.7", "3.8", "3.9", "3.10"] sphinx-version: - ["sphinx==4.0.3", "sphinx==4.5", "sphinx==5.0", "sphinx>=5.0"] + ["sphinx==4.0.2", "sphinx==4.5", "sphinx==5.0", "sphinx>=5.0"] + exclude: + - python-version: "3.10" + sphinx-version: "sphinx==4.0.2" + include: + - python-version: "3.10" + sphinx-version: "sphinx==4.2" steps: - uses: actions/checkout@v3 @@ -68,7 +74,7 @@ jobs: os: [ubuntu, macos, windows] python-version: ["3.11-dev"] sphinx-version: - ["sphinx==4.0.3", "sphinx==4.5", "sphinx==5.0", "sphinx>=5.0"] + ["sphinx==4.2", "sphinx==4.5", "sphinx==5.0", "sphinx>=5.0"] steps: - uses: actions/checkout@v3 diff --git a/README.rst b/README.rst index 1502bc28..631827a2 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 4.0.3+. +numpydoc requires Python 3.7+ and sphinx 4.0.2+. For usage information, please refer to the `documentation `_. diff --git a/doc/install.rst b/doc/install.rst index 5e4516ae..939decd5 100644 --- a/doc/install.rst +++ b/doc/install.rst @@ -5,7 +5,7 @@ Getting started Installation ============ -This extension requires Python 3.7+, sphinx 4.0.3+ and is available from: +This extension requires Python 3.7+, sphinx 4.0.2+ and is available from: * `numpydoc on PyPI `_ * `numpydoc on GitHub `_ diff --git a/setup.py b/setup.py index 4bd9a389..ac9a9a30 100644 --- a/setup.py +++ b/setup.py @@ -52,7 +52,7 @@ def read(fname): author_email="pav@iki.fi", url="https://numpydoc.readthedocs.io", license="BSD", - install_requires=["sphinx>4.0.2", "Jinja2>=2.10"], + install_requires=["sphinx>=4.0.2", "Jinja2>=2.10"], python_requires=">=3.7", extras_require={ "testing": [ From 75de8290525f032d64a58405213faf90e1ccfa59 Mon Sep 17 00:00:00 2001 From: Jarrod Millman Date: Wed, 8 Jun 2022 12:12:26 -0700 Subject: [PATCH 4/6] Get 4.2 running --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 30860eba..262a3ae4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -21,6 +21,7 @@ jobs: include: - python-version: "3.10" sphinx-version: "sphinx==4.2" + os: [Ubuntu] steps: - uses: actions/checkout@v3 From ed89b24159bf8d6c0d4f83281b467d741df7275c Mon Sep 17 00:00:00 2001 From: Jarrod Millman Date: Wed, 8 Jun 2022 12:17:01 -0700 Subject: [PATCH 5/6] Another try --- .github/workflows/test.yml | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 262a3ae4..e943ace3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,15 +13,19 @@ jobs: matrix: os: [Ubuntu] python-version: ["3.7", "3.8", "3.9", "3.10"] - sphinx-version: - ["sphinx==4.0.2", "sphinx==4.5", "sphinx==5.0", "sphinx>=5.0"] - exclude: - - python-version: "3.10" - sphinx-version: "sphinx==4.0.2" include: + - python-version: "3.7" + sphinx-version: + ["sphinx==4.0.2", "sphinx==4.5", "sphinx==5.0", "sphinx>=5.0"] + - python-version: "3.8" + sphinx-version: + ["sphinx==4.0.2", "sphinx==4.5", "sphinx==5.0", "sphinx>=5.0"] + - python-version: "3.9" + sphinx-version: + ["sphinx==4.0.2", "sphinx==4.5", "sphinx==5.0", "sphinx>=5.0"] - python-version: "3.10" - sphinx-version: "sphinx==4.2" - os: [Ubuntu] + sphinx-version: + ["sphinx==4.2", "sphinx==4.5", "sphinx==5.0", "sphinx>=5.0"] steps: - uses: actions/checkout@v3 From de7070edff95672649bd7767e64af1320c3f6ce8 Mon Sep 17 00:00:00 2001 From: Jarrod Millman Date: Wed, 8 Jun 2022 12:20:53 -0700 Subject: [PATCH 6/6] Try again --- .github/workflows/test.yml | 70 ++++++++++++++++++++++++++++++-------- 1 file changed, 56 insertions(+), 14 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e943ace3..3b58a86d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,20 +12,9 @@ jobs: strategy: matrix: os: [Ubuntu] - python-version: ["3.7", "3.8", "3.9", "3.10"] - include: - - python-version: "3.7" - sphinx-version: - ["sphinx==4.0.2", "sphinx==4.5", "sphinx==5.0", "sphinx>=5.0"] - - python-version: "3.8" - sphinx-version: - ["sphinx==4.0.2", "sphinx==4.5", "sphinx==5.0", "sphinx>=5.0"] - - python-version: "3.9" - sphinx-version: - ["sphinx==4.0.2", "sphinx==4.5", "sphinx==5.0", "sphinx>=5.0"] - - python-version: "3.10" - sphinx-version: - ["sphinx==4.2", "sphinx==4.5", "sphinx==5.0", "sphinx>=5.0"] + python-version: ["3.7", "3.8", "3.9"] + sphinx-version: + ["sphinx==4.0.2", "sphinx==4.5", "sphinx==5.0", "sphinx>=5.0"] steps: - uses: actions/checkout@v3 @@ -72,6 +61,59 @@ jobs: 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"] + sphinx-version: + ["sphinx==4.2", "sphinx==4.5", "sphinx==5.0", "sphinx>=5.0"] + steps: + - uses: actions/checkout@v3 + + - name: Python setup + uses: actions/setup-python@v3 + 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: 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" base: runs-on: ${{ matrix.os }}-latest strategy: