diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 55230e6b..b19980a6 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 3.8.2 +current_version = 4.0.0 commit = True tag = True diff --git a/.github/workflows/conda_ci.yml b/.github/workflows/conda_ci.yml index fe2abc65..1e82964b 100644 --- a/.github/workflows/conda_ci.yml +++ b/.github/workflows/conda_ci.yml @@ -58,7 +58,7 @@ jobs: - name: "Install package" run: | - $CONDA/bin/conda install -c file://$(pwd)/conda-bld sphinx-toolbox=3.8.2=py_1 -y || exit 1 + $CONDA/bin/conda install -c file://$(pwd)/conda-bld sphinx-toolbox=4.0.0=py_1 -y || exit 1 - name: "Run Tests" run: | diff --git a/.github/workflows/flake8.yml b/.github/workflows/flake8.yml index 0a8c0c3e..af1b3940 100644 --- a/.github/workflows/flake8.yml +++ b/.github/workflows/flake8.yml @@ -16,7 +16,7 @@ permissions: jobs: Run: name: "Flake8" - runs-on: "ubuntu-20.04" + runs-on: "ubuntu-22.04" steps: - name: Checkout 🛎️ diff --git a/.github/workflows/mypy.yml b/.github/workflows/mypy.yml index 10c6f300..df78eb0e 100644 --- a/.github/workflows/mypy.yml +++ b/.github/workflows/mypy.yml @@ -20,7 +20,7 @@ jobs: strategy: matrix: - os: ['ubuntu-20.04', 'windows-2019'] + os: ['ubuntu-22.04', 'windows-2022'] fail-fast: false steps: diff --git a/.github/workflows/python_ci.yml b/.github/workflows/python_ci.yml index 0154c4e4..2a949daa 100644 --- a/.github/workflows/python_ci.yml +++ b/.github/workflows/python_ci.yml @@ -18,8 +18,8 @@ permissions: jobs: tests: - name: "windows-2019 / Python ${{ matrix.config.python-version }}" - runs-on: "windows-2019" + name: "windows-2022 / Python ${{ matrix.config.python-version }}" + runs-on: "windows-2022" continue-on-error: ${{ matrix.config.experimental }} env: USING_COVERAGE: '3.7,3.8,3.9,3.10,3.11,3.12,3.13,pypy-3.7,pypy-3.8,pypy-3.9' @@ -31,10 +31,10 @@ jobs: - {python-version: "3.7", testenvs: "py37-sphinx{3.2,3.3,3.4,3.5,4.0,4.1,4.2,4.3,4.4,4.5,5.0,5.1,5.2,5.3},build", experimental: False} - {python-version: "3.8", testenvs: "py38-sphinx{3.2,3.3,3.4,3.5,4.0,4.1,4.2,4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1},build", experimental: False} - {python-version: "3.9", testenvs: "py39-sphinx{3.2,3.3,3.4,3.5,4.0,4.1,4.2,4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1,7.2,7.3,7.4},build", experimental: False} - - {python-version: "3.10", testenvs: "py310-sphinx{3.2,3.3,3.4,3.5,4.0,4.1,4.2,4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1,7.2,7.3,7.4,8.0},build", experimental: False} - - {python-version: "3.11", testenvs: "py311-sphinx{3.2,3.3,3.4,3.5,4.0,4.1,4.2,4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1,7.2,7.3,7.4,8.0},build", experimental: False} - - {python-version: "3.12", testenvs: "py312-sphinx{3.2,3.3,3.4,3.5,4.0,4.1,4.2,4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1,7.2,7.3,7.4,8.0},build", experimental: False} - - {python-version: "3.13", testenvs: "py313-dev-sphinx{6.2,7.0,7.1,7.2,7.3,7.4,8.0},build", experimental: True} + - {python-version: "3.10", testenvs: "py310-sphinx{3.2,3.3,3.4,3.5,4.0,4.1,4.2,4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1,7.2,7.3,7.4,8.0,8.1},build", experimental: False} + - {python-version: "3.11", testenvs: "py311-sphinx{3.2,3.3,3.4,3.5,4.0,4.1,4.2,4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1,7.2,7.3,7.4,8.0,8.1,8.2},build", experimental: False} + - {python-version: "3.12", testenvs: "py312-sphinx{4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1,7.2,7.3,7.4,8.0,8.1,8.2},build", experimental: False} + - {python-version: "3.13", testenvs: "py313-sphinx{6.2,7.0,7.1,7.2,7.3,7.4,8.0,8.1,8.2},build", experimental: False} - {python-version: "pypy-3.7", testenvs: "pypy37-sphinx{4.3,4.4,4.5,5.0,5.1,5.2,5.3},build", experimental: False} - {python-version: "pypy-3.8", testenvs: "pypy38-sphinx{4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1},build", experimental: False} - {python-version: "pypy-3.9-v7.3.15", testenvs: "pypy39-sphinx{4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1,7.2,7.3,7.4},build", experimental: True} @@ -78,3 +78,4 @@ jobs: with: name: "coverage-${{ matrix.config.python-version }}" path: .coverage + include-hidden-files: true diff --git a/.github/workflows/python_ci_linux.yml b/.github/workflows/python_ci_linux.yml index 3f5e27cc..5ec9af63 100644 --- a/.github/workflows/python_ci_linux.yml +++ b/.github/workflows/python_ci_linux.yml @@ -19,8 +19,8 @@ permissions: jobs: tests: - name: "ubuntu-20.04 / Python ${{ matrix.config.python-version }}" - runs-on: "ubuntu-20.04" + name: "ubuntu-22.04 / Python ${{ matrix.config.python-version }}" + runs-on: "ubuntu-22.04" continue-on-error: ${{ matrix.config.experimental }} env: USING_COVERAGE: '3.7,3.8,3.9,3.10,3.11,3.12,3.13,pypy-3.7,pypy-3.8,pypy-3.9' @@ -32,10 +32,10 @@ jobs: - {python-version: "3.7", testenvs: "py37-sphinx{3.2,3.3,3.4,3.5,4.0,4.1,4.2,4.3,4.4,4.5,5.0,5.1,5.2,5.3},build", experimental: False} - {python-version: "3.8", testenvs: "py38-sphinx{3.2,3.3,3.4,3.5,4.0,4.1,4.2,4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1},build", experimental: False} - {python-version: "3.9", testenvs: "py39-sphinx{3.2,3.3,3.4,3.5,4.0,4.1,4.2,4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1,7.2,7.3,7.4},build", experimental: False} - - {python-version: "3.10", testenvs: "py310-sphinx{3.2,3.3,3.4,3.5,4.0,4.1,4.2,4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1,7.2,7.3,7.4,8.0},build", experimental: False} - - {python-version: "3.11", testenvs: "py311-sphinx{3.2,3.3,3.4,3.5,4.0,4.1,4.2,4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1,7.2,7.3,7.4,8.0},build", experimental: False} - - {python-version: "3.12", testenvs: "py312-sphinx{3.2,3.3,3.4,3.5,4.0,4.1,4.2,4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1,7.2,7.3,7.4,8.0},build", experimental: False} - - {python-version: "3.13", testenvs: "py313-dev-sphinx{6.2,7.0,7.1,7.2,7.3,7.4,8.0},build", experimental: True} + - {python-version: "3.10", testenvs: "py310-sphinx{3.2,3.3,3.4,3.5,4.0,4.1,4.2,4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1,7.2,7.3,7.4,8.0,8.1},build", experimental: False} + - {python-version: "3.11", testenvs: "py311-sphinx{3.2,3.3,3.4,3.5,4.0,4.1,4.2,4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1,7.2,7.3,7.4,8.0,8.1,8.2},build", experimental: False} + - {python-version: "3.12", testenvs: "py312-sphinx{4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1,7.2,7.3,7.4,8.0,8.1,8.2},build", experimental: False} + - {python-version: "3.13", testenvs: "py313-sphinx{6.2,7.0,7.1,7.2,7.3,7.4,8.0,8.1,8.2},build", experimental: False} - {python-version: "pypy-3.7", testenvs: "pypy37-sphinx{4.3,4.4,4.5,5.0,5.1,5.2,5.3},build", experimental: False} - {python-version: "pypy-3.8", testenvs: "pypy38-sphinx{4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1},build", experimental: False} - {python-version: "pypy-3.9", testenvs: "pypy39-sphinx{4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1,7.2,7.3,7.4},build", experimental: True} @@ -80,11 +80,12 @@ jobs: with: name: "coverage-${{ matrix.config.python-version }}" path: .coverage + include-hidden-files: true Coverage: needs: tests - runs-on: "ubuntu-20.04" + runs-on: "ubuntu-22.04" steps: - name: Checkout 🛎️ uses: "actions/checkout@v4" @@ -122,6 +123,7 @@ jobs: with: name: "combined-coverage" path: .coverage + include-hidden-files: true - name: "Upload Combined Coverage to Coveralls" if: ${{ steps.show.outcome != 'failure' }} @@ -133,7 +135,7 @@ jobs: Deploy: needs: tests - runs-on: "ubuntu-20.04" + runs-on: "ubuntu-22.04" steps: - name: Checkout 🛎️ uses: "actions/checkout@v4" @@ -207,6 +209,7 @@ jobs: $CONDA/bin/conda config --set always_yes yes --set changeps1 no $CONDA/bin/conda update -n base conda $CONDA/bin/conda info -a + $CONDA/bin/conda install conda-forge::py-lief=0.14.1 $CONDA/bin/conda config --add channels conda-forge $CONDA/bin/conda config --add channels domdfcoding diff --git a/.github/workflows/python_ci_macos.yml b/.github/workflows/python_ci_macos.yml index 09f5af5b..a81ed7a4 100644 --- a/.github/workflows/python_ci_macos.yml +++ b/.github/workflows/python_ci_macos.yml @@ -18,8 +18,8 @@ permissions: jobs: tests: - name: "macos-13 / Python ${{ matrix.config.python-version }}" - runs-on: "macos-13" + name: "macos-${{ matrix.config.os-ver }} / Python ${{ matrix.config.python-version }}" + runs-on: "macos-${{ matrix.config.os-ver }}" continue-on-error: ${{ matrix.config.experimental }} env: USING_COVERAGE: '3.7,3.8,3.9,3.10,3.11,3.12,3.13,pypy-3.7,pypy-3.8,pypy-3.9' @@ -28,16 +28,16 @@ jobs: fail-fast: False matrix: config: - - {python-version: "3.7", testenvs: "py37-sphinx{3.2,3.3,3.4,3.5,4.0,4.1,4.2,4.3,4.4,4.5,5.0,5.1,5.2,5.3},build", experimental: False} - - {python-version: "3.8", testenvs: "py38-sphinx{3.2,3.3,3.4,3.5,4.0,4.1,4.2,4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1},build", experimental: False} - - {python-version: "3.9", testenvs: "py39-sphinx{3.2,3.3,3.4,3.5,4.0,4.1,4.2,4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1,7.2,7.3,7.4},build", experimental: False} - - {python-version: "3.10", testenvs: "py310-sphinx{3.2,3.3,3.4,3.5,4.0,4.1,4.2,4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1,7.2,7.3,7.4,8.0},build", experimental: False} - - {python-version: "3.11", testenvs: "py311-sphinx{3.2,3.3,3.4,3.5,4.0,4.1,4.2,4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1,7.2,7.3,7.4,8.0},build", experimental: False} - - {python-version: "3.12", testenvs: "py312-sphinx{3.2,3.3,3.4,3.5,4.0,4.1,4.2,4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1,7.2,7.3,7.4,8.0},build", experimental: False} - - {python-version: "3.13", testenvs: "py313-dev-sphinx{6.2,7.0,7.1,7.2,7.3,7.4,8.0},build", experimental: True} - - {python-version: "pypy-3.7", testenvs: "pypy37-sphinx{4.3,4.4,4.5,5.0,5.1,5.2,5.3},build", experimental: False} - - {python-version: "pypy-3.8", testenvs: "pypy38-sphinx{4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1},build", experimental: False} - - {python-version: "pypy-3.9", testenvs: "pypy39-sphinx{4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1,7.2,7.3,7.4},build", experimental: True} + - {python-version: "3.7", os-ver: "13", testenvs: "py37-sphinx{3.2,3.3,3.4,3.5,4.0,4.1,4.2,4.3,4.4,4.5,5.0,5.1,5.2,5.3},build", experimental: False} + - {python-version: "3.8", os-ver: "14", testenvs: "py38-sphinx{3.2,3.3,3.4,3.5,4.0,4.1,4.2,4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1},build", experimental: False} + - {python-version: "3.9", os-ver: "14", testenvs: "py39-sphinx{3.2,3.3,3.4,3.5,4.0,4.1,4.2,4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1,7.2,7.3,7.4},build", experimental: False} + - {python-version: "3.10", os-ver: "14", testenvs: "py310-sphinx{3.2,3.3,3.4,3.5,4.0,4.1,4.2,4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1,7.2,7.3,7.4,8.0,8.1},build", experimental: False} + - {python-version: "3.11", os-ver: "14", testenvs: "py311-sphinx{3.2,3.3,3.4,3.5,4.0,4.1,4.2,4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1,7.2,7.3,7.4,8.0,8.1,8.2},build", experimental: False} + - {python-version: "3.12", os-ver: "14", testenvs: "py312-sphinx{4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1,7.2,7.3,7.4,8.0,8.1,8.2},build", experimental: False} + - {python-version: "3.13", os-ver: "14", testenvs: "py313-sphinx{6.2,7.0,7.1,7.2,7.3,7.4,8.0,8.1,8.2},build", experimental: False} + - {python-version: "pypy-3.7", os-ver: "13", testenvs: "pypy37-sphinx{4.3,4.4,4.5,5.0,5.1,5.2,5.3},build", experimental: False} + - {python-version: "pypy-3.8", os-ver: "14", testenvs: "pypy38-sphinx{4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1},build", experimental: False} + - {python-version: "pypy-3.9", os-ver: "14", testenvs: "pypy39-sphinx{4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1,7.2,7.3,7.4},build", experimental: True} steps: - name: Checkout 🛎️ @@ -78,3 +78,4 @@ jobs: with: name: "coverage-${{ matrix.config.python-version }}" path: .coverage + include-hidden-files: true diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index afdbd3fc..f18ff793 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -8,7 +8,7 @@ ci: repos: - repo: https://github.com/repo-helper/pyproject-parser - rev: v0.11.1 + rev: v0.13.0 hooks: - id: reformat-pyproject diff --git a/.readthedocs.yml b/.readthedocs.yml index 6228096d..9b98a4d1 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -14,7 +14,7 @@ python: - requirements: doc-source/requirements.txt - requirements: doc-source/rtd-extra-deps.txt build: - os: ubuntu-20.04 + os: ubuntu-22.04 tools: python: '3.9' jobs: diff --git a/README.rst b/README.rst index 8726af9f..16350b21 100644 --- a/README.rst +++ b/README.rst @@ -101,7 +101,7 @@ sphinx-toolbox .. |language| image:: https://img.shields.io/github/languages/top/sphinx-toolbox/sphinx-toolbox :alt: GitHub top language -.. |commits-since| image:: https://img.shields.io/github/commits-since/sphinx-toolbox/sphinx-toolbox/v3.8.2 +.. |commits-since| image:: https://img.shields.io/github/commits-since/sphinx-toolbox/sphinx-toolbox/v4.0.0 :target: https://github.com/sphinx-toolbox/sphinx-toolbox/pulse :alt: GitHub commits since tagged version @@ -109,7 +109,7 @@ sphinx-toolbox :target: https://github.com/sphinx-toolbox/sphinx-toolbox/commit/master :alt: GitHub last commit -.. |maintained| image:: https://img.shields.io/maintenance/yes/2024 +.. |maintained| image:: https://img.shields.io/maintenance/yes/2025 :alt: Maintenance .. |pypi-downloads| image:: https://img.shields.io/pypi/dm/sphinx-toolbox diff --git a/doc-source/changelog.rst b/doc-source/changelog.rst index 34bf5c19..51ade85d 100644 --- a/doc-source/changelog.rst +++ b/doc-source/changelog.rst @@ -2,6 +2,43 @@ Changelog =============== +4.0.0 +---------------------- + +The :mod:`sphinx_toolbox.source` module no longer enables the :mod:`sphinx_toolbox.github` extension automatically. +If you have :confval:`source_link_target` set to ``'GitHub'`` you may need to enable the extension manually. + + +3.10.0 +---------------------- + +Allow GitHub branch to be specified for :rst:dir:`installation` directive. + + +3.9.0 +---------------------- + +Improved support for Sphinx 8.1+ + + +3.8.2 +---------------------- + +(BUG) Fix GitHub issue title parsing. + +3.8.0 +---------------------- + +Improved support for Sphinx 7.3+ + + +3.7.0 +---------------------- + +* Add :class:`sphinx_toolbox.more_autodoc.variables.PropertyDocumenter`. +* Use sphinx's ``HTML5Translator`` over ``HTMLTranslator``. + + 3.6.0 ---------------------- diff --git a/doc-source/index.rst b/doc-source/index.rst index d5e8d8aa..c1c337f7 100644 --- a/doc-source/index.rst +++ b/doc-source/index.rst @@ -107,14 +107,14 @@ sphinx-toolbox :alt: GitHub top language .. |commits-since| github-shield:: - :commits-since: v3.8.2 + :commits-since: v4.0.0 :alt: GitHub commits since tagged version .. |commits-latest| github-shield:: :last-commit: :alt: GitHub last commit - .. |maintained| maintained-shield:: 2024 + .. |maintained| maintained-shield:: 2025 :alt: Maintenance .. |pypi-downloads| pypi-shield:: diff --git a/pyproject.toml b/pyproject.toml index ec38e75e..ee7227c7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "whey" [project] name = "sphinx-toolbox" -version = "3.8.2" +version = "4.0.0" description = "Box of handy tools for Sphinx 🧰 📔" readme = "README.rst" keywords = [ "documentation", "sphinx", "sphinx-extension",] @@ -39,7 +39,7 @@ base-classifiers = [ "Topic :: Utilities", "Typing :: Typed", ] -python-versions = [ "3.7", "3.8", "3.9", "3.10", "3.11", "3.12",] +python-versions = [ "3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13",] python-implementations = [ "CPython", "PyPy",] platforms = [ "Windows", "macOS", "Linux",] license-key = "MIT" diff --git a/repo_helper.yml b/repo_helper.yml index 6f8378f9..23731a23 100644 --- a/repo_helper.yml +++ b/repo_helper.yml @@ -7,7 +7,7 @@ email: 'dominic@davis-foster.co.uk' username: 'sphinx-toolbox' assignee: 'domdfcoding' primary_conda_channel: 'domdfcoding' -version: '3.8.2' +version: '4.0.0' license: 'MIT' short_desc: 'Box of handy tools for Sphinx 🧰 📔' @@ -35,6 +35,8 @@ python_versions: - 7.3 - 7.4 - 8.0 + - 8.1 + - 8.2 - latest 3.8: matrix_exclude: @@ -43,15 +45,32 @@ python_versions: - 7.3 - 7.4 - 8.0 + - 8.1 + - 8.2 - latest 3.9: matrix_exclude: sphinx: - 8.0 + - 8.1 + - 8.2 "3.10": + matrix_exclude: + sphinx: + - 8.2 "3.11": "3.12": - 3.13-dev: + matrix_exclude: + sphinx: + - 3.2 + - 3.3 + - 3.4 + - 3.5 + - 4.0 + - 4.1 + - 4.2 + - 4.3 + "3.13": matrix_exclude: sphinx: - 3.2 @@ -89,6 +108,8 @@ python_versions: - 7.3 - 7.4 - 8.0 + - 8.1 + - 8.2 - latest pypy38: matrix_exclude: @@ -104,6 +125,8 @@ python_versions: - 7.3 - 7.4 - 8.0 + - 8.1 + - 8.2 - latest pypy39: matrix_exclude: @@ -116,6 +139,8 @@ python_versions: - 4.1 - 4.2 - 8.0 + - 8.1 + - 8.2 - latest additional_ignore: @@ -137,10 +162,6 @@ extra_sphinx_extensions: - sphinx_toolbox.latex.succinct_seealso - sphinx_toolbox.more_autosummary.column_widths -tox_unmanaged: - - pytest - - testenv - sphinx_conf_epilogue: - html_logo = "../sphinx_toolbox.png" - toctree_plus_types.add("fixture") @@ -180,6 +201,8 @@ third_party_version_matrix: - 7.3 - 7.4 - 8.0 + - 8.1 + - 8.2 # - latest classifiers: @@ -201,3 +224,4 @@ intersphinx_mapping: exclude_files: - contributing - doc_requirements + - tox diff --git a/sphinx_toolbox/__init__.py b/sphinx_toolbox/__init__.py index f9a682d8..cb6487e0 100644 --- a/sphinx_toolbox/__init__.py +++ b/sphinx_toolbox/__init__.py @@ -57,7 +57,7 @@ __author__: str = "Dominic Davis-Foster" __copyright__: str = "2020 Dominic Davis-Foster" __license__: str = "MIT License" -__version__: str = "3.8.2" +__version__: str = "4.0.0" __email__: str = "dominic@davis-foster.co.uk" __all__ = ("setup", ) diff --git a/sphinx_toolbox/installation.py b/sphinx_toolbox/installation.py index 8f4e9ebf..e8c54f01 100644 --- a/sphinx_toolbox/installation.py +++ b/sphinx_toolbox/installation.py @@ -62,6 +62,18 @@ Flag to indicate the project can be installed from GitHub. + The branch name defaults to ``master``, but a different branch name or a tag can be specified as follows: + + .. code-block:: rst + + .. installation: foo + :github: dev + + .. installation: bar + :github: v1.2.3 + + .. versionchanged:: 3.10.0 Allow branch name to be specified. + To use this option add the following to your ``conf.py``: .. code-block:: python @@ -377,7 +389,14 @@ def conda_installation( return list(lines) -@sources.register("github", "GitHub", flag) +def _validate_github_branch(branch: Optional[str]) -> str: + if isinstance(branch, str): + return str(branch) + else: + return "master" + + +@sources.register("github", "GitHub", _validate_github_branch) def github_installation( options: Dict[str, Any], env: sphinx.environment.BuildEnvironment, @@ -403,10 +422,12 @@ def github_installation( if repository is None: raise ValueError("'github_repository' has not been set in 'conf.py'!") + branch = options.get("github", "master") + return [ ".. prompt:: bash", '', - f" python3 -m pip install git+https://github.com/{username}/{repository}@master --user" + f" python3 -m pip install git+https://github.com/{username}/{repository}@{branch} --user" ] @@ -531,15 +552,20 @@ def make_installation_instructions(options: Dict[str, Any], env: BuildEnvironmen warnings.warn("No installation source specified. No installation instructions will be shown.") return [] - content = StringList([".. tabs::", '']) + content = StringList([ + ".. container:: st-installation", + '', + " .. tabs::", + '', + ]) content.set_indent_type(" ") for tab_name, tab_content in tabs.items(): - with content.with_indent_size(1): + with content.with_indent_size(2): content.append(f".. tab:: {tab_name}") content.blankline(ensure_single=True) - with content.with_indent_size(2): + with content.with_indent_size(3): content.extend([f"{line}" if line else '' for line in tab_content]) # pylint: disable=loop-invariant-statement return list(content) @@ -683,7 +709,7 @@ def copy_asset_files(app: Sphinx, exception: Optional[Exception] = None) -> None " const parent = target.parentNode;", " const grandparent = parent.parentNode;", '', - ' if (parent.parentNode.parentNode.getAttribute("id").startsWith("installation")) {', + ' if (grandparent.parentNode.classList.contains("st-installation")) {', '', " // Hide all tabs in current tablist, but not nested", " Array.from(parent.children).forEach(t => {", diff --git a/sphinx_toolbox/more_autodoc/autotypeddict.py b/sphinx_toolbox/more_autodoc/autotypeddict.py index b39c40ca..15696fa4 100644 --- a/sphinx_toolbox/more_autodoc/autotypeddict.py +++ b/sphinx_toolbox/more_autodoc/autotypeddict.py @@ -320,7 +320,47 @@ def document_members(self, all_members: bool = False) -> None: Generate reST for member documentation. All members are always documented. """ - super().document_members(True) + if sphinx.version_info >= (8, 2): + # set current namespace for finding members + self._current_document.autodoc_module = self.modname # type: ignore[attr-defined] + if self.objpath: + self._current_document.autodoc_class = self.objpath[0] # type: ignore[attr-defined] + + # find out which members are documentable + members_check_module, members = self.get_object_members(True) + + # document non-skipped members + member_documenters: List[Tuple[Documenter, bool]] = [] + for mname, member, isattr in self.filter_members(members, True): + classes = [ + cls for cls in self.documenters.values() + if cls.can_document_member(member, mname, isattr, self) + ] + if not classes: + # don't know how to document this member + continue + # prefer the documenter with the highest priority + classes.sort(key=lambda cls: cls.priority) + # give explicitly separated module name, so that members + # of inner classes can be documented + full_mname = f'{self.modname}::' + '.'.join((*self.objpath, mname)) + documenter = classes[-1](self.directive, full_mname, self.indent) + member_documenters.append((documenter, isattr)) + + member_order = self.options.member_order or self.config.autodoc_member_order + member_documenters = self.sort_members(member_documenters, member_order) + + for documenter, isattr in member_documenters: + documenter.generate( + all_members=True, + real_modname=self.real_modname, + check_module=members_check_module and not isattr, + ) + + if sphinx.version_info >= (8, 2): + # reset current objects + self._current_document.autodoc_module = '' # type: ignore[attr-defined] + self._current_document.autodoc_class = '' # type: ignore[attr-defined] def sort_members( self, diff --git a/sphinx_toolbox/more_autodoc/typehints.py b/sphinx_toolbox/more_autodoc/typehints.py index edc32931..2b0a4997 100644 --- a/sphinx_toolbox/more_autodoc/typehints.py +++ b/sphinx_toolbox/more_autodoc/typehints.py @@ -182,6 +182,9 @@ def setup(app: Sphinx) -> Dict[str, Any]: from sphinx_autodoc_typehints import _LOGGER as sat_logger from sphinx_autodoc_typehints import _PYDATA_ANNOTATIONS as pydata_annotations +if isinstance(next(iter(pydata_annotations)), tuple): + pydata_annotations = {x[1] for x in pydata_annotations} + try: # 3rd party from sphinx_autodoc_typehints import _future_annotations_imported @@ -904,7 +907,7 @@ def setup(app: Sphinx) -> SphinxExtMetadata: def _resolve_forwardref( - fr: Union[ForwardRef, sphinx.util.typing.ForwardRef], + fr: Union[ForwardRef, "sphinx.util.typing.ForwardRef"], module: str, ) -> object: """ diff --git a/sphinx_toolbox/more_autodoc/variables.py b/sphinx_toolbox/more_autodoc/variables.py index 7d965388..731ea1a7 100644 --- a/sphinx_toolbox/more_autodoc/variables.py +++ b/sphinx_toolbox/more_autodoc/variables.py @@ -657,12 +657,17 @@ def import_object(self, raiseerror: bool = False) -> bool: with mock(self.env.config.autodoc_mock_imports): try: + if sphinx.version_info >= (8, 1): + kwargs = {} + else: + kwargs = {"warningiserror": self.env.config.autodoc_warningiserror} + ret = import_object( self.modname, self.objpath[:-1], "class", attrgetter=self.get_attr, - warningiserror=self.env.config.autodoc_warningiserror + **kwargs, ) self.module, _, _, self.parent = ret return True diff --git a/sphinx_toolbox/more_autosummary/__init__.py b/sphinx_toolbox/more_autosummary/__init__.py index 5434827f..4799240f 100644 --- a/sphinx_toolbox/more_autosummary/__init__.py +++ b/sphinx_toolbox/more_autosummary/__init__.py @@ -317,29 +317,71 @@ def import_by_name(self, name: str, prefixes: List[Optional[str]]) -> Tuple[str, real_name = re.sub(rf"((?:{modname}\.)+)", f"{modname}.", real_name) return real_name, obj, parent, modname - def create_documenter( + if sphinx.version_info >= (8, 2): + + def create_documenter( # type: ignore[override] + self, + obj: Any, + parent: Any, + full_name: str, + *, + registry: Any = None, + ) -> Documenter: + """ + Get an :class:`autodoc.Documenter` class suitable for documenting the given object. + + :param app: The Sphinx application. + :param obj: The object being documented. + :param parent: The parent of the object (e.g. a module or a class). + :param full_name: The full name of the object. + :param registry: + + .. versionchanged:: 1.3.0 + + Now selects the appropriate documenter for attributes rather than + falling back to :class:`~sphinx.ext.autodoc.DataDocumenter`. + + .. versionchanged:: 3.9.0 + + Function arguments now mirror those from Sphinx 8.2 or + older versions depending on the Sphinx version installed. + """ + + # 3rd party + from sphinx.ext.autosummary import _get_documenter # type: ignore[attr-defined] + doccls = _get_documenter(obj, parent, registry=registry) + return doccls(self.bridge, full_name) + + else: + + def create_documenter( # type: ignore[misc] self, app: Sphinx, obj: Any, parent: Any, full_name: str, ) -> Documenter: - """ - Get an :class:`autodoc.Documenter` class suitable for documenting the given object. + """ + Get an :class:`autodoc.Documenter` class suitable for documenting the given object. - :param app: The Sphinx application. - :param obj: The object being documented. - :param parent: The parent of the object (e.g. a module or a class). - :param full_name: The full name of the object. + :param app: The Sphinx application. + :param obj: The object being documented. + :param parent: The parent of the object (e.g. a module or a class). + :param full_name: The full name of the object. - .. versionchanged:: 1.3.0 + .. versionchanged:: 1.3.0 - Now selects the appropriate documenter for attributes rather than - falling back to :class:`~sphinx.ext.autodoc.DataDocumenter`. - """ + Now selects the appropriate documenter for attributes rather than + falling back to :class:`~sphinx.ext.autodoc.DataDocumenter`. + + .. versionchanged:: 3.9.0 + + Function arguments now mirror those from Sphinx 8.2 or + older versions depending on the Sphinx version installed. + """ - doccls = get_documenter(app, obj, parent) - return doccls(self.bridge, full_name) + doccls = get_documenter(app, obj, parent) + return doccls(self.bridge, full_name) def get_table(self, items: List[Tuple[str, str, str, str]]) -> List[nodes.Node]: """ diff --git a/sphinx_toolbox/source.py b/sphinx_toolbox/source.py index 6c062f74..4d43fec5 100644 --- a/sphinx_toolbox/source.py +++ b/sphinx_toolbox/source.py @@ -10,6 +10,12 @@ function signatures, checkout :mod:`sphinx.ext.linkcode` and :mod:`sphinx.ext.viewcode`. +.. versionchanged:: 4.0.0 + + The :mod:`sphinx_toolbox.source` module no longer enables the :mod:`sphinx_toolbox.github` extension automatically. + If you have :confval:`source_link_target` set to ``'GitHub'`` you may need to enable the extension manually. + + Usage ------- @@ -21,6 +27,11 @@ The target of the source link, either ``'GitHub'`` or ``'Sphinx'``. Case insensitive. + .. note:: + + The ``'GitHub'`` source option requires the :mod:`sphinx_toolbox.github` extension to be enabled in your ``conf.py`` file, + and its :confval:`github_username` and :confval:`github_repository` options set. + See that extension's documentation for more details. .. rst:role:: source @@ -259,6 +270,6 @@ def setup(app: Sphinx) -> SphinxExtMetadata: app.add_config_value("source_link_target", "Sphinx", "env", types=[str]) app.connect("config-inited", _configure) - app.setup_extension("sphinx_toolbox.github") + # app.setup_extension("sphinx_toolbox.github") return {"parallel_read_safe": True} diff --git a/sphinx_toolbox/testing.py b/sphinx_toolbox/testing.py index 17ce3817..2eaeb204 100644 --- a/sphinx_toolbox/testing.py +++ b/sphinx_toolbox/testing.py @@ -748,7 +748,13 @@ def test_page(page: BeautifulSoup, html_regression: HTMLRegressionFixture): for div in page.select("div.sphinxsidebar"): div.extract() + for div in page.select("div.related"): + if div["aria-label"] == "Related": + div.extract() + if sphinx.version_info >= (4, 3): # pragma: no cover + for div in page.select("dt.sig em.property span.k"): + div.replace_with_children() for div in page.select("span.w"): div.extract() for div in page.select("span.p"): diff --git a/tests/common.py b/tests/common.py index b4db5421..0a139e68 100644 --- a/tests/common.py +++ b/tests/common.py @@ -1,5 +1,6 @@ # stdlib from http import HTTPStatus +from types import SimpleNamespace from typing import Any, Dict, NamedTuple, Sequence, Tuple # 3rd party @@ -30,10 +31,18 @@ class AppParams(NamedTuple): def get_app_config_values(config: Any) -> Tuple[str, str, Any]: if sphinx.version_info >= (7, 3): - # valid_types = valid_types = config.valid_types - if isinstance(valid_types, (set, frozenset)): - valid_types = list(valid_types) - return (config.default, config.rebuild, valid_types) + default = config.default + rebuild = config.rebuild else: - return config + default, rebuild, valid_types = config + + if isinstance(valid_types, (set, frozenset, tuple, list)): + valid_types = sorted(valid_types) + + if hasattr(valid_types, "_candidates"): + new_valid_types = SimpleNamespace() + new_valid_types.candidates = sorted(valid_types._candidates) + valid_types = new_valid_types + + return (default, rebuild, valid_types) diff --git a/tests/test_autosummary_widths_/test_latex_output.tex b/tests/test_autosummary_widths_/test_latex_output.tex index 8a8fc4cc..0dbfcb07 100644 --- a/tests/test_autosummary_widths_/test_latex_output.tex +++ b/tests/test_autosummary_widths_/test_latex_output.tex @@ -14,6 +14,7 @@ <%- macro sphinx6x_2nd(char) -%> <% if (7, 2) > sphinx_version >= (6, 2) %>,<><% endif %> <%- endmacro -%> +<%- set sphinx81_linebreak = "\n" if sphinx_version >= (8, 1) else "" -%> %% Generated by Sphinx. \def\sphinxdocclass{report} \documentclass[letterpaper,10pt,english]{sphinxmanual} @@ -258,7 +259,8 @@ <%- if sphinx_version > (4, 5) %> \pysigstartsignatures <% endif -%> -\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{class<% if sphinx_version >= (4, 3) %>\DUrole{w<>}{<% if sphinx_version < (7, 2) %> <% endif %> }<% else %> <% endif %>}}\sphinxcode{\sphinxupquote{string.}}\sphinxbfcode{\sphinxupquote{Template}}}{\<< sphinxparam >>{\DUrole{n<>}{template}}}{} +\pysiglinewithargsret<% if sphinx_version >= (8, 1) %> +<% endif %>{\sphinxbfcode{\sphinxupquote{<% if sphinx_version >= (8, 2) %>\DUrole{k}{class}<% else %>class<% endif %><% if sphinx_version >= (4, 3) %>\DUrole{w<>}{<% if sphinx_version < (7, 2) %> <% endif %> }<% else %> <% endif %>}}\sphinxcode{\sphinxupquote{string.}}\sphinxbfcode{\sphinxupquote{Template}}}<< sphinx81_linebreak >>{\<< sphinxparam >>{\DUrole{n<>}{template}}}<< sphinx81_linebreak >>{} <% if sphinx_version > (4, 5) %>\pysigstopsignatures <% endif -%> A string class for supporting \$\sphinxhyphen{}substitutions. @@ -272,7 +274,7 @@ <%- if sphinx_version > (4, 5) %> \pysigstartsignatures <% endif -%> -\pysiglinewithargsret{\sphinxcode{\sphinxupquote{string.}}\sphinxbfcode{\sphinxupquote{capwords}}}{\<>{<% if sphinx_version >= (4, 3)%>\DUrole{n<< sphinx6x_2nd('n') >>}{s}}<% else %>s}<% endif %>\sphinxoptional{<>{<% if sphinx_version >= (4, 3)%>\DUrole{n<>}{sep}}<% else %>sep}<% endif %>}}{{ +\pysiglinewithargsret<< sphinx81_linebreak >>{\sphinxcode{\sphinxupquote{string.}}\sphinxbfcode{\sphinxupquote{capwords}}}<< sphinx81_linebreak >>{\<>{<% if sphinx_version >= (4, 3)%>\DUrole{n<< sphinx6x_2nd('n') >>}{s}}<% else %>s}<% endif %>\sphinxoptional{<>{<% if sphinx_version >= (4, 3)%>\DUrole{n<>}{sep}}<% else %>sep}<% endif %>}}<< sphinx81_linebreak >>{{ <%- if sphinx_version >= (4, 4) %> $\rightarrow$ string}} <%- else %> $\rightarrow$ {\hyperref[\detokenize{index:module-string}]{\sphinxcrossref{string}}}}} <%- endif -%> @@ -423,7 +425,11 @@ <%- if sphinx_version > (4, 5) %> \pysigstartsignatures <% endif -%> -\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{class<% if sphinx_version >= (4, 3) %>\DUrole{w<< sphinx6x_2nd('w') >>}{<% if sphinx_version < (7, 2) %> <% endif %> }<% else %> <% endif %>}}\sphinxcode{\sphinxupquote{textwrap.}}\sphinxbfcode{\sphinxupquote{TextWrapper}}}{\<< sphinxparam >>{\DUrole{n<< sphinx6x_2nd('n') >>}{width}\DUrole{o<< sphinx6x_2nd('o') >>}{=}\DUrole{default_value}{70}}<>{\DUrole{n<< sphinx6x_2nd('n') >>}{initial\_indent}\DUrole{o<< sphinx6x_2nd('o') >>}{=}\DUrole{default_value}{\textquotesingle{}\textquotesingle{}}}<>{\DUrole{n<< sphinx6x_2nd('n') >>}{subsequent\_indent}\DUrole{o<< sphinx6x_2nd('o') >>}{=}\DUrole{default_value}{\textquotesingle{}\textquotesingle{}}}<>{\DUrole{n<< sphinx6x_2nd('n') >>}{expand\_tabs}\DUrole{o<< sphinx6x_2nd('o') >>}{=}\DUrole{default_value}{True}}<>{\DUrole{n<< sphinx6x_2nd('n') >>}{replace\_whitespace}\DUrole{o<< sphinx6x_2nd('o') >>}{=}\DUrole{default_value}{True}}<>{\DUrole{n<< sphinx6x_2nd('n') >>}{fix\_sentence\_endings}\DUrole{o<< sphinx6x_2nd('o') >>}{=}\DUrole{default_value}{False}}<>{\DUrole{n<< sphinx6x_2nd('n') >>}{break\_long\_words}\DUrole{o<< sphinx6x_2nd('o') >>}{=}\DUrole{default_value}{True}}<>{\DUrole{n<< sphinx6x_2nd('n') >>}{drop\_whitespace}\DUrole{o<< sphinx6x_2nd('o') >>}{=}\DUrole{default_value}{True}}<>{\DUrole{n<< sphinx6x_2nd('n') >>}{break\_on\_hyphens}\DUrole{o<< sphinx6x_2nd('o') >>}{=}\DUrole{default_value}{True}}<>{\DUrole{n<< sphinx6x_2nd('n') >>}{tabsize}\DUrole{o<< sphinx6x_2nd('o') >>}{=}\DUrole{default_value}{8}}<>{\DUrole{o<< sphinx6x_2nd('o') >>}{*}}<>{\DUrole{n<< sphinx6x_2nd('n') >>}{max\_lines}\DUrole{o<< sphinx6x_2nd('o') >>}{=}\DUrole{default_value}{None}}<>{\DUrole{n<< sphinx6x_2nd('n') >>}{placeholder}\DUrole{o<< sphinx6x_2nd('o') >>}{=}\DUrole{default_value}{\textquotesingle{} {[}...{]}\textquotesingle{}}}}{} +\pysiglinewithargsret<% if sphinx_version >= (8, 1) %> +<% endif %>{\sphinxbfcode{\sphinxupquote{<% if sphinx_version >= (8, 2) %>\DUrole{k}{class}<% else %>class<% endif %><% if sphinx_version >= (4, 3) %>\DUrole{w<< sphinx6x_2nd('w') >>}{<% if sphinx_version < (7, 2) %> <% endif %> }<% else %> <% endif -%>}}\sphinxcode{\sphinxupquote{textwrap.}}\sphinxbfcode{\sphinxupquote{TextWrapper}}} +<<- sphinx81_linebreak >>{\<< sphinxparam >>{\DUrole{n<< sphinx6x_2nd('n') >>}{width}\DUrole{o<< sphinx6x_2nd('o') >>}{=}\DUrole{default_value}{70}}<>{\DUrole{n<< sphinx6x_2nd('n') >>}{initial\_indent}\DUrole{o<< sphinx6x_2nd('o') >>}{=}\DUrole{default_value}{\textquotesingle{}\textquotesingle{}}}<>{\DUrole{n<< sphinx6x_2nd('n') >>}{subsequent\_indent}\DUrole{o<< sphinx6x_2nd('o') >>}{=}\DUrole{default_value}{\textquotesingle{}\textquotesingle{}}}<>{\DUrole{n<< sphinx6x_2nd('n') >>}{expand\_tabs}\DUrole{o<< sphinx6x_2nd('o') >>}{=}\DUrole{default_value}{True}}<>{\DUrole{n<< sphinx6x_2nd('n') >>}{replace\_whitespace}\DUrole{o<< sphinx6x_2nd('o') >>}{=}\DUrole{default_value}{True}}<>{\DUrole{n<< sphinx6x_2nd('n') >>}{fix\_sentence\_endings}\DUrole{o<< sphinx6x_2nd('o') >>}{=}\DUrole{default_value}{False}}<>{\DUrole{n<< sphinx6x_2nd('n') >>}{break\_long\_words}\DUrole{o<< sphinx6x_2nd('o') >>}{=}\DUrole{default_value}{True}}<>{\DUrole{n<< sphinx6x_2nd('n') >>}{drop\_whitespace}\DUrole{o<< sphinx6x_2nd('o') >>}{=}\DUrole{default_value}{True}}<>{\DUrole{n<< sphinx6x_2nd('n') >>}{break\_on\_hyphens}\DUrole{o<< sphinx6x_2nd('o') >>}{=}\DUrole{default_value}{True}}<>{\DUrole{n<< sphinx6x_2nd('n') >>}{tabsize}\DUrole{o<< sphinx6x_2nd('o') >>}{=}\DUrole{default_value}{8}}<>{ +<%- if sphinx_version >= (8, 2) %>\DUrole{keyword-only-separator}<% endif %> +<%- if sphinx_version >= (8, 2) %>{<% endif %>\DUrole{o<< sphinx6x_2nd('o') >>}{<% if sphinx_version >= (8, 2) %>\sphinxstyleabbreviation{*} (Keyword\sphinxhyphen{}only parameters separator (PEP 3102))}<% else %>*<% endif %>}}<>{\DUrole{n<< sphinx6x_2nd('n') >>}{max\_lines}\DUrole{o<< sphinx6x_2nd('o') >>}{=}\DUrole{default_value}{None}}<>{\DUrole{n<< sphinx6x_2nd('n') >>}{placeholder}\DUrole{o<< sphinx6x_2nd('o') >>}{=}\DUrole{default_value}{\textquotesingle{} {[}...{]}\textquotesingle{}}}}<< sphinx81_linebreak >>{} <% if sphinx_version > (4, 5) %>\pysigstopsignatures <% endif -%> Object for wrapping/filling text. The public interface consists of @@ -552,8 +558,8 @@ <%- if sphinx_version > (4, 5) %> \pysigstartsignatures <% endif -%> -\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{fill}}}{\<< sphinxparam >>{\DUrole{n<< sphinx6x_2nd('n') >>}{text}\DUrole{p<< sphinx6x_2nd('p') >>}{:}<% if sphinx_version >= (4, 3) %>\DUrole{w<>}{<% if sphinx_version < (7, 2) %> <% endif %> }<% else %> <% endif %>\DUrole{n<>}{ -<%- if sphinx_version >= (4, 4) %>string}}}{{ $\rightarrow$ string}} +\pysiglinewithargsret<< sphinx81_linebreak >>{\sphinxbfcode{\sphinxupquote{fill}}}<< sphinx81_linebreak >>{\<< sphinxparam >>{\DUrole{n<< sphinx6x_2nd('n') >>}{text}\DUrole{p<< sphinx6x_2nd('p') >>}{:}<% if sphinx_version >= (4, 3) %>\DUrole{w<>}{<% if sphinx_version < (7, 2) %> <% endif %> }<% else %> <% endif %>\DUrole{n<>}{ +<%- if sphinx_version >= (4, 4) %>string}}}<< sphinx81_linebreak >>{{ $\rightarrow$ string}} <%- else %>{\hyperref[\detokenize{index:module-string}]{\sphinxcrossref{string}}}}}}{{ $\rightarrow$ {\hyperref[\detokenize{index:module-string}]{\sphinxcrossref{string}}}}} <%- endif %> <%- if sphinx_version > (4, 5) %> @@ -572,9 +578,9 @@ <%- if sphinx_version > (4, 5) %> \pysigstartsignatures <% endif -%> -\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{wrap}}}{\<< sphinxparam >>{\DUrole{n<< sphinx6x_2nd('n') >>}{text}\DUrole{p<>}{:}<% if sphinx_version >= (4, 3) %>\DUrole{w<>}{<% if sphinx_version < (7, 2) %> <% endif %> }<% else %> <% endif %>\DUrole{n<>}{ +\pysiglinewithargsret<< sphinx81_linebreak >>{\sphinxbfcode{\sphinxupquote{wrap}}}<< sphinx81_linebreak >>{\<< sphinxparam >>{\DUrole{n<< sphinx6x_2nd('n') >>}{text}\DUrole{p<>}{:}<% if sphinx_version >= (4, 3) %>\DUrole{w<>}{<% if sphinx_version < (7, 2) %> <% endif %> }<% else %> <% endif %>\DUrole{n<>}{ <%- if sphinx_version >= (4, 4) -%> -string}}}{{ $\rightarrow$ \DUrole{p<>}{{[}}string\DUrole{p<>}{{]}}}} +string}}}<< sphinx81_linebreak >>{{ $\rightarrow$ \DUrole{p<>}{{[}}string\DUrole{p<>}{{]}}}} <%- else -%> {\hyperref[\detokenize{index:module-string}]{\sphinxcrossref{string}}}}}}{{ $\rightarrow$ \DUrole{p<>}{{[}}{\hyperref[\detokenize{index:module-string}]{\sphinxcrossref{string}}}\DUrole{p}{{]}}}} <%- endif -%> @@ -599,7 +605,7 @@ <%- if sphinx_version > (4, 5) %> \pysigstartsignatures <% endif -%> -\pysiglinewithargsret{\sphinxcode{\sphinxupquote{textwrap.}}\sphinxbfcode{\sphinxupquote{dedent}}}{\<>{\DUrole{n<< sphinx6x_2nd('n') >>}{text}}}{} +\pysiglinewithargsret<< sphinx81_linebreak >>{\sphinxcode{\sphinxupquote{textwrap.}}\sphinxbfcode{\sphinxupquote{dedent}}}<< sphinx81_linebreak >>{\<>{\DUrole{n<< sphinx6x_2nd('n') >>}{text}}}<< sphinx81_linebreak >>{} <% if sphinx_version > (4, 5) %>\pysigstopsignatures <% endif -%> Remove any common leading whitespace from every line in \sphinxtitleref{text}. @@ -623,7 +629,7 @@ <%- if sphinx_version > (4, 5) %> \pysigstartsignatures <% endif -%> -\pysiglinewithargsret{\sphinxcode{\sphinxupquote{textwrap.}}\sphinxbfcode{\sphinxupquote{fill}}}{\<>{\DUrole{n<< sphinx6x_2nd('n') >>}{text}}<>{\DUrole{n<< sphinx6x_2nd('n') >>}{width}\DUrole{o<< sphinx6x_2nd('o') >>}{=}\DUrole{default_value}{70}}<>{\DUrole{o<< sphinx6x_2nd('o') >>}{**}\DUrole{n<< sphinx6x_2nd('n') >>}{kwargs}}}{} +\pysiglinewithargsret<< sphinx81_linebreak >>{\sphinxcode{\sphinxupquote{textwrap.}}\sphinxbfcode{\sphinxupquote{fill}}}<< sphinx81_linebreak >>{\<>{\DUrole{n<< sphinx6x_2nd('n') >>}{text}}<>{\DUrole{n<< sphinx6x_2nd('n') >>}{width}\DUrole{o<< sphinx6x_2nd('o') >>}{=}\DUrole{default_value}{70}}<>{\DUrole{o<< sphinx6x_2nd('o') >>}{**}\DUrole{n<< sphinx6x_2nd('n') >>}{kwargs}}}<< sphinx81_linebreak >>{} <% if sphinx_version > (4, 5) %>\pysigstopsignatures <% endif -%> Fill a single paragraph of text, returning a new string. @@ -643,7 +649,7 @@ <%- if sphinx_version > (4, 5) %> \pysigstartsignatures <% endif -%> -\pysiglinewithargsret{\sphinxcode{\sphinxupquote{textwrap.}}\sphinxbfcode{\sphinxupquote{indent}}}{\<>{\DUrole{n<< sphinx6x_2nd('n') >>}{text}}<>{\DUrole{n<< sphinx6x_2nd('n') >>}{prefix}}<>{\DUrole{n<< sphinx6x_2nd('n') >>}{predicate}\DUrole{o<< sphinx6x_2nd('o') >>}{=}\DUrole{default_value}{None}}}{} +\pysiglinewithargsret<< sphinx81_linebreak >>{\sphinxcode{\sphinxupquote{textwrap.}}\sphinxbfcode{\sphinxupquote{indent}}}<< sphinx81_linebreak >>{\<>{\DUrole{n<< sphinx6x_2nd('n') >>}{text}}<>{\DUrole{n<< sphinx6x_2nd('n') >>}{prefix}}<>{\DUrole{n<< sphinx6x_2nd('n') >>}{predicate}\DUrole{o<< sphinx6x_2nd('o') >>}{=}\DUrole{default_value}{None}}}<< sphinx81_linebreak >>{} <% if sphinx_version > (4, 5) %>\pysigstopsignatures <% endif -%> Adds <>prefix<> to the beginning of selected lines in ‘text’. @@ -662,7 +668,7 @@ <%- if sphinx_version > (4, 5) %> \pysigstartsignatures <% endif -%> -\pysiglinewithargsret{\sphinxcode{\sphinxupquote{textwrap.}}\sphinxbfcode{\sphinxupquote{shorten}}}{\<>{\DUrole{n<< sphinx6x_2nd('n') >>}{text}}<>{\DUrole{n<< sphinx6x_2nd('n') >>}{width}}<>{\DUrole{o<< sphinx6x_2nd('o') >>}{**}\DUrole{n<< sphinx6x_2nd('n') >>}{kwargs}}}{} +\pysiglinewithargsret<< sphinx81_linebreak >>{\sphinxcode{\sphinxupquote{textwrap.}}\sphinxbfcode{\sphinxupquote{shorten}}}<< sphinx81_linebreak >>{\<>{\DUrole{n<< sphinx6x_2nd('n') >>}{text}}<>{\DUrole{n<< sphinx6x_2nd('n') >>}{width}}<>{\DUrole{o<< sphinx6x_2nd('o') >>}{**}\DUrole{n<< sphinx6x_2nd('n') >>}{kwargs}}}<< sphinx81_linebreak >>{} <% if sphinx_version > (4, 5) %>\pysigstopsignatures <% endif -%> Collapse and truncate the given text to fit in the given width. @@ -687,7 +693,7 @@ <%- if sphinx_version > (4, 5) %> \pysigstartsignatures <% endif -%> -\pysiglinewithargsret{\sphinxcode{\sphinxupquote{textwrap.}}\sphinxbfcode{\sphinxupquote{wrap}}}{\<>{\DUrole{n<< sphinx6x_2nd('n') >>}{text}}<>{\DUrole{n<< sphinx6x_2nd('n') >>}{width}\DUrole{o<< sphinx6x_2nd('o') >>}{=}\DUrole{default_value}{70}}<>{\DUrole{o<< sphinx6x_2nd('o') >>}{**}\DUrole{n<< sphinx6x_2nd('n') >>}{kwargs}}}{} +\pysiglinewithargsret<< sphinx81_linebreak >>{\sphinxcode{\sphinxupquote{textwrap.}}\sphinxbfcode{\sphinxupquote{wrap}}}<< sphinx81_linebreak >>{\<>{\DUrole{n<< sphinx6x_2nd('n') >>}{text}}<>{\DUrole{n<< sphinx6x_2nd('n') >>}{width}\DUrole{o<< sphinx6x_2nd('o') >>}{=}\DUrole{default_value}{70}}<>{\DUrole{o<< sphinx6x_2nd('o') >>}{**}\DUrole{n<< sphinx6x_2nd('n') >>}{kwargs}}}<< sphinx81_linebreak >>{} <% if sphinx_version > (4, 5) %>\pysigstopsignatures <% endif -%> Wrap a single paragraph of text, returning a list of wrapped lines. diff --git a/tests/test_installation.py b/tests/test_installation.py index fdd5329d..9db1a2a7 100644 --- a/tests/test_installation.py +++ b/tests/test_installation.py @@ -50,39 +50,45 @@ def test_make_installation_instructions(): {"pypi": True, "project_name": "my_project"}, FakeBuildEnvironment(4), # type: ignore[arg-type] ) == [ - ".. tabs::", + ".. container:: st-installation", '', - " .. tab:: from PyPI", + " .. tabs::", '', - " .. prompt:: bash", + " .. tab:: from PyPI", '', - " python3 -m pip install my_project --user", + " .. prompt:: bash", + '', + " python3 -m pip install my_project --user", ] assert make_installation_instructions( {"pypi": True, "project_name": "my_project", "pypi-name": "my-project"}, FakeBuildEnvironment(4), # type: ignore[arg-type] ) == [ - ".. tabs::", + ".. container:: st-installation", + '', + " .. tabs::", '', - " .. tab:: from PyPI", + " .. tab:: from PyPI", '', - " .. prompt:: bash", + " .. prompt:: bash", '', - " python3 -m pip install my-project --user", + " python3 -m pip install my-project --user", ] assert make_installation_instructions( {"anaconda": True, "project_name": "my_project"}, FakeBuildEnvironment(4), # type: ignore[arg-type] ) == [ - ".. tabs::", + ".. container:: st-installation", '', - " .. tab:: from Anaconda", + " .. tabs::", '', - " .. prompt:: bash", + " .. tab:: from Anaconda", '', - " conda install my_project", + " .. prompt:: bash", + '', + " conda install my_project", '', ] @@ -90,13 +96,15 @@ def test_make_installation_instructions(): {"anaconda": True, "project_name": "my_project", "conda-name": "my-project"}, FakeBuildEnvironment(4), # type: ignore[arg-type] ) == [ - ".. tabs::", + ".. container:: st-installation", + '', + " .. tabs::", '', - " .. tab:: from Anaconda", + " .. tab:: from Anaconda", '', - " .. prompt:: bash", + " .. prompt:: bash", '', - " conda install my-project", + " conda install my-project", '', ] @@ -104,27 +112,31 @@ def test_make_installation_instructions(): {"anaconda": True, "project_name": "my_project", "pypi-name": "pypi-project"}, FakeBuildEnvironment(4), # type: ignore[arg-type] ) == [ - ".. tabs::", + ".. container:: st-installation", '', - " .. tab:: from Anaconda", + " .. tabs::", '', - " .. prompt:: bash", + " .. tab:: from Anaconda", '', - " conda install pypi-project", + " .. prompt:: bash", + '', + " conda install pypi-project", '', ] assert make_installation_instructions( - {"github": True, "project_name": "my_project"}, + {"github": "stable", "project_name": "my_project"}, FakeBuildEnvironment(4), # type: ignore[arg-type] ) == [ - ".. tabs::", + ".. container:: st-installation", + '', + " .. tabs::", '', - " .. tab:: from GitHub", + " .. tab:: from GitHub", '', - " .. prompt:: bash", + " .. prompt:: bash", '', - " python3 -m pip install git+https://github.com/octocat/hello_world@master --user", + " python3 -m pip install git+https://github.com/octocat/hello_world@stable --user", ] assert make_installation_instructions( @@ -135,22 +147,24 @@ def test_make_installation_instructions(): }, FakeBuildEnvironment(4), # type: ignore[arg-type] ) == [ - ".. tabs::", + ".. container:: st-installation", '', - " .. tab:: from Anaconda", + " .. tabs::", '', - " First add the required channels", + " .. tab:: from Anaconda", '', - " .. prompt:: bash", + " First add the required channels", '', - " conda config --add channels https://conda.anaconda.org/foo", - " conda config --add channels https://conda.anaconda.org/bar", + " .. prompt:: bash", '', - " Then install", + " conda config --add channels https://conda.anaconda.org/foo", + " conda config --add channels https://conda.anaconda.org/bar", '', - " .. prompt:: bash", + " Then install", '', - " conda install my_project", + " .. prompt:: bash", + '', + " conda install my_project", '', ] @@ -163,22 +177,24 @@ def test_make_installation_instructions(): }, FakeBuildEnvironment(4), # type: ignore[arg-type] ) == [ - ".. tabs::", + ".. container:: st-installation", + '', + " .. tabs::", '', - " .. tab:: from Anaconda", + " .. tab:: from Anaconda", '', - " First add the required channels", + " First add the required channels", '', - " .. prompt:: bash", + " .. prompt:: bash", '', - " conda config --add channels https://conda.anaconda.org/foo", - " conda config --add channels https://conda.anaconda.org/bar", + " conda config --add channels https://conda.anaconda.org/foo", + " conda config --add channels https://conda.anaconda.org/bar", '', - " Then install", + " Then install", '', - " .. prompt:: bash", + " .. prompt:: bash", '', - " conda install my_project", + " conda install my_project", '', ] diff --git a/tests/test_issues_output/conftest.py b/tests/test_issues_output/conftest.py index 0cc3529f..8093a88a 100644 --- a/tests/test_issues_output/conftest.py +++ b/tests/test_issues_output/conftest.py @@ -27,7 +27,6 @@ # # stdlib -import pathlib import shutil from typing import Any, Dict, List, Sequence, Tuple, cast @@ -56,8 +55,8 @@ def rootdir() -> PathPlus: def app_params( request: Any, test_params: Dict, - sphinx_test_tempdir: pathlib.Path, - rootdir: pathlib.Path, + sphinx_test_tempdir: PathPlus, + rootdir: PathPlus, ) -> Tuple[Sequence, Dict]: """ parameters that is specified by 'pytest.mark.sphinx' for diff --git a/tests/test_issues_output/test_source_output_/test_html_output_autoprotocol_html_.html b/tests/test_issues_output/test_source_output_/test_html_output_autoprotocol_html_.html index 3e975993..9c631a56 100644 --- a/tests/test_issues_output/test_source_output_/test_html_output_autoprotocol_html_.html +++ b/tests/test_issues_output/test_source_output_/test_html_output_autoprotocol_html_.html @@ -24,7 +24,7 @@ {% if sphinx_version >= (5, 0) %} {% endif %}{% endif %} - {% if sphinx_version >= (5, 2) %} {% endif %} @@ -445,7 +445,7 @@

- abstract + abstract{% if sphinx_version >= (8, 2) %}method{% endif %} <{{ sig_prename_tag }} class="sig-name descname"> __abs__ @@ -484,7 +484,9 @@

- + {% if sphinx_version >= (8, 1) %} +
+
{% endif %} diff --git a/tests/test_issues_output/test_source_output_/test_html_output_generic_bases_.html b/tests/test_issues_output/test_source_output_/test_html_output_generic_bases_.html index ecc42ef7..25638f29 100644 --- a/tests/test_issues_output/test_source_output_/test_html_output_generic_bases_.html +++ b/tests/test_issues_output/test_source_output_/test_html_output_generic_bases_.html @@ -23,7 +23,7 @@ {% if sphinx_version >= (5, 0) %} {% endif %}{% endif %} - {% if sphinx_version >= (5, 2) %} {% endif %} @@ -192,7 +192,9 @@

- + {% if sphinx_version >= (8, 1) %} +
+
{% endif %} diff --git a/tests/test_issues_output/test_source_output_/test_html_output_generic_bases_37_.html b/tests/test_issues_output/test_source_output_/test_html_output_generic_bases_37_.html index ecc42ef7..da06f48c 100644 --- a/tests/test_issues_output/test_source_output_/test_html_output_generic_bases_37_.html +++ b/tests/test_issues_output/test_source_output_/test_html_output_generic_bases_37_.html @@ -23,7 +23,7 @@ {% if sphinx_version >= (5, 0) %} {% endif %}{% endif %} - {% if sphinx_version >= (5, 2) %} {% endif %} diff --git a/tests/test_issues_output/test_source_output_/test_output_github_index_html_.html b/tests/test_issues_output/test_source_output_/test_output_github_index_html_.html index 087b8644..47704636 100644 --- a/tests/test_issues_output/test_source_output_/test_output_github_index_html_.html +++ b/tests/test_issues_output/test_source_output_/test_output_github_index_html_.html @@ -21,7 +21,7 @@ {% if sphinx_version >= (5, 0) %} {% endif %}{% endif %} - {% if sphinx_version >= (5, 2) %} {% endif %} @@ -112,7 +112,9 @@

.

- + {% if sphinx_version >= (8, 1) %} +
+
{% endif %} diff --git a/tests/test_more_autodoc/test_overloads.py b/tests/test_more_autodoc/test_overloads.py index e3a36329..33cf5fac 100644 --- a/tests/test_more_autodoc/test_overloads.py +++ b/tests/test_more_autodoc/test_overloads.py @@ -20,10 +20,11 @@ def test_setup(): assert app.registry.documenters["function"] == overloads.FunctionDocumenter assert app.registry.documenters["method"] == overloads.MethodDocumenter - assert get_app_config_values(app.config.values["overloads_location"])[:2] == ("signature", "env") + config_values = get_app_config_values(app.config.values["overloads_location"]) + assert config_values[:2] == ("signature", "env") - assert get_app_config_values(app.config.values["overloads_location"])[2].candidates == ( - "top", + assert sorted(config_values[2].candidates) == [ "bottom", "signature", - ) + "top", + ] diff --git a/tests/test_more_autosummary.py b/tests/test_more_autosummary.py index d280ba5b..2f1e405c 100644 --- a/tests/test_more_autosummary.py +++ b/tests/test_more_autosummary.py @@ -27,10 +27,10 @@ def test_setup(advanced_file_regression: AdvancedFileRegressionFixture): assert not roles assert not additional_nodes - assert get_app_config_values(app.config.values["autodocsumm_member_order"])[:2] == ( + config_values = get_app_config_values(app.config.values["autodocsumm_member_order"]) + assert config_values[:2] == ( "alphabetical", "env", ) - assert get_app_config_values(app.config.values["autodocsumm_member_order"] - )[2].candidates == ("alphabetic", "alphabetical", "bysource") + assert sorted(config_values[2].candidates) == ["alphabetic", "alphabetical", "bysource"] diff --git a/tests/test_output/conftest.py b/tests/test_output/conftest.py index 44210b89..3f3139ac 100644 --- a/tests/test_output/conftest.py +++ b/tests/test_output/conftest.py @@ -27,7 +27,6 @@ # # stdlib -import pathlib import shutil from contextlib import contextmanager from typing import Any, Callable, ContextManager, Dict, Iterator, List, Sequence, Tuple, cast @@ -86,8 +85,8 @@ def rootdir() -> PathPlus: def app_params( request: Any, test_params: Dict, - sphinx_test_tempdir: pathlib.Path, - rootdir: pathlib.Path, + sphinx_test_tempdir: PathPlus, + rootdir: PathPlus, ) -> Tuple[Sequence, Dict]: """ parameters that is specified by 'pytest.mark.sphinx' for diff --git a/tests/test_output/doc-test/test-root/installation.rst b/tests/test_output/doc-test/test-root/installation.rst index 4374aff4..a549b7da 100644 --- a/tests/test_output/doc-test/test-root/installation.rst +++ b/tests/test_output/doc-test/test-root/installation.rst @@ -77,7 +77,7 @@ sphinx-toolbox Demo - Installation :pypi: :pypi-name: my-project :anaconda: - :github: + :github: stable .. installation:: my_project :pypi: diff --git a/tests/test_output/test_output.py b/tests/test_output/test_output.py index 566fd30e..cc6ec9e1 100644 --- a/tests/test_output/test_output.py +++ b/tests/test_output/test_output.py @@ -197,6 +197,7 @@ def test_html_output( raise exception +@pytest.mark.skipif(sphinx.version_info >= (8, 1), reason="Currently failing on Sphinx 8.1") @pytest.mark.usefixtures("pre_commit_hooks") def test_sidebar_links_output( testing_app: Sphinx, @@ -233,6 +234,10 @@ def depart_caption(self, node: nodes.Node) -> None: page = remove_html_footer(page) page = remove_html_link_tags(page) + for div in page.select("div.related"): + if div["aria-label"] == "Related": + div.extract() + for div in page.select("script"): if "_static/language_data.js" in str(div): div.extract() diff --git a/tests/test_output/test_output_/test_html_output_assets_html_.html b/tests/test_output/test_output_/test_html_output_assets_html_.html index 6cdeb21f..042ee618 100644 --- a/tests/test_output/test_output_/test_html_output_assets_html_.html +++ b/tests/test_output/test_output_/test_html_output_assets_html_.html @@ -21,7 +21,7 @@ {% if sphinx_version >= (5, 0) %} {% endif %}{% endif %} - {% if sphinx_version >= (5, 2) %} {% endif %} @@ -61,7 +61,9 @@

missing.txt

- + {% if sphinx_version >= (8, 1) %} +
+
{% endif %} diff --git a/tests/test_output/test_output_/test_html_output_augment_defaults_html_.html b/tests/test_output/test_output_/test_html_output_augment_defaults_html_.html index 6540a881..129e029d 100644 --- a/tests/test_output/test_output_/test_html_output_augment_defaults_html_.html +++ b/tests/test_output/test_output_/test_html_output_augment_defaults_html_.html @@ -23,7 +23,7 @@ {% if sphinx_version >= (5, 0) %} {% endif %}{% endif %} - {% if sphinx_version >= (5, 2) %} {% endif %} @@ -133,7 +133,9 @@

- + {% if sphinx_version >= (8, 1) %} +
+
{% endif %} diff --git a/tests/test_output/test_output_/test_html_output_autodoc_ellipsis_html_.html b/tests/test_output/test_output_/test_html_output_autodoc_ellipsis_html_.html index d14867eb..6e11ecb1 100644 --- a/tests/test_output/test_output_/test_html_output_autodoc_ellipsis_html_.html +++ b/tests/test_output/test_output_/test_html_output_autodoc_ellipsis_html_.html @@ -21,7 +21,7 @@ {% if sphinx_version >= (5, 0) %} {% endif %}{% endif %} - {% if sphinx_version >= (5, 2) %} {% endif %} @@ -231,7 +231,9 @@

- + {% if sphinx_version >= (8, 1) %} +
+
{% endif %} diff --git a/tests/test_output/test_output_/test_html_output_autonamedtuple_3_10_.html b/tests/test_output/test_output_/test_html_output_autonamedtuple_3_10_.html index 27660a08..e275d7c1 100644 --- a/tests/test_output/test_output_/test_html_output_autonamedtuple_3_10_.html +++ b/tests/test_output/test_output_/test_html_output_autonamedtuple_3_10_.html @@ -23,7 +23,7 @@ {% if sphinx_version >= (5, 0) %} {% endif %}{% endif %} - {% if sphinx_version >= (5, 2) %} {% endif %} @@ -943,7 +943,9 @@

attribute.

- + {% if sphinx_version >= (8, 1) %} +
+
{% endif %} diff --git a/tests/test_output/test_output_/test_html_output_autonamedtuple_html_.html b/tests/test_output/test_output_/test_html_output_autonamedtuple_html_.html index 53ab6980..09ef9bab 100644 --- a/tests/test_output/test_output_/test_html_output_autonamedtuple_html_.html +++ b/tests/test_output/test_output_/test_html_output_autonamedtuple_html_.html @@ -23,7 +23,7 @@ {% if sphinx_version >= (5, 0) %} {% endif %}{% endif %} - {% if sphinx_version >= (5, 2) %} {% endif %} @@ -214,7 +214,7 @@

( - + int @@ -359,7 +359,7 @@

( - + int @@ -466,7 +466,7 @@

( - + int @@ -683,7 +683,7 @@

( - + int @@ -793,7 +793,7 @@

( - + int @@ -943,7 +943,9 @@

attribute.

- + {% if sphinx_version >= (8, 1) %} +
+
{% endif %} diff --git a/tests/test_output/test_output_/test_html_output_autonamedtuple_pep563_.html b/tests/test_output/test_output_/test_html_output_autonamedtuple_pep563_.html index 21ff1ae4..b39f2e46 100644 --- a/tests/test_output/test_output_/test_html_output_autonamedtuple_pep563_.html +++ b/tests/test_output/test_output_/test_html_output_autonamedtuple_pep563_.html @@ -23,7 +23,7 @@ {% if sphinx_version >= (5, 0) %} {% endif %}{% endif %} - {% if sphinx_version >= (5, 2) %} {% endif %} @@ -141,7 +141,9 @@

- + {% if sphinx_version >= (8, 1) %} +
+
{% endif %} diff --git a/tests/test_output/test_output_/test_html_output_autoprotocol_html_.html b/tests/test_output/test_output_/test_html_output_autoprotocol_html_.html index b1a9d5a9..0c89f228 100644 --- a/tests/test_output/test_output_/test_html_output_autoprotocol_html_.html +++ b/tests/test_output/test_output_/test_html_output_autoprotocol_html_.html @@ -23,7 +23,7 @@ {% if sphinx_version >= (5, 0) %} {% endif %}{% endif %} - {% if sphinx_version >= (5, 2) %} {% endif %} @@ -482,7 +482,7 @@

- abstract + abstract{% if sphinx_version >= (8, 2) %}method{% endif %} <{{ sig_prename_tag }} class="sig-name descname"> __abs__ @@ -524,7 +524,9 @@

- + {% if sphinx_version >= (8, 1) %} +
+
{% endif %} diff --git a/tests/test_output/test_output_/test_html_output_autotypeddict_html_.html b/tests/test_output/test_output_/test_html_output_autotypeddict_html_.html index 6dc58c14..8ae66de5 100644 --- a/tests/test_output/test_output_/test_html_output_autotypeddict_html_.html +++ b/tests/test_output/test_output_/test_html_output_autotypeddict_html_.html @@ -23,7 +23,7 @@ {% if sphinx_version >= (5, 0) %} {% endif %}{% endif %} - {% if sphinx_version >= (5, 2) %} {% endif %} @@ -597,7 +597,9 @@

- + {% if sphinx_version >= (8, 1) %} +
+
{% endif %} diff --git a/tests/test_output/test_output_/test_html_output_changeset_html_.html b/tests/test_output/test_output_/test_html_output_changeset_html_.html index 951fa847..02124478 100644 --- a/tests/test_output/test_output_/test_html_output_changeset_html_.html +++ b/tests/test_output/test_output_/test_html_output_changeset_html_.html @@ -21,7 +21,7 @@ {% if sphinx_version >= (5, 0) %} {% endif %}{% endif %} - {% if sphinx_version >= (5, 2) %} {% endif %} @@ -175,7 +175,9 @@

- + {% if sphinx_version >= (8, 1) %} +
+
{% endif %} diff --git a/tests/test_output/test_output_/test_html_output_code_block_html_.html b/tests/test_output/test_output_/test_html_output_code_block_html_.html index f4fc434e..7d6de70e 100644 --- a/tests/test_output/test_output_/test_html_output_code_block_html_.html +++ b/tests/test_output/test_output_/test_html_output_code_block_html_.html @@ -21,7 +21,7 @@ {% if sphinx_version >= (5, 0) %} {% endif %}{% endif %} - {% if sphinx_version >= (5, 2) %} {% endif %} @@ -136,7 +136,9 @@

- + {% if sphinx_version >= (8, 1) %} +
+
{% endif %} diff --git a/tests/test_output/test_output_/test_html_output_collapse_html_.html b/tests/test_output/test_output_/test_html_output_collapse_html_.html index 1115e1a0..cdafe3e8 100644 --- a/tests/test_output/test_output_/test_html_output_collapse_html_.html +++ b/tests/test_output/test_output_/test_html_output_collapse_html_.html @@ -21,7 +21,7 @@ {% if sphinx_version >= (5, 0) %} {% endif %}{% endif %} - {% if sphinx_version >= (5, 2) %} {% endif %} @@ -64,7 +64,9 @@

The text should be visible when the page loads.

- + {% if sphinx_version >= (8, 1) %} +
+
{% endif %} diff --git a/tests/test_output/test_output_/test_html_output_confval_html_.html b/tests/test_output/test_output_/test_html_output_confval_html_.html index 1e8dbc4f..6ed5538d 100644 --- a/tests/test_output/test_output_/test_html_output_confval_html_.html +++ b/tests/test_output/test_output_/test_html_output_confval_html_.html @@ -23,7 +23,7 @@ {% if sphinx_version >= (5, 0) %} {% endif %}{% endif %} - {% if sphinx_version >= (5, 2) %} {% endif %} @@ -270,7 +270,9 @@

- + {% if sphinx_version >= (8, 1) %} +
+
{% endif %} diff --git a/tests/test_output/test_output_/test_html_output_decorators_html_.html b/tests/test_output/test_output_/test_html_output_decorators_html_.html index f12597b6..fa9ec2f4 100644 --- a/tests/test_output/test_output_/test_html_output_decorators_html_.html +++ b/tests/test_output/test_output_/test_html_output_decorators_html_.html @@ -23,7 +23,7 @@ {% if sphinx_version >= (5, 0) %} {% endif %}{% endif %} - {% if sphinx_version >= (5, 2) %} {% endif %} @@ -87,7 +87,9 @@

- + {% if sphinx_version >= (8, 1) %} +
+
{% endif %} diff --git a/tests/test_output/test_output_/test_html_output_documentation_summary_html_.html b/tests/test_output/test_output_/test_html_output_documentation_summary_html_.html index 99365af8..0e6ad805 100644 --- a/tests/test_output/test_output_/test_html_output_documentation_summary_html_.html +++ b/tests/test_output/test_output_/test_html_output_documentation_summary_html_.html @@ -21,7 +21,7 @@ {% if sphinx_version >= (5, 0) %} {% endif %}{% endif %} - {% if sphinx_version >= (5, 2) %} {% endif %} @@ -49,7 +49,9 @@

- + {% if sphinx_version >= (8, 1) %} +
+
{% endif %} diff --git a/tests/test_output/test_output_/test_html_output_documentation_summary_meta_html_.html b/tests/test_output/test_output_/test_html_output_documentation_summary_meta_html_.html index 59d37e40..0b976033 100644 --- a/tests/test_output/test_output_/test_html_output_documentation_summary_meta_html_.html +++ b/tests/test_output/test_output_/test_html_output_documentation_summary_meta_html_.html @@ -22,7 +22,7 @@ {% if sphinx_version >= (5, 0) %} {% endif %}{% endif %} - {% if sphinx_version >= (5, 2) %} {% endif %} @@ -52,7 +52,9 @@

- + {% if sphinx_version >= (8, 1) %} +
+
{% endif %} diff --git a/tests/test_output/test_output_/test_html_output_example_html_.html b/tests/test_output/test_output_/test_html_output_example_html_.html index e8998a7f..02a29a0d 100644 --- a/tests/test_output/test_output_/test_html_output_example_html_.html +++ b/tests/test_output/test_output_/test_html_output_example_html_.html @@ -21,7 +21,7 @@ {% if sphinx_version >= (5, 0) %} {% endif %}{% endif %} - {% if sphinx_version >= (5, 2) %} {% endif %} @@ -62,7 +62,9 @@

- + {% if sphinx_version >= (8, 1) %} +
+
{% endif %} diff --git a/tests/test_output/test_output_/test_html_output_flake8_html_.html b/tests/test_output/test_output_/test_html_output_flake8_html_.html index bb4a2bd5..40616433 100644 --- a/tests/test_output/test_output_/test_html_output_flake8_html_.html +++ b/tests/test_output/test_output_/test_html_output_flake8_html_.html @@ -21,7 +21,7 @@ {% if sphinx_version >= (5, 0) %} {% endif %}{% endif %} - {% if sphinx_version >= (5, 2) %} {% endif %} @@ -116,7 +116,9 @@

- + {% if sphinx_version >= (8, 1) %} +
+
{% endif %} diff --git a/tests/test_output/test_output_/test_html_output_footnote_symbols_html_.html b/tests/test_output/test_output_/test_html_output_footnote_symbols_html_.html index 3fd3568d..9d87bcdb 100644 --- a/tests/test_output/test_output_/test_html_output_footnote_symbols_html_.html +++ b/tests/test_output/test_output_/test_html_output_footnote_symbols_html_.html @@ -21,7 +21,7 @@ {% if sphinx_version >= (5, 0) %} {% endif %}{% endif %} - {% if sphinx_version >= (5, 2) %} {% endif %} @@ -103,7 +103,9 @@

- + {% if sphinx_version >= (8, 1) %} +
+
{% endif %} diff --git a/tests/test_output/test_output_/test_html_output_formatting_html_.html b/tests/test_output/test_output_/test_html_output_formatting_html_.html index fb6ae699..e7c9db45 100644 --- a/tests/test_output/test_output_/test_html_output_formatting_html_.html +++ b/tests/test_output/test_output_/test_html_output_formatting_html_.html @@ -21,7 +21,7 @@ {% if sphinx_version >= (5, 0) %} {% endif %}{% endif %} - {% if sphinx_version >= (5, 2) %} {% endif %} @@ -64,7 +64,9 @@

Other Extensions

- + {% if sphinx_version >= (8, 1) %} +
+
{% endif %} diff --git a/tests/test_output/test_output_/test_html_output_generic_bases_.html b/tests/test_output/test_output_/test_html_output_generic_bases_.html index a5c5813e..d842a068 100644 --- a/tests/test_output/test_output_/test_html_output_generic_bases_.html +++ b/tests/test_output/test_output_/test_html_output_generic_bases_.html @@ -23,7 +23,7 @@ {% if sphinx_version >= (5, 0) %} {% endif %}{% endif %} - {% if sphinx_version >= (5, 2) %} {% endif %} @@ -310,7 +310,9 @@

- + {% if sphinx_version >= (8, 1) %} +
+
{% endif %} diff --git a/tests/test_output/test_output_/test_html_output_genericalias_.html b/tests/test_output/test_output_/test_html_output_genericalias_.html index ff48c201..d9439389 100644 --- a/tests/test_output/test_output_/test_html_output_genericalias_.html +++ b/tests/test_output/test_output_/test_html_output_genericalias_.html @@ -23,7 +23,7 @@ {% if sphinx_version >= (5, 0) %} {% endif %}{% endif %} - {% if sphinx_version >= (5, 2) %} {% endif %} @@ -97,7 +97,9 @@

- + {% if sphinx_version >= (8, 1) %} +
+
{% endif %} diff --git a/tests/test_output/test_output_/test_html_output_github_html_.html b/tests/test_output/test_output_/test_html_output_github_html_.html index e887f748..866da40c 100644 --- a/tests/test_output/test_output_/test_html_output_github_html_.html +++ b/tests/test_output/test_output_/test_html_output_github_html_.html @@ -21,7 +21,7 @@ {% if sphinx_version >= (5, 0) %} {% endif %}{% endif %} - {% if sphinx_version >= (5, 2) %} {% endif %} @@ -150,7 +150,9 @@

.

- + {% if sphinx_version >= (8, 1) %} +
+
{% endif %} diff --git a/tests/test_output/test_output_/test_html_output_installation_html_.html b/tests/test_output/test_output_/test_html_output_installation_html_.html index d85d3728..9b16f4fe 100644 --- a/tests/test_output/test_output_/test_html_output_installation_html_.html +++ b/tests/test_output/test_output_/test_html_output_installation_html_.html @@ -21,7 +21,7 @@ {% if sphinx_version >= (5, 0) %} {% endif %}{% endif %} - {% if sphinx_version >= (5, 2) %} {% endif %}{% if sphinx_version >= (3, 5) %} @@ -44,21 +44,23 @@

-
-
- -
-
-
-
-
python3 -m pip install my_project --user
 
+
@@ -67,17 +69,19 @@

-
-
- -
-
-
-
-
python3 -m pip install my-project --user
+       
+
+
+ +
+
+
+
+
python3 -m pip install my-project --user
 
+
@@ -86,17 +90,19 @@

-
-
- -
-
-
-
-
python3 -m pip install my-project --user
+       
+
+
+ +
+
+
+
+
python3 -m pip install my-project --user
 
+
@@ -105,17 +111,19 @@

-
-
- -
-
-
-
-
conda install my_project
+       
+
+
+ +
+
+
+
+
conda install my_project
 
+
@@ -124,17 +132,19 @@

-
-
- -
-
-
-
-
conda install my-project
+       
+
+
+ +
+
+
+
+
conda install my-project
 
+
@@ -143,17 +153,19 @@

-
-
- -
-
-
-
-
conda install my-project
+       
+
+
+ +
+
+
+
+
conda install my-project
 
+
@@ -162,17 +174,19 @@

-
-
- -
-
-
-
-
python3 -m pip install git+https://github.com/sphinx-toolbox/sphinx-toolbox@master --user
+       
+
+
+ +
+
+
+
+
python3 -m pip install git+https://github.com/sphinx-toolbox/sphinx-toolbox@master --user
 
+
@@ -181,17 +195,19 @@

-
-
- -
-
-
-
-
python3 -m pip install git+https://github.com/sphinx-toolbox/sphinx-toolbox@master --user
+       
+
+
+ +
+
+
+
+
python3 -m pip install git+https://github.com/sphinx-toolbox/sphinx-toolbox@master --user
 
+
@@ -200,28 +216,30 @@

-
-
- - -
-
-
-
-
python3 -m pip install my_project --user
+       
+
+
+ + +
+
+
+
+
python3 -m pip install my_project --user
 
+
-
- {% if sphinx_version >= (8, 1) %} +
+
{% endif %}
diff --git a/tests/test_sphinx_version.py b/tests/test_sphinx_version.py new file mode 100644 index 00000000..9c84ac16 --- /dev/null +++ b/tests/test_sphinx_version.py @@ -0,0 +1,13 @@ +# stdlib +import os +import re + +# 3rd party +import sphinx + + +def test_sphinx_version_against_tox(): + m = re.match(r"py.*-sphinx(\d)\.(\d)", os.getenv("TOX_ENV_NAME", '')) + if m is not None: + target_version = tuple(map(int, m.groups())) + assert target_version == sphinx.version_info[:2] diff --git a/tests/test_testing.py b/tests/test_testing.py index 3674a396..b2c398ec 100644 --- a/tests/test_testing.py +++ b/tests/test_testing.py @@ -134,8 +134,8 @@ def test_testing(): assert get_app_config_values(app.config.values["source_link_target"]) == ("Sphinx", "env", [str]) assert get_app_config_values(app.config.values["github_username"]) == (None, "env", [str]) - assert get_app_config_values(app.config.values["rebuild_true"]) == (None, "env", ()) - assert get_app_config_values(app.config.values["rebuild_false"]) == (None, '', ()) + assert get_app_config_values(app.config.values["rebuild_true"]) == (None, "env", []) + assert get_app_config_values(app.config.values["rebuild_false"]) == (None, '', []) assert app.events.events["my-event"] == '' assert app.registry.translators["my-translator"] is FakeNodeVisitor diff --git a/tox.ini b/tox.ini index 33557e98..6cff09a8 100644 --- a/tox.ini +++ b/tox.ini @@ -24,10 +24,10 @@ envlist = py37-sphinx{3.2,3.3,3.4,3.5,4.0,4.1,4.2,4.3,4.4,4.5,5.0,5.1,5.2,5.3} py38-sphinx{3.2,3.3,3.4,3.5,4.0,4.1,4.2,4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1} py39-sphinx{3.2,3.3,3.4,3.5,4.0,4.1,4.2,4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1,7.2,7.3,7.4} - py310-sphinx{3.2,3.3,3.4,3.5,4.0,4.1,4.2,4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1,7.2,7.3,7.4,8.0} - py311-sphinx{3.2,3.3,3.4,3.5,4.0,4.1,4.2,4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1,7.2,7.3,7.4,8.0} - py312-sphinx{3.2,3.3,3.4,3.5,4.0,4.1,4.2,4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1,7.2,7.3,7.4,8.0} - py313-dev-sphinx{6.2,7.0,7.1,7.2,7.3,7.4,8.0} + py310-sphinx{3.2,3.3,3.4,3.5,4.0,4.1,4.2,4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1,7.2,7.3,7.4,8.0,8.1} + py311-sphinx{3.2,3.3,3.4,3.5,4.0,4.1,4.2,4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1,7.2,7.3,7.4,8.0,8.1,8.2} + py312-sphinx{4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1,7.2,7.3,7.4,8.0,8.1,8.2} + py313-sphinx{6.2,7.0,7.1,7.2,7.3,7.4,8.0,8.1,8.2} pypy37-sphinx{4.3,4.4,4.5,5.0,5.1,5.2,5.3} pypy38-sphinx{4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1} pypy39-sphinx{4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1,7.2,7.3,7.4} @@ -46,10 +46,10 @@ test = py37-sphinx{3.2,3.3,3.4,3.5,4.0,4.1,4.2,4.3,4.4,4.5,5.0,5.1,5.2,5.3} py38-sphinx{3.2,3.3,3.4,3.5,4.0,4.1,4.2,4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1} py39-sphinx{3.2,3.3,3.4,3.5,4.0,4.1,4.2,4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1,7.2,7.3,7.4} - py310-sphinx{3.2,3.3,3.4,3.5,4.0,4.1,4.2,4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1,7.2,7.3,7.4,8.0} - py311-sphinx{3.2,3.3,3.4,3.5,4.0,4.1,4.2,4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1,7.2,7.3,7.4,8.0} - py312-sphinx{3.2,3.3,3.4,3.5,4.0,4.1,4.2,4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1,7.2,7.3,7.4,8.0} - py313-dev-sphinx{6.2,7.0,7.1,7.2,7.3,7.4,8.0} + py310-sphinx{3.2,3.3,3.4,3.5,4.0,4.1,4.2,4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1,7.2,7.3,7.4,8.0,8.1} + py311-sphinx{3.2,3.3,3.4,3.5,4.0,4.1,4.2,4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1,7.2,7.3,7.4,8.0,8.1,8.2} + py312-sphinx{4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1,7.2,7.3,7.4,8.0,8.1,8.2} + py313-sphinx{6.2,7.0,7.1,7.2,7.3,7.4,8.0,8.1,8.2} pypy37-sphinx{4.3,4.4,4.5,5.0,5.1,5.2,5.3} pypy38-sphinx{4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1} pypy39-sphinx{4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1,7.2,7.3,7.4} @@ -62,7 +62,7 @@ setenv = PYTHONDEVMODE=1 PIP_DISABLE_PIP_VERSION_CHECK=1 -[testenv:py313-dev] +[testenv:py313] download = True setenv = PYTHONDEVMODE=1 @@ -229,17 +229,6 @@ ignore = W002 toplevel = sphinx_toolbox package = sphinx_toolbox -[testenv:py312-sphinx{3.2,3.3,3.4,3.5,4.0,4.1,4.2,4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1,7.2,7.3,7.4,8.0}] -setenv = - PYTHONDEVMODE=1 - PIP_DISABLE_PIP_VERSION_CHECK=1 - -[testenv:py313-dev-sphinx{3.2,3.3,3.4,3.5,4.0,4.1,4.2,4.3,4.4,4.5,5.0,5.1,5.2,5.3,6.0,6.1,6.2,7.0,7.1,7.2,7.3,7.4,8.0}] -setenv = - PYTHONDEVMODE=1 - PIP_DISABLE_PIP_VERSION_CHECK=1 - UNSAFE_PYO3_SKIP_VERSION_CHECK=1 - [testenv] setenv = PYTHONDEVMODE=1 @@ -282,42 +271,68 @@ commands = python --version python -m pytest --cov=sphinx_toolbox -r aR tests/ {posargs} -[testenv:py{39,310,311,312,313-dev,py39}-sphinx7.2] +[testenv:py{39,310,311,312,313,py39}-sphinx7.2] deps = -r{toxinidir}/tests/requirements.txt -r{toxinidir}/requirements.txt +extras = commands = pip install sphinx==7.2.6 pip install pygments>=2.7.4,<=2.13.0 python --version python -m pytest --cov=sphinx_toolbox -r aR tests/ {posargs} -[testenv:py{39,310,311,312,313-dev,py39}-sphinx7.3] +[testenv:py{39,310,311,312,313,py39}-sphinx7.3] deps = -r{toxinidir}/tests/requirements.txt -r{toxinidir}/requirements.txt +extras = commands = pip install sphinx==7.3.7 pip install pygments>=2.7.4,<=2.13.0 python --version python -m pytest --cov=sphinx_toolbox -r aR tests/ {posargs} -[testenv:py{39,310,311,312,313-dev,py39}-sphinx7.4] +[testenv:py{39,310,311,312,313,py39}-sphinx7.4] deps = -r{toxinidir}/tests/requirements.txt -r{toxinidir}/requirements.txt +extras = commands = pip install sphinx==7.4.7 pip install pygments>=2.7.4,<=2.13.0 python --version python -m pytest --cov=sphinx_toolbox -r aR tests/ {posargs} -[testenv:py{310,311,312,313-dev}-sphinx8.0] +[testenv:py{310,311,312,313}-sphinx8.0] deps = -r{toxinidir}/tests/requirements.txt -r{toxinidir}/requirements.txt +extras = commands = pip install sphinx==8.0.2 + pip install pygments>=2.7.4,<=2.13.0 alabaster==0.7.16 + python --version + python -m pytest --cov=sphinx_toolbox -r aR tests/ {posargs} + +[testenv:py{310,311,312,313}-sphinx8.1] +deps = + -r{toxinidir}/tests/requirements.txt + -r{toxinidir}/requirements.txt +extras = +commands = + pip install sphinx==8.1.3 + pip install pygments>=2.7.4,<=2.13.0 + python --version + python -m pytest --cov=sphinx_toolbox -r aR tests/ {posargs} + +[testenv:py{311,312,313}-sphinx8.2] +deps = + -r{toxinidir}/tests/requirements.txt + -r{toxinidir}/requirements.txt +extras = +commands = + pip install sphinx==8.2.1 pip install pygments>=2.7.4,<=2.13.0 python --version python -m pytest --cov=sphinx_toolbox -r aR tests/ {posargs} @@ -346,8 +361,6 @@ filterwarnings = always:The `docutils.parsers.rst.directive.html` module will be removed in Docutils 2.0.:DeprecationWarning always:'cgi' is deprecated and slated for removal in Python 3.13:DeprecationWarning always:nodes.Node.traverse\(\) is obsoleted by Node.findall\(\).:PendingDeprecationWarning - -[testenv:py{py37,py38,py39}-sphinx{3.3,3.4,3.5,4.0,4.1,4.2,4.3,4.4,4.5,5.0}] -commands = - python --version - python -m pytest -p no:cov -r aR tests/ {posargs} + always:'parser.split_opt' is deprecated and will be removed in Click 9.0. The old parser is available in 'optparse'.:DeprecationWarning + always:'OptionParser' is deprecated and will be removed in Click 9.0. The old parser is available in 'optparse'.:DeprecationWarning + always:The '__version__' attribute is deprecated and will be removed in Click 9.1..:DeprecationWarning