From 52dba0718e4986db51867c5fefd65322dc57d046 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Sun, 23 May 2021 01:08:07 +0900 Subject: [PATCH 01/38] Bump version --- CHANGES | 4 ++++ sphinxcontrib/serializinghtml/version.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 0a9bec6..68bcf58 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,7 @@ +Release 1.1.6 (unreleased) +========================== + + Release 1.1.5 (2021-05-23) ========================== diff --git a/sphinxcontrib/serializinghtml/version.py b/sphinxcontrib/serializinghtml/version.py index dc92d0a..a69a9e7 100644 --- a/sphinxcontrib/serializinghtml/version.py +++ b/sphinxcontrib/serializinghtml/version.py @@ -6,5 +6,5 @@ :license: BSD, see LICENSE for details. """ -__version__ = '1.1.5' +__version__ = '1.1.6' __version_info__ = tuple(map(int, __version__.split('.'))) From 4da97500eba78f3b61fe8232cdaedd0ac5072609 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+aa-turner@users.noreply.github.com> Date: Fri, 17 Mar 2023 00:16:48 +0000 Subject: [PATCH 02/38] git mv setup.py pyproject.toml --- setup.py => pyproject.toml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename setup.py => pyproject.toml (100%) diff --git a/setup.py b/pyproject.toml similarity index 100% rename from setup.py rename to pyproject.toml From 09c46744259e5a41a00c11652bd0ec27137ac02e Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+aa-turner@users.noreply.github.com> Date: Fri, 17 Mar 2023 00:25:42 +0000 Subject: [PATCH 03/38] Use modern ``pyproject`` based packaging --- pyproject.toml | 135 +++++++++++----------- setup.cfg | 13 --- sphinxcontrib/__init__.py | 15 --- sphinxcontrib/serializinghtml/__init__.py | 4 +- sphinxcontrib/serializinghtml/version.py | 10 -- 5 files changed, 73 insertions(+), 104 deletions(-) delete mode 100644 sphinxcontrib/__init__.py delete mode 100644 sphinxcontrib/serializinghtml/version.py diff --git a/pyproject.toml b/pyproject.toml index 8f1b614..36bc2fd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,71 +1,76 @@ -# -*- coding: utf-8 -*- -import os -from setuptools import setup, find_packages +[build-system] +requires = ["flit_core>=3.7"] +build-backend = "flit_core.buildapi" -long_desc = ''' -sphinxcontrib-serializinghtml is a sphinx extension which outputs -"serialized" HTML files (json and pickle). -''' +# project metadata +[project] +name = "sphinxcontrib-serializinghtml" +description = """sphinxcontrib-serializinghtml is a sphinx extension which \ +outputs "serialized" HTML files (json and pickle)""" +readme = "README.rst" +urls.Changelog = "https://www.sphinx-doc.org/en/master/changes.html" +urls.Code = "https://github.com/sphinx-doc/sphinxcontrib-serializinghtml" +urls.Download = "https://pypi.org/project/sphinxcontrib-serializinghtml/" +urls.Homepage = "https://www.sphinx-doc.org/" +urls."Issue tracker" = "https://github.com/sphinx-doc/sphinx/issues" +license.text = "BSD-2-Clause" +requires-python = ">=3.5" -extras_require = { - 'test': [ - 'pytest', - ], - 'lint': [ - 'flake8', - 'mypy', - 'docutils-stubs', - ], -} +# Classifiers list: https://pypi.org/classifiers/ +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Environment :: Console", + "Environment :: Web Environment", + "Intended Audience :: Developers", + "Intended Audience :: Education", + "License :: OSI Approved :: BSD License", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Framework :: Sphinx", + "Framework :: Sphinx :: Extension", + "Topic :: Documentation", + "Topic :: Documentation :: Sphinx", + "Topic :: Text Processing", + "Topic :: Utilities", +] +dependencies = [] +dynamic = ["version"] +[project.optional-dependencies] +test = [ + "pytest", +] +lint = [ + "flake8", + "mypy", + "docutils-stubs", +] -def get_version(): - """Get version number of the package from version.py without importing core module.""" - package_dir = os.path.abspath(os.path.dirname(__file__)) - version_file = os.path.join(package_dir, 'sphinxcontrib/serializinghtml/version.py') +[[project.authors]] +name = "Georg Brandl" +email = "georg@python.org" - namespace = {} - with open(version_file, 'rt') as f: - exec(f.read(), namespace) +[tool.flit.module] +name = "sphinxcontrib.serializinghtml" - return namespace['__version__'] - - -setup( - name='sphinxcontrib-serializinghtml', - version=get_version(), - url='http://sphinx-doc.org/', - download_url='https://pypi.org/project/sphinxcontrib-serializinghtml/', - license='BSD', - author='Georg Brandl', - author_email='georg@python.org', - description=long_desc.strip().replace('\n', ' '), - long_description=long_desc, - zip_safe=False, - classifiers=[ - 'Development Status :: 5 - Production/Stable', - 'Environment :: Console', - 'Environment :: Web Environment', - 'Intended Audience :: Developers', - 'Intended Audience :: Education', - 'License :: OSI Approved :: BSD License', - 'Operating System :: OS Independent', - 'Programming Language :: Python', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.5', - 'Programming Language :: Python :: 3.6', - 'Programming Language :: Python :: 3.7', - 'Framework :: Sphinx', - 'Framework :: Sphinx :: Extension', - 'Topic :: Documentation', - 'Topic :: Documentation :: Sphinx', - 'Topic :: Text Processing', - 'Topic :: Utilities', - ], - platforms='any', - python_requires=">=3.5", - packages=find_packages(exclude=['tests']), - include_package_data=True, - extras_require=extras_require, - namespace_packages=['sphinxcontrib'], -) +[tool.flit.sdist] +include = [ + "CHANGES", + "LICENSE", + # Tests + "tests/", + "tox.ini", +] +exclude = [ + "doc/_build", +] diff --git a/setup.cfg b/setup.cfg index f346323..dcf63c9 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,10 +1,3 @@ -[egg_info] -tag_build = .dev -tag_date = true - -[aliases] -release = egg_info -Db '' - [extract_messages] output_file = sphinxcontrib/serializinghtml/locales/sphinxcontrib.serializinghtml.pot keywords = _ __ @@ -14,12 +7,6 @@ domain = sphinxcontrib.serializinghtml directory = sphinxcontrib/serializinghtml/locales/ use_fuzzy = true -[bdist_wheel] -universal = 1 - -[metadata] -license_file = LICENSE - [flake8] max-line-length = 95 ignore = E116,E241,E251 diff --git a/sphinxcontrib/__init__.py b/sphinxcontrib/__init__.py deleted file mode 100644 index c10210a..0000000 --- a/sphinxcontrib/__init__.py +++ /dev/null @@ -1,15 +0,0 @@ -""" - sphinxcontrib - ~~~~~~~~~~~~~ - - This package is a namespace package that contains all extensions - distributed in the ``sphinx-contrib`` distribution. - - :copyright: Copyright 2007-2009 by the Sphinx team, see AUTHORS. - :license: BSD, see LICENSE for details. -""" - -import pkg_resources - - -pkg_resources.declare_namespace(__name__) diff --git a/sphinxcontrib/serializinghtml/__init__.py b/sphinxcontrib/serializinghtml/__init__.py index c247656..ff800a0 100644 --- a/sphinxcontrib/serializinghtml/__init__.py +++ b/sphinxcontrib/serializinghtml/__init__.py @@ -17,12 +17,14 @@ from sphinx.util.osutil import SEP, copyfile, ensuredir, os_path from sphinxcontrib.serializinghtml import jsonimpl -from sphinxcontrib.serializinghtml.version import __version__ if False: # For type annotation from typing import Any, Dict, Tuple # NOQA +__version__ = '1.1.6' +__version_info__ = (1, 1, 6) + package_dir = path.abspath(path.dirname(__file__)) __ = get_translation(__name__, 'console') diff --git a/sphinxcontrib/serializinghtml/version.py b/sphinxcontrib/serializinghtml/version.py deleted file mode 100644 index a69a9e7..0000000 --- a/sphinxcontrib/serializinghtml/version.py +++ /dev/null @@ -1,10 +0,0 @@ -""" - sphinxcontrib.serializinghtml.version - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - :copyright: Copyright 2007-2019 by the Sphinx team, see README. - :license: BSD, see LICENSE for details. -""" - -__version__ = '1.1.6' -__version_info__ = tuple(map(int, __version__.split('.'))) From 4b94ea930bf9ab7720b437e96981d1c7f129a01b Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+aa-turner@users.noreply.github.com> Date: Fri, 17 Mar 2023 00:27:20 +0000 Subject: [PATCH 04/38] Move tool configuration to individual files --- .flake8 | 4 ++++ setup.cfg => babel.cfg | 9 --------- pyproject.toml | 3 +++ 3 files changed, 7 insertions(+), 9 deletions(-) create mode 100644 .flake8 rename setup.cfg => babel.cfg (63%) diff --git a/.flake8 b/.flake8 new file mode 100644 index 0000000..5af0a95 --- /dev/null +++ b/.flake8 @@ -0,0 +1,4 @@ +[flake8] +max-line-length = 95 +ignore = E116,E241,E251 +exclude = .git,.tox,.venv diff --git a/setup.cfg b/babel.cfg similarity index 63% rename from setup.cfg rename to babel.cfg index dcf63c9..fb9cc94 100644 --- a/setup.cfg +++ b/babel.cfg @@ -6,12 +6,3 @@ keywords = _ __ domain = sphinxcontrib.serializinghtml directory = sphinxcontrib/serializinghtml/locales/ use_fuzzy = true - -[flake8] -max-line-length = 95 -ignore = E116,E241,E251 -exclude = .git,.tox,.venv - -[mypy] -ignore_missing_imports = True -strict_optional = False diff --git a/pyproject.toml b/pyproject.toml index 36bc2fd..f56c7d4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -74,3 +74,6 @@ include = [ exclude = [ "doc/_build", ] + +[tool.mypy] +ignore_missing_imports = true From 4ae674533ed62a2da64e7d69d5be50baa35bc16d Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+aa-turner@users.noreply.github.com> Date: Mon, 7 Aug 2023 16:45:26 +0100 Subject: [PATCH 05/38] Support Python 3.9 and later --- .github/workflows/test.yml | 73 +++++++++++++++----------------------- CHANGES | 2 ++ MANIFEST.in | 8 ----- pyproject.toml | 11 +++--- tox.ini | 12 ++----- 5 files changed, 39 insertions(+), 67 deletions(-) delete mode 100644 MANIFEST.in diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2f6f9a8..fe363d4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,50 +1,39 @@ name: Test -on: [push, pull_request] +on: + push: + pull_request: + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true jobs: tests: runs-on: ubuntu-latest strategy: matrix: - python-version: [3.6, 3.7, 3.8, 3.9, 3.10-dev] - max-parallel: 1 + python: + - "3.9" + - "3.10" + - "3.11" + - "3.12-dev" + - "3.13-dev" + fail-fast: false steps: - - name: Print github context - env: - GITHUB_CONTEXT: ${{ toJson(github) }} - run: echo $GITHUB_CONTEXT - - - name: Checkout code - uses: actions/checkout@v2 - with: - fetch-depth: 1 - - - name: pycache - uses: actions/cache@v2 - id: pycache - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }} - restore-keys: | - ${{ runner.os }}-pip- - - - name: Setup python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - if: "!endsWith(matrix.python-version, '-dev')" - with: - python-version: ${{ matrix.python-version }} - - - name: Setup python ${{ matrix.python-version }} (via deadsnakes) - uses: deadsnakes/action@v2.1.1 - if: "endsWith(matrix.python-version, '-dev')" + - uses: actions/checkout@v3 + - name: Setup Python ${{ matrix.python }} + uses: actions/setup-python@v4 with: - python-version: ${{ matrix.python-version }} - - - name: Install tox and test related + python-version: ${{ matrix.python }} + - name: Install dependencies run: | python -m pip install --upgrade pip - pip install tox tox-gh-actions + python -m pip install --upgrade tox - name: Run tox run: | @@ -58,20 +47,16 @@ jobs: env: [flake8, mypy] steps: - - name: Checkout code - uses: actions/checkout@v2 - with: - fetch-depth: 1 - + - uses: actions/checkout@v3 - name: Setup python - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: - python-version: 3.8 + python-version: "3" - - name: Install tox and any other dependencies for test + - name: Install dependencies run: | python -m pip install --upgrade pip - pip install tox tox-gh-actions + python -m pip install --upgrade tox - name: Run tox run: tox -e ${{ matrix.env }} diff --git a/CHANGES b/CHANGES index 68bcf58..9be4999 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,8 @@ Release 1.1.6 (unreleased) ========================== +* Drop support for Python 3.5, 3.6, 3.7, and 3.8 +* Raise minimum required Sphinx version to 5.0 Release 1.1.5 (2021-05-23) ========================== diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index d4b2097..0000000 --- a/MANIFEST.in +++ /dev/null @@ -1,8 +0,0 @@ -include README.rst -include LICENSE -include CHANGES - -include tox.ini - -recursive-include sphinxcontrib/serializinghtml/locales * -recursive-include tests * diff --git a/pyproject.toml b/pyproject.toml index f56c7d4..8c39008 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,7 +14,7 @@ urls.Download = "https://pypi.org/project/sphinxcontrib-serializinghtml/" urls.Homepage = "https://www.sphinx-doc.org/" urls."Issue tracker" = "https://github.com/sphinx-doc/sphinx/issues" license.text = "BSD-2-Clause" -requires-python = ">=3.5" +requires-python = ">=3.9" # Classifiers list: https://pypi.org/classifiers/ classifiers = [ @@ -28,14 +28,11 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3.5", - "Programming Language :: Python :: 3.6", - "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", "Framework :: Sphinx", "Framework :: Sphinx :: Extension", "Topic :: Documentation", @@ -43,7 +40,9 @@ classifiers = [ "Topic :: Text Processing", "Topic :: Utilities", ] -dependencies = [] +dependencies = [ + "Sphinx>=5", +] dynamic = ["version"] [project.optional-dependencies] diff --git a/tox.ini b/tox.ini index 83a34fd..0cacfb2 100644 --- a/tox.ini +++ b/tox.ini @@ -1,16 +1,10 @@ [tox] +minversion = 2.4.0 envlist = - py{36,37,38,39,310-dev}, + py{39,310,311,312,313}, flake8, mypy - -[gh-actions] -python = - 3.6: py36 - 3.7: py37 - 3.8: py38 - 3.9: py39 - 3.10: py310-dev +isolated_build = True [testenv] usedevelop = true From 4d353d2ba3db7da96fe5250c9edf476f7601c946 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+aa-turner@users.noreply.github.com> Date: Mon, 7 Aug 2023 16:46:28 +0100 Subject: [PATCH 06/38] Add GHA release workflow --- .github/workflows/create-release.yml | 90 ++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 .github/workflows/create-release.yml diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml new file mode 100644 index 0000000..4599734 --- /dev/null +++ b/.github/workflows/create-release.yml @@ -0,0 +1,90 @@ +name: Create release + +on: + push: + tags: + - "v*.*.*" + workflow_dispatch: + +permissions: + contents: read + +jobs: + publish-pypi: + runs-on: ubuntu-latest + name: PyPI Release + environment: release + permissions: + id-token: write # for PyPI trusted publishing + steps: + - uses: actions/checkout@v3 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: 3 + cache: pip + cache-dependency-path: pyproject.toml + + - name: Install build dependencies (pypa/build, twine) + run: | + pip install -U pip + pip install build twine + + - name: Build distribution + run: python -m build + + - name: Mint PyPI API token + id: mint-token + uses: actions/github-script@v6 + with: + # language=JavaScript + script: | + // retrieve the ambient OIDC token + const oidc_request_token = process.env.ACTIONS_ID_TOKEN_REQUEST_TOKEN; + const oidc_request_url = process.env.ACTIONS_ID_TOKEN_REQUEST_URL; + const oidc_resp = await fetch(`${oidc_request_url}&audience=pypi`, { + headers: {Authorization: `bearer ${oidc_request_token}`}, + }); + const oidc_token = (await oidc_resp.json()).value; + + // exchange the OIDC token for an API token + const mint_resp = await fetch('https://pypi.org/_/oidc/github/mint-token', { + method: 'post', + body: `{"token": "${oidc_token}"}` , + headers: {'Content-Type': 'application/json'}, + }); + const api_token = (await mint_resp.json()).token; + + // mask the newly minted API token, so that we don't accidentally leak it + core.setSecret(api_token) + core.setOutput('api-token', api_token) + + - name: Upload to PyPI + env: + TWINE_NON_INTERACTIVE: "true" + TWINE_USERNAME: "__token__" + TWINE_PASSWORD: "${{ steps.mint-token.outputs.api-token }}" + run: | + twine check dist/* + twine upload dist/* + + github-release: + runs-on: ubuntu-latest + name: GitHub release + environment: release + permissions: + contents: write # for softprops/action-gh-release to create GitHub release + steps: + - uses: actions/checkout@v3 + - name: Get release version + id: get_version + uses: actions/github-script@v6 + with: + script: core.setOutput('version', context.ref.replace("refs/tags/v", "")) + + - name: Create GitHub release + uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/') + with: + name: "sphinxcontrib-serializinghtml ${{ steps.get_version.outputs.version }}" + body: "Changelog: https://www.sphinx-doc.org/en/master/changes.html" From 1fd871586272d5ca886719e780d260c8b572857b Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+aa-turner@users.noreply.github.com> Date: Mon, 7 Aug 2023 17:01:37 +0100 Subject: [PATCH 07/38] Invoke pytest directly --- .github/workflows/test.yml | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index fe363d4..b974e1f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,6 +11,11 @@ concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} cancel-in-progress: true +env: + FORCE_COLOR: "1" + PYTHONDEVMODE: "1" # -X dev + PYTHONWARNDEFAULTENCODING: "1" # -X warn_default_encoding + jobs: tests: runs-on: ubuntu-latest @@ -33,12 +38,11 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - python -m pip install --upgrade tox + python -m pip install --upgrade pytest + python -m pip install --upgrade Sphinx @ git+https://github.com/sphinx-doc/sphinx - - name: Run tox - run: | - python -V - tox -- -v --durations=25 + - name: Test with pytest + run: python -m pytest --durations 25 lint: runs-on: ubuntu-latest From 36c1f44dbded564ac9e3e4da701b0cf5debbc410 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+aa-turner@users.noreply.github.com> Date: Mon, 7 Aug 2023 17:05:33 +0100 Subject: [PATCH 08/38] Fix the quoting for installation from git --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b974e1f..54dc417 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -39,7 +39,7 @@ jobs: run: | python -m pip install --upgrade pip python -m pip install --upgrade pytest - python -m pip install --upgrade Sphinx @ git+https://github.com/sphinx-doc/sphinx + python -m pip install "Sphinx @ git+https://github.com/sphinx-doc/sphinx" - name: Test with pytest run: python -m pytest --durations 25 From 4f9aaab918d001400a31d4b22aa3042594a9b4fa Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+aa-turner@users.noreply.github.com> Date: Mon, 7 Aug 2023 18:09:02 +0100 Subject: [PATCH 09/38] Fix test failures --- .github/workflows/test.yml | 10 ++++++++-- sphinxcontrib/serializinghtml/__init__.py | 1 + tests/conftest.py | 6 +++--- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 54dc417..082f9ee 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -31,14 +31,20 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Setup Python ${{ matrix.python }} + - name: Set up Python ${{ matrix.python }} uses: actions/setup-python@v4 + if: "!endsWith(matrix.python, '-dev')" + with: + python-version: ${{ matrix.python }} + - name: Set up Python ${{ matrix.python }} (deadsnakes) + uses: deadsnakes/action@v2.1.1 + if: "endsWith(matrix.python, '-dev')" with: python-version: ${{ matrix.python }} - name: Install dependencies run: | python -m pip install --upgrade pip - python -m pip install --upgrade pytest + python -m pip install .[test] python -m pip install "Sphinx @ git+https://github.com/sphinx-doc/sphinx" - name: Test with pytest diff --git a/sphinxcontrib/serializinghtml/__init__.py b/sphinxcontrib/serializinghtml/__init__.py index ff800a0..1da7fad 100644 --- a/sphinxcontrib/serializinghtml/__init__.py +++ b/sphinxcontrib/serializinghtml/__init__.py @@ -86,6 +86,7 @@ def handle_page(self, pagename, ctx, templatename='page.html', outfilename=None, event_arg=None): # type: (str, Dict, str, str, Any) -> None ctx['current_page_name'] = pagename + ctx.setdefault('pathto', lambda p: p) self.add_sidebars(pagename, ctx) if not outfilename: diff --git a/tests/conftest.py b/tests/conftest.py index ae725dc..c80a172 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -6,13 +6,13 @@ :license: BSD, see LICENSE for details. """ -import pytest +from pathlib import Path -from sphinx.testing.path import path +import pytest pytest_plugins = 'sphinx.testing.fixtures' @pytest.fixture(scope='session') def rootdir(): - return path(__file__).parent.abspath() / 'roots' + return Path(__file__).resolve().parent / 'roots' From 14b29318ea3b011149f61c7d6b3ac8bb5287cf13 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+aa-turner@users.noreply.github.com> Date: Mon, 7 Aug 2023 18:54:06 +0100 Subject: [PATCH 10/38] Fix mypy errors --- sphinxcontrib/serializinghtml/__init__.py | 10 +++++----- tox.ini | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sphinxcontrib/serializinghtml/__init__.py b/sphinxcontrib/serializinghtml/__init__.py index 1da7fad..f29887a 100644 --- a/sphinxcontrib/serializinghtml/__init__.py +++ b/sphinxcontrib/serializinghtml/__init__.py @@ -56,9 +56,9 @@ def init(self): # type: () -> None self.build_info = BuildInfo(self.config, self.tags) self.imagedir = '_images' - self.current_docname = None - self.theme = None # no theme necessary - self.templates = None # no template bridge necessary + self.current_docname = '' + self.theme = None # type: ignore[assignment] # no theme necessary + self.templates = None # no template bridge necessary self.init_templates() self.init_highlighter() self.init_css_files() @@ -66,7 +66,7 @@ def init(self): self.use_index = self.get_builder_config('use_index', 'html') def get_target_uri(self, docname, typ=None): - # type: (str, str) -> str + # type: (str, str | None) -> str if docname == 'index': return '' if docname.endswith(SEP + 'index'): @@ -84,7 +84,7 @@ def dump_context(self, context, filename): def handle_page(self, pagename, ctx, templatename='page.html', outfilename=None, event_arg=None): - # type: (str, Dict, str, str, Any) -> None + # type: (str, Dict, str, str | None, Any) -> None ctx['current_page_name'] = pagename ctx.setdefault('pathto', lambda p: p) self.add_sidebars(pagename, ctx) diff --git a/tox.ini b/tox.ini index 0cacfb2..9ad9f73 100644 --- a/tox.ini +++ b/tox.ini @@ -34,4 +34,4 @@ extras = test lint commands= - mypy sphinxcontrib/ + mypy sphinxcontrib/ --explicit-package-bases From 2dc77711a162723bed196a747cbbbf710300a84c Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+aa-turner@users.noreply.github.com> Date: Mon, 7 Aug 2023 19:17:51 +0100 Subject: [PATCH 11/38] Convert type comments to annotations --- sphinxcontrib/serializinghtml/__init__.py | 33 +++++++++-------------- sphinxcontrib/serializinghtml/jsonimpl.py | 22 ++++++--------- 2 files changed, 21 insertions(+), 34 deletions(-) diff --git a/sphinxcontrib/serializinghtml/__init__.py b/sphinxcontrib/serializinghtml/__init__.py index f29887a..e710527 100644 --- a/sphinxcontrib/serializinghtml/__init__.py +++ b/sphinxcontrib/serializinghtml/__init__.py @@ -6,10 +6,12 @@ :license: BSD, see LICENSE for details. """ +from __future__ import annotations + import pickle import types from os import path -from typing import Any, Dict +from typing import Any from sphinx.application import ENV_PICKLE_FILENAME, Sphinx from sphinx.builders.html import BuildInfo, StandaloneHTMLBuilder @@ -18,10 +20,6 @@ from sphinxcontrib.serializinghtml import jsonimpl -if False: - # For type annotation - from typing import Any, Dict, Tuple # NOQA - __version__ = '1.1.6' __version_info__ = (1, 1, 6) @@ -41,19 +39,18 @@ class SerializingHTMLBuilder(StandaloneHTMLBuilder): #: the serializing implementation to use. Set this to a module that #: implements a `dump`, `load`, `dumps` and `loads` functions #: (pickle, simplejson etc.) - implementation = None # type: Any + implementation: Any = None implementation_dumps_unicode = False #: additional arguments for dump() - additional_dump_args = () # type: Tuple + additional_dump_args = () #: the filename for the global context file - globalcontext_filename = None # type: str + globalcontext_filename: str | None = None supported_image_types = ['image/svg+xml', 'image/png', 'image/gif', 'image/jpeg'] - def init(self): - # type: () -> None + def init(self) -> None: self.build_info = BuildInfo(self.config, self.tags) self.imagedir = '_images' self.current_docname = '' @@ -65,16 +62,14 @@ def init(self): self.init_js_files() self.use_index = self.get_builder_config('use_index', 'html') - def get_target_uri(self, docname, typ=None): - # type: (str, str | None) -> str + def get_target_uri(self, docname: str, typ: str | None = None) -> str: if docname == 'index': return '' if docname.endswith(SEP + 'index'): return docname[:-5] # up to sep return docname + SEP - def dump_context(self, context, filename): - # type: (Dict, str) -> None + def dump_context(self, context: dict, filename: str) -> None: if self.implementation_dumps_unicode: with open(filename, 'w', encoding='utf-8') as ft: self.implementation.dump(context, ft, *self.additional_dump_args) @@ -82,9 +77,8 @@ def dump_context(self, context, filename): with open(filename, 'wb') as fb: self.implementation.dump(context, fb, *self.additional_dump_args) - def handle_page(self, pagename, ctx, templatename='page.html', - outfilename=None, event_arg=None): - # type: (str, Dict, str, str | None, Any) -> None + def handle_page(self, pagename: str, ctx: dict, templatename: str = 'page.html', + outfilename: str | None = None, event_arg: Any = None) -> None: ctx['current_page_name'] = pagename ctx.setdefault('pathto', lambda p: p) self.add_sidebars(pagename, ctx) @@ -113,8 +107,7 @@ def handle_page(self, pagename, ctx, templatename='page.html', ensuredir(path.dirname(source_name)) copyfile(self.env.doc2path(pagename), source_name) - def handle_finish(self): - # type: () -> None + def handle_finish(self) -> None: # dump the global context outfilename = path.join(self.outdir, self.globalcontext_filename) self.dump_context(self.globalcontext, outfilename) @@ -165,7 +158,7 @@ class JSONHTMLBuilder(SerializingHTMLBuilder): searchindex_filename = 'searchindex.json' -def setup(app: Sphinx) -> Dict[str, Any]: +def setup(app: Sphinx) -> dict[str, Any]: app.setup_extension('sphinx.builders.html') app.add_builder(JSONHTMLBuilder) app.add_builder(PickleHTMLBuilder) diff --git a/sphinxcontrib/serializinghtml/jsonimpl.py b/sphinxcontrib/serializinghtml/jsonimpl.py index ecb0b79..8c14cca 100644 --- a/sphinxcontrib/serializinghtml/jsonimpl.py +++ b/sphinxcontrib/serializinghtml/jsonimpl.py @@ -8,40 +8,34 @@ :license: BSD, see LICENSE for details. """ +from __future__ import annotations + import json from collections import UserString - -if False: - # For type annotation - from typing import Any, IO # NOQA +from typing import Any, IO class SphinxJSONEncoder(json.JSONEncoder): """JSONEncoder subclass that forces translation proxies.""" - def default(self, obj): - # type: (Any) -> str + def default(self, obj: Any) -> str: if isinstance(obj, UserString): return str(obj) return super().default(obj) -def dump(obj, fp, *args, **kwds): - # type: (Any, IO, Any, Any) -> None +def dump(obj: Any, fp: IO, *args: Any, **kwds: Any) -> None: kwds['cls'] = SphinxJSONEncoder json.dump(obj, fp, *args, **kwds) -def dumps(obj, *args, **kwds): - # type: (Any, Any, Any) -> str +def dumps(obj: Any, *args: Any, **kwds: Any) -> str: kwds['cls'] = SphinxJSONEncoder return json.dumps(obj, *args, **kwds) -def load(*args, **kwds): - # type: (Any, Any) -> Any +def load(*args: Any, **kwds: Any) -> Any: return json.load(*args, **kwds) -def loads(*args, **kwds): - # type: (Any, Any) -> Any +def loads(*args: Any, **kwds: Any) -> Any: return json.loads(*args, **kwds) From 91f89bd6b2433222e659b912222b7a892d0a4572 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+aa-turner@users.noreply.github.com> Date: Mon, 7 Aug 2023 19:26:55 +0100 Subject: [PATCH 12/38] fixup! Convert type comments to annotations --- sphinxcontrib/serializinghtml/__init__.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sphinxcontrib/serializinghtml/__init__.py b/sphinxcontrib/serializinghtml/__init__.py index e710527..bf1d0f4 100644 --- a/sphinxcontrib/serializinghtml/__init__.py +++ b/sphinxcontrib/serializinghtml/__init__.py @@ -8,6 +8,7 @@ from __future__ import annotations +import os import pickle import types from os import path @@ -42,10 +43,10 @@ class SerializingHTMLBuilder(StandaloneHTMLBuilder): implementation: Any = None implementation_dumps_unicode = False #: additional arguments for dump() - additional_dump_args = () + additional_dump_args: tuple = () #: the filename for the global context file - globalcontext_filename: str | None = None + globalcontext_filename: str = '' supported_image_types = ['image/svg+xml', 'image/png', 'image/gif', 'image/jpeg'] @@ -69,7 +70,7 @@ def get_target_uri(self, docname: str, typ: str | None = None) -> str: return docname[:-5] # up to sep return docname + SEP - def dump_context(self, context: dict, filename: str) -> None: + def dump_context(self, context: dict, filename: str | os.PathLike[str]) -> None: if self.implementation_dumps_unicode: with open(filename, 'w', encoding='utf-8') as ft: self.implementation.dump(context, ft, *self.additional_dump_args) @@ -109,7 +110,7 @@ def handle_page(self, pagename: str, ctx: dict, templatename: str = 'page.html', def handle_finish(self) -> None: # dump the global context - outfilename = path.join(self.outdir, self.globalcontext_filename) + outfilename = self.outdir / self.globalcontext_filename self.dump_context(self.globalcontext, outfilename) # super here to dump the search index From 1ab1f8ca9b2df2745ba94150ba8ffd99533f0546 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+aa-turner@users.noreply.github.com> Date: Mon, 7 Aug 2023 19:47:10 +0100 Subject: [PATCH 13/38] Remove module titles in docstrings --- sphinxcontrib/serializinghtml/__init__.py | 8 -------- sphinxcontrib/serializinghtml/jsonimpl.py | 10 +--------- tests/conftest.py | 8 -------- tests/test_serializinghtml.py | 10 +--------- 4 files changed, 2 insertions(+), 34 deletions(-) diff --git a/sphinxcontrib/serializinghtml/__init__.py b/sphinxcontrib/serializinghtml/__init__.py index bf1d0f4..6f2c8b8 100644 --- a/sphinxcontrib/serializinghtml/__init__.py +++ b/sphinxcontrib/serializinghtml/__init__.py @@ -1,11 +1,3 @@ -""" - sphinxcontrib.serializinghtml - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - :copyright: Copyright 2007-2019 by the Sphinx team, see README. - :license: BSD, see LICENSE for details. -""" - from __future__ import annotations import os diff --git a/sphinxcontrib/serializinghtml/jsonimpl.py b/sphinxcontrib/serializinghtml/jsonimpl.py index 8c14cca..e80c047 100644 --- a/sphinxcontrib/serializinghtml/jsonimpl.py +++ b/sphinxcontrib/serializinghtml/jsonimpl.py @@ -1,12 +1,4 @@ -""" - sphinx.util.jsonimpl - ~~~~~~~~~~~~~~~~~~~~ - - JSON serializer implementation wrapper. - - :copyright: Copyright 2007-2019 by the Sphinx team, see AUTHORS. - :license: BSD, see LICENSE for details. -""" +"""JSON serializer implementation wrapper.""" from __future__ import annotations diff --git a/tests/conftest.py b/tests/conftest.py index c80a172..bad18f1 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,11 +1,3 @@ -""" - pytest config for sphinx extensions - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - :copyright: Copyright 2007-2019 by the Sphinx team, see AUTHORS. - :license: BSD, see LICENSE for details. -""" - from pathlib import Path import pytest diff --git a/tests/test_serializinghtml.py b/tests/test_serializinghtml.py index e04a201..b6f6380 100644 --- a/tests/test_serializinghtml.py +++ b/tests/test_serializinghtml.py @@ -1,12 +1,4 @@ -""" - test_serializinghtml - ~~~~~~~~~~~~~~~~~~~~ - - Test for serializinghtml extension. - - :copyright: Copyright 2007-2019 by the Sphinx team, see AUTHORS. - :license: BSD, see LICENSE for details. -""" +"""Test for serializinghtml extension.""" import pytest From dc42c86e7dd1291f6dc8a4eea77270ed62833637 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+aa-turner@users.noreply.github.com> Date: Mon, 7 Aug 2023 19:58:05 +0100 Subject: [PATCH 14/38] Add a workflow to synchronisation translations --- .github/transifex.yml | 75 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 .github/transifex.yml diff --git a/.github/transifex.yml b/.github/transifex.yml new file mode 100644 index 0000000..b0427ac --- /dev/null +++ b/.github/transifex.yml @@ -0,0 +1,75 @@ +name: Synchronise translations + +on: + schedule: + # 22:38 GMT, every Sunday. Chosen to be a random time. + - cron: "38 22 * * SUN" + workflow_dispatch: + +permissions: + contents: read + +jobs: + push: + if: github.repository_owner == 'sphinx-doc' + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: 3 + - name: Install transifex client + run: | + mkdir -p /tmp/tx_cli && cd $_ + curl -o- https://raw.githubusercontent.com/transifex/cli/master/install.sh | bash + shell: bash + - name: Install dependencies + run: pip install --upgrade babel jinja2 + - name: Extract translations from source code + run: python utils/babel_runner.py extract + - name: Push translations to transifex.com + run: | + cd sphinxcontrib/serializinghtml/locales + /tmp/tx_cli/tx push --source --use-git-timestamps --workers 10 + env: + TX_TOKEN: ${{ secrets.TX_TOKEN }} + + pull: + permissions: + contents: write # for peter-evans/create-pull-request to create branch + pull-requests: write # for peter-evans/create-pull-request to create a PR + if: github.repository_owner == 'sphinx-doc' + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: 3 + - name: Install transifex client + run: | + mkdir -p /tmp/tx_cli && cd $_ + curl -o- https://raw.githubusercontent.com/transifex/cli/master/install.sh | bash + shell: bash + - name: Install dependencies + run: pip install --upgrade babel jinja2 + - name: Extract translations from source code + run: python utils/babel_runner.py extract + - name: Pull translations from transifex.com + run: | + cd sphinxcontrib/serializinghtml/locales + /tmp/tx_cli/tx pull --translations --all --force --use-git-timestamps --workers 10 + env: + TX_TOKEN: ${{ secrets.TX_TOKEN }} + - name: Compile message catalogs + run: python utils/babel_runner.py compile + - name: Create Pull Request + uses: peter-evans/create-pull-request@v4 + with: + commit-message: "[internationalisation] Update translations" + branch: bot/pull-translations + title: "[bot]: Update message catalogues" + labels: "internals:internationalisation" From de983ce7af7f9d6c086c2f9497090d745cfce343 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+aa-turner@users.noreply.github.com> Date: Mon, 7 Aug 2023 20:00:11 +0100 Subject: [PATCH 15/38] Remove outdated sections from README --- README.rst | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/README.rst b/README.rst index c37d036..d9ed40a 100644 --- a/README.rst +++ b/README.rst @@ -14,23 +14,6 @@ Install from PyPI:: pip install -U sphinxcontrib-serializinghtml -Release signatures -================== - -Releases are signed with following keys: - -* `498D6B9E `_ -* `5EBA0E07 `_ - -Testing -======= - -To run the tests with the interpreter available as ``python``, use:: - - tox - -Continuous testing runs on travis: https://travis-ci.org/sphinx-doc/sphinxcontrib-serializinghtml - Contributing ============ From a79c223995f9f6a7039e916378bf6e877ac77e6d Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+aa-turner@users.noreply.github.com> Date: Mon, 7 Aug 2023 20:10:27 +0100 Subject: [PATCH 16/38] Fix tag pattern --- .github/workflows/create-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index 4599734..df853e7 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -3,7 +3,7 @@ name: Create release on: push: tags: - - "v*.*.*" + - "*.*.*" workflow_dispatch: permissions: From 9ad2844331739f18e59177dce02c749459f08e18 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+aa-turner@users.noreply.github.com> Date: Mon, 7 Aug 2023 20:03:26 +0100 Subject: [PATCH 17/38] Bump to 1.1.6 final --- CHANGES | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 9be4999..0c534dc 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,4 @@ -Release 1.1.6 (unreleased) +Release 1.1.6 (2023-08-07) ========================== * Drop support for Python 3.5, 3.6, 3.7, and 3.8 From 5b964aed7db1368cc203fbfcb618b655cb2177b1 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+aa-turner@users.noreply.github.com> Date: Mon, 7 Aug 2023 20:39:52 +0100 Subject: [PATCH 18/38] Fix GitHub Release workflow --- .github/workflows/create-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index df853e7..857607f 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -80,7 +80,7 @@ jobs: id: get_version uses: actions/github-script@v6 with: - script: core.setOutput('version', context.ref.replace("refs/tags/v", "")) + script: core.setOutput('version', context.ref.replace("refs/tags/", "")) - name: Create GitHub release uses: softprops/action-gh-release@v1 From 010ed5629dd70e77c6df7cf753e6c93270254811 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+aa-turner@users.noreply.github.com> Date: Wed, 9 Aug 2023 16:02:57 +0100 Subject: [PATCH 19/38] Test Sphinx's master branch distinctly from ordinary tests --- .github/workflows/test.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 082f9ee..c459016 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -41,6 +41,23 @@ jobs: if: "endsWith(matrix.python, '-dev')" with: python-version: ${{ matrix.python }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install .[test] + + - name: Test with pytest + run: python -m pytest --durations 25 + + test-latest-sphinx: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python }} + uses: actions/setup-python@v4 + with: + python-version: "3" - name: Install dependencies run: | python -m pip install --upgrade pip From 5c00ac15e2ade99e99f36402b1f6befb1be1affa Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+aa-turner@users.noreply.github.com> Date: Wed, 9 Aug 2023 16:08:03 +0100 Subject: [PATCH 20/38] Run pytest with ``-vv`` --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c459016..794d170 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -47,7 +47,7 @@ jobs: python -m pip install .[test] - name: Test with pytest - run: python -m pytest --durations 25 + run: python -m pytest -vv --durations 25 test-latest-sphinx: runs-on: ubuntu-latest @@ -65,7 +65,7 @@ jobs: python -m pip install "Sphinx @ git+https://github.com/sphinx-doc/sphinx" - name: Test with pytest - run: python -m pytest --durations 25 + run: python -m pytest -vv --durations 25 lint: runs-on: ubuntu-latest From 4ba0bbc9cd166a2512d7e3a502fa8159f3669685 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+aa-turner@users.noreply.github.com> Date: Wed, 9 Aug 2023 17:16:32 +0100 Subject: [PATCH 21/38] Restore support in tests for ``Sphinx<7.2`` --- tests/conftest.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/conftest.py b/tests/conftest.py index bad18f1..d4b08e5 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -2,9 +2,16 @@ import pytest +import sphinx + pytest_plugins = 'sphinx.testing.fixtures' @pytest.fixture(scope='session') def rootdir(): + if sphinx.version_info[:2] < (7, 2): + from sphinx.testing.path import path + + return path(__file__).parent.abspath() / 'roots' + return Path(__file__).resolve().parent / 'roots' From 957d087692515b6cdd918ebd0c99591b7d04f76f Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+aa-turner@users.noreply.github.com> Date: Wed, 9 Aug 2023 20:11:29 +0100 Subject: [PATCH 22/38] Bump to 1.1.7 final --- CHANGES | 5 +++++ sphinxcontrib/serializinghtml/__init__.py | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index 0c534dc..405ed78 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,8 @@ +Release 1.1.7 (2023-08-09) +========================== + +* Fix tests for Sphinx 7.1 and below + Release 1.1.6 (2023-08-07) ========================== diff --git a/sphinxcontrib/serializinghtml/__init__.py b/sphinxcontrib/serializinghtml/__init__.py index 6f2c8b8..6a0b54e 100644 --- a/sphinxcontrib/serializinghtml/__init__.py +++ b/sphinxcontrib/serializinghtml/__init__.py @@ -13,8 +13,8 @@ from sphinxcontrib.serializinghtml import jsonimpl -__version__ = '1.1.6' -__version_info__ = (1, 1, 6) +__version__ = '1.1.7' +__version_info__ = (1, 1, 7) package_dir = path.abspath(path.dirname(__file__)) From b3ed89b4b2bf9eee553ff2272ae97fc5c0a9bc31 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+aa-turner@users.noreply.github.com> Date: Mon, 14 Aug 2023 16:42:11 +0100 Subject: [PATCH 23/38] Use ``os.PathLike`` over ``pathlib.Path`` Sphinx 7.1 and earlier don't use ``pathlib`` internally. --- sphinxcontrib/serializinghtml/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sphinxcontrib/serializinghtml/__init__.py b/sphinxcontrib/serializinghtml/__init__.py index 6a0b54e..26a5386 100644 --- a/sphinxcontrib/serializinghtml/__init__.py +++ b/sphinxcontrib/serializinghtml/__init__.py @@ -102,7 +102,7 @@ def handle_page(self, pagename: str, ctx: dict, templatename: str = 'page.html', def handle_finish(self) -> None: # dump the global context - outfilename = self.outdir / self.globalcontext_filename + outfilename = path.join(self.outdir, self.globalcontext_filename) self.dump_context(self.globalcontext, outfilename) # super here to dump the search index From fde139af6b2bfad8a6b8d20886b657a174f05c22 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+aa-turner@users.noreply.github.com> Date: Mon, 14 Aug 2023 17:09:41 +0100 Subject: [PATCH 24/38] Bump to 1.1.8 final --- CHANGES | 5 +++++ sphinxcontrib/serializinghtml/__init__.py | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index 405ed78..812c0fc 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,8 @@ +Release 1.1.8 (2023-08-14) +========================== + +* Use ``os.PathLike`` over ``pathlib.Path`` + Release 1.1.7 (2023-08-09) ========================== diff --git a/sphinxcontrib/serializinghtml/__init__.py b/sphinxcontrib/serializinghtml/__init__.py index 26a5386..99b6fb9 100644 --- a/sphinxcontrib/serializinghtml/__init__.py +++ b/sphinxcontrib/serializinghtml/__init__.py @@ -13,8 +13,8 @@ from sphinxcontrib.serializinghtml import jsonimpl -__version__ = '1.1.7' -__version_info__ = (1, 1, 7) +__version__ = '1.1.8' +__version_info__ = (1, 1, 8) package_dir = path.abspath(path.dirname(__file__)) From 5c62ad4219698d410426e99495203e9484d77f29 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+aa-turner@users.noreply.github.com> Date: Mon, 21 Aug 2023 00:20:10 +0100 Subject: [PATCH 25/38] Properly serialise css_files and script_files --- sphinxcontrib/serializinghtml/__init__.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sphinxcontrib/serializinghtml/__init__.py b/sphinxcontrib/serializinghtml/__init__.py index 99b6fb9..22836e8 100644 --- a/sphinxcontrib/serializinghtml/__init__.py +++ b/sphinxcontrib/serializinghtml/__init__.py @@ -63,6 +63,11 @@ def get_target_uri(self, docname: str, typ: str | None = None) -> str: return docname + SEP def dump_context(self, context: dict, filename: str | os.PathLike[str]) -> None: + context = context.copy() + if 'css_files' in context: + context['css_files'] = [css.filename for css in context['css_files']] + if 'script_files' in context: + context['script_files'] = [js.filename for js in context['script_files']] if self.implementation_dumps_unicode: with open(filename, 'w', encoding='utf-8') as ft: self.implementation.dump(context, ft, *self.additional_dump_args) From ff4bcae545fb6e5b923cc51cc37944c18307a49a Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+aa-turner@users.noreply.github.com> Date: Mon, 21 Aug 2023 00:26:37 +0100 Subject: [PATCH 26/38] Bump to 1.1.9 final --- CHANGES | 6 ++++++ sphinxcontrib/serializinghtml/__init__.py | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index 812c0fc..c91fed7 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,9 @@ +Release 1.1.9 (2023-08-20) +========================== + +* Serialise context["script_files"] and context["css_files"] as their filenames + on Sphinx 7.2.0. + Release 1.1.8 (2023-08-14) ========================== diff --git a/sphinxcontrib/serializinghtml/__init__.py b/sphinxcontrib/serializinghtml/__init__.py index 22836e8..8940d80 100644 --- a/sphinxcontrib/serializinghtml/__init__.py +++ b/sphinxcontrib/serializinghtml/__init__.py @@ -13,8 +13,8 @@ from sphinxcontrib.serializinghtml import jsonimpl -__version__ = '1.1.8' -__version_info__ = (1, 1, 8) +__version__ = '1.1.9' +__version_info__ = (1, 1, 9) package_dir = path.abspath(path.dirname(__file__)) From f0b76043a49e8969be1f0bfed7ad5636d7361e3c Mon Sep 17 00:00:00 2001 From: phlax Date: Sat, 13 Jan 2024 02:35:03 +0000 Subject: [PATCH 27/38] Remove Sphinx as a required dependency (#10) Signed-off-by: Ryan Northey Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com> --- .github/workflows/test.yml | 2 +- CHANGES | 7 +++++++ pyproject.toml | 7 ++++--- sphinxcontrib/serializinghtml/__init__.py | 1 + 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 794d170..8cd7db1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -44,7 +44,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - python -m pip install .[test] + python -m pip install .[test,standalone] - name: Test with pytest run: python -m pytest -vv --durations 25 diff --git a/CHANGES b/CHANGES index c91fed7..48c08f4 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,10 @@ +Release 1.1.10 (unreleased) +=========================== + +* Remove Sphinx as a required dependency, as circular dependencies may cause + failure with package managers that expect a directed acyclic graph (DAG) + of dependencies. + Release 1.1.9 (2023-08-20) ========================== diff --git a/pyproject.toml b/pyproject.toml index 8c39008..7f88862 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -40,9 +40,7 @@ classifiers = [ "Topic :: Text Processing", "Topic :: Utilities", ] -dependencies = [ - "Sphinx>=5", -] +dependencies = [] dynamic = ["version"] [project.optional-dependencies] @@ -54,6 +52,9 @@ lint = [ "mypy", "docutils-stubs", ] +standalone = [ + "Sphinx>=5", +] [[project.authors]] name = "Georg Brandl" diff --git a/sphinxcontrib/serializinghtml/__init__.py b/sphinxcontrib/serializinghtml/__init__.py index 8940d80..815705c 100644 --- a/sphinxcontrib/serializinghtml/__init__.py +++ b/sphinxcontrib/serializinghtml/__init__.py @@ -157,6 +157,7 @@ class JSONHTMLBuilder(SerializingHTMLBuilder): def setup(app: Sphinx) -> dict[str, Any]: + app.require_sphinx('5.0') app.setup_extension('sphinx.builders.html') app.add_builder(JSONHTMLBuilder) app.add_builder(PickleHTMLBuilder) From 941e0e81da47efad9509cc7df3eff44f40de43c2 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+aa-turner@users.noreply.github.com> Date: Sat, 13 Jan 2024 02:48:14 +0000 Subject: [PATCH 28/38] Bump to 1.0.10 final --- CHANGES | 2 +- sphinxcontrib/serializinghtml/__init__.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGES b/CHANGES index 48c08f4..98dbc74 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,4 @@ -Release 1.1.10 (unreleased) +Release 1.1.10 (2024-01-13) =========================== * Remove Sphinx as a required dependency, as circular dependencies may cause diff --git a/sphinxcontrib/serializinghtml/__init__.py b/sphinxcontrib/serializinghtml/__init__.py index 815705c..11301c4 100644 --- a/sphinxcontrib/serializinghtml/__init__.py +++ b/sphinxcontrib/serializinghtml/__init__.py @@ -13,8 +13,8 @@ from sphinxcontrib.serializinghtml import jsonimpl -__version__ = '1.1.9' -__version_info__ = (1, 1, 9) +__version__ = '1.1.10' +__version_info__ = (1, 1, 10) package_dir = path.abspath(path.dirname(__file__)) From 3161d4768bcf16f9c372fb733b70399131824cc8 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+aa-turner@users.noreply.github.com> Date: Sat, 27 Jul 2024 18:38:36 +0100 Subject: [PATCH 29/38] Update .gitignore --- .gitignore | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 6101a7b..10cef94 100644 --- a/.gitignore +++ b/.gitignore @@ -1,13 +1,17 @@ *.pyc -*.egg -*.so -*.swp .DS_Store +idea/ +.vscode/ + .mypy_cache/ +.pytest_cache/ +.ruff_cache/ .tags .tox/ +.venv/ +venv/ + build/ dist/ -sphinxcontrib_serializinghtml.egg-info/ From c7a1ca2154a17d8350186bb5ac384c613471e4ee Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+aa-turner@users.noreply.github.com> Date: Sun, 28 Jul 2024 05:02:26 +0100 Subject: [PATCH 30/38] Adopt Ruff and use stricter MyPy settings --- .flake8 | 4 -- .github/workflows/test.yml | 4 +- .ruff.toml | 53 +++++++++++++++++++++++ Makefile | 2 +- pyproject.toml | 36 +++++++++++++-- sphinxcontrib/serializinghtml/__init__.py | 24 +++++++--- sphinxcontrib/serializinghtml/jsonimpl.py | 6 +-- sphinxcontrib/serializinghtml/py.typed | 0 tests/conftest.py | 15 +++---- tests/test_serializinghtml.py | 11 ++++- tox.ini | 6 +-- 11 files changed, 128 insertions(+), 33 deletions(-) delete mode 100644 .flake8 create mode 100644 .ruff.toml create mode 100644 sphinxcontrib/serializinghtml/py.typed diff --git a/.flake8 b/.flake8 deleted file mode 100644 index 5af0a95..0000000 --- a/.flake8 +++ /dev/null @@ -1,4 +0,0 @@ -[flake8] -max-line-length = 95 -ignore = E116,E241,E251 -exclude = .git,.tox,.venv diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8cd7db1..856df5b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -71,7 +71,9 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - env: [flake8, mypy] + env: + - ruff + - mypy steps: - uses: actions/checkout@v3 diff --git a/.ruff.toml b/.ruff.toml new file mode 100644 index 0000000..4b7dd2a --- /dev/null +++ b/.ruff.toml @@ -0,0 +1,53 @@ +target-version = "py39" # Pin Ruff to Python 3.9 +output-format = "full" +line-length = 95 + +[lint] +preview = true +select = [ +# "ANN", # flake8-annotations + "C4", # flake8-comprehensions + "COM", # flake8-commas + "B", # flake8-bugbear + "DTZ", # flake8-datetimez + "E", # pycodestyle + "EM", # flake8-errmsg + "EXE", # flake8-executable + "F", # pyflakes + "FA", # flake8-future-annotations + "FLY", # flynt + "FURB", # refurb + "G", # flake8-logging-format + "I", # isort + "ICN", # flake8-import-conventions + "INT", # flake8-gettext + "LOG", # flake8-logging + "PERF", # perflint + "PGH", # pygrep-hooks + "PIE", # flake8-pie + "PT", # flake8-pytest-style + "SIM", # flake8-simplify + "SLOT", # flake8-slots + "TCH", # flake8-type-checking + "UP", # pyupgrade + "W", # pycodestyle + "YTT", # flake8-2020 +] +ignore = [ + "E116", + "E241", + "E251", +] + +[lint.per-file-ignores] +"tests/*" = [ + "ANN", # tests don't need annotations +] + +[lint.isort] +forced-separate = [ + "tests", +] +required-imports = [ + "from __future__ import annotations", +] diff --git a/Makefile b/Makefile index 26f411a..438ee54 100644 --- a/Makefile +++ b/Makefile @@ -47,7 +47,7 @@ clean-mypyfiles: .PHONY: style-check style-check: - @flake8 + @ruff check .PHONY: type-check type-check: diff --git a/pyproject.toml b/pyproject.toml index 7f88862..27d3008 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -48,9 +48,9 @@ test = [ "pytest", ] lint = [ - "flake8", + "ruff==0.5.5", "mypy", - "docutils-stubs", + "types-docutils", ] standalone = [ "Sphinx>=5", @@ -76,4 +76,34 @@ exclude = [ ] [tool.mypy] -ignore_missing_imports = true +python_version = "3.9" +packages = [ + "sphinxcontrib", + "tests", +] +exclude = [ + "tests/roots", +] +check_untyped_defs = true +disallow_any_generics = true +disallow_incomplete_defs = true +disallow_subclassing_any = true +disallow_untyped_calls = true +disallow_untyped_decorators = true +disallow_untyped_defs = true +explicit_package_bases = true +extra_checks = true +no_implicit_reexport = true +show_column_numbers = true +show_error_context = true +strict_optional = true +warn_redundant_casts = true +warn_unused_configs = true +warn_unused_ignores = true +enable_error_code = [ + "type-arg", + "redundant-self", + "truthy-iterable", + "ignore-without-code", + "unused-awaitable", +] diff --git a/sphinxcontrib/serializinghtml/__init__.py b/sphinxcontrib/serializinghtml/__init__.py index 11301c4..ee41019 100644 --- a/sphinxcontrib/serializinghtml/__init__.py +++ b/sphinxcontrib/serializinghtml/__init__.py @@ -4,7 +4,7 @@ import pickle import types from os import path -from typing import Any +from typing import TYPE_CHECKING from sphinx.application import ENV_PICKLE_FILENAME, Sphinx from sphinx.builders.html import BuildInfo, StandaloneHTMLBuilder @@ -13,6 +13,16 @@ from sphinxcontrib.serializinghtml import jsonimpl +if TYPE_CHECKING: + from collections.abc import Sequence + from typing import Any, Protocol + + class SerialisingImplementation(Protocol): + def dump(self, obj: Any, file: Any, *args: Any, **kwargs: Any) -> None: ... + def dumps(self, obj: Any, *args: Any, **kwargs: Any) -> str | bytes: ... + def load(self, file: Any, *args: Any, **kwargs: Any) -> Any: ... + def loads(self, data: Any, *args: Any, **kwargs: Any) -> Any: ... + __version__ = '1.1.10' __version_info__ = (1, 1, 10) @@ -31,11 +41,11 @@ class SerializingHTMLBuilder(StandaloneHTMLBuilder): """ #: the serializing implementation to use. Set this to a module that #: implements a `dump`, `load`, `dumps` and `loads` functions - #: (pickle, simplejson etc.) - implementation: Any = None + #: (pickle, json etc.) + implementation: SerialisingImplementation implementation_dumps_unicode = False #: additional arguments for dump() - additional_dump_args: tuple = () + additional_dump_args: Sequence[Any] = () #: the filename for the global context file globalcontext_filename: str = '' @@ -62,7 +72,7 @@ def get_target_uri(self, docname: str, typ: str | None = None) -> str: return docname[:-5] # up to sep return docname + SEP - def dump_context(self, context: dict, filename: str | os.PathLike[str]) -> None: + def dump_context(self, context: dict[str, Any], filename: str | os.PathLike[str]) -> None: context = context.copy() if 'css_files' in context: context['css_files'] = [css.filename for css in context['css_files']] @@ -75,7 +85,7 @@ def dump_context(self, context: dict, filename: str | os.PathLike[str]) -> None: with open(filename, 'wb') as fb: self.implementation.dump(context, fb, *self.additional_dump_args) - def handle_page(self, pagename: str, ctx: dict, templatename: str = 'page.html', + def handle_page(self, pagename: str, ctx: dict[str, Any], templatename: str = 'page.html', outfilename: str | None = None, event_arg: Any = None) -> None: ctx['current_page_name'] = pagename ctx.setdefault('pathto', lambda p: p) @@ -132,7 +142,7 @@ class PickleHTMLBuilder(SerializingHTMLBuilder): implementation = pickle implementation_dumps_unicode = False - additional_dump_args = (pickle.HIGHEST_PROTOCOL,) + additional_dump_args: tuple[Any] = (pickle.HIGHEST_PROTOCOL,) indexer_format = pickle indexer_dumps_unicode = False out_suffix = '.fpickle' diff --git a/sphinxcontrib/serializinghtml/jsonimpl.py b/sphinxcontrib/serializinghtml/jsonimpl.py index e80c047..9b89875 100644 --- a/sphinxcontrib/serializinghtml/jsonimpl.py +++ b/sphinxcontrib/serializinghtml/jsonimpl.py @@ -4,7 +4,7 @@ import json from collections import UserString -from typing import Any, IO +from typing import IO, Any class SphinxJSONEncoder(json.JSONEncoder): @@ -15,9 +15,9 @@ def default(self, obj: Any) -> str: return super().default(obj) -def dump(obj: Any, fp: IO, *args: Any, **kwds: Any) -> None: +def dump(obj: Any, file: IO[str] | IO[bytes], *args: Any, **kwds: Any) -> None: kwds['cls'] = SphinxJSONEncoder - json.dump(obj, fp, *args, **kwds) + json.dump(obj, file, *args, **kwds) def dumps(obj: Any, *args: Any, **kwds: Any) -> str: diff --git a/sphinxcontrib/serializinghtml/py.typed b/sphinxcontrib/serializinghtml/py.typed new file mode 100644 index 0000000..e69de29 diff --git a/tests/conftest.py b/tests/conftest.py index d4b08e5..3934d3f 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,17 +1,14 @@ +from __future__ import annotations + from pathlib import Path import pytest -import sphinx - -pytest_plugins = 'sphinx.testing.fixtures' +pytest_plugins = ( + 'sphinx.testing.fixtures', +) @pytest.fixture(scope='session') -def rootdir(): - if sphinx.version_info[:2] < (7, 2): - from sphinx.testing.path import path - - return path(__file__).parent.abspath() / 'roots' - +def rootdir() -> Path: return Path(__file__).resolve().parent / 'roots' diff --git a/tests/test_serializinghtml.py b/tests/test_serializinghtml.py index b6f6380..480930b 100644 --- a/tests/test_serializinghtml.py +++ b/tests/test_serializinghtml.py @@ -1,13 +1,20 @@ """Test for serializinghtml extension.""" +from __future__ import annotations + +from typing import TYPE_CHECKING + import pytest +if TYPE_CHECKING: + from sphinx.application import Sphinx + @pytest.mark.sphinx('json', testroot='basic') -def test_json(app, status, warning): +def test_json(app: Sphinx) -> None: app.builder.build_all() @pytest.mark.sphinx('pickle', testroot='basic') -def test_pickle(app, status, warning): +def test_pickle(app: Sphinx) -> None: app.builder.build_all() diff --git a/tox.ini b/tox.ini index 9ad9f73..233022d 100644 --- a/tox.ini +++ b/tox.ini @@ -2,7 +2,7 @@ minversion = 2.4.0 envlist = py{39,310,311,312,313}, - flake8, + ruff, mypy isolated_build = True @@ -18,14 +18,14 @@ setenv = commands= pytest --durations 25 {posargs} -[testenv:flake8] +[testenv:ruff] description = Run style checks. extras = test lint commands= - flake8 + ruff check [testenv:mypy] description = From f2d1ab5fdae23df21fe1db3fc0918d98c3b1bef5 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+aa-turner@users.noreply.github.com> Date: Sun, 28 Jul 2024 05:04:34 +0100 Subject: [PATCH 31/38] Enable GitHub's dependabot package update service --- .github/dependabot.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..47a31bc --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,10 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" + - package-ecosystem: "pip" + directory: "/" + schedule: + interval: "daily" From 3efe6adde58b86b772b35d62d561d2c3efa2a6f4 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+aa-turner@users.noreply.github.com> Date: Sun, 28 Jul 2024 05:13:51 +0100 Subject: [PATCH 32/38] Use the latest GitHub actions versions --- .github/workflows/create-release.yml | 12 ++++++------ .github/workflows/test.yml | 14 +++++++------- .github/{ => workflows}/transifex.yml | 10 +++++----- 3 files changed, 18 insertions(+), 18 deletions(-) rename .github/{ => workflows}/transifex.yml (92%) diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index 857607f..6d19bbb 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -17,9 +17,9 @@ jobs: permissions: id-token: write # for PyPI trusted publishing steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: 3 cache: pip @@ -35,7 +35,7 @@ jobs: - name: Mint PyPI API token id: mint-token - uses: actions/github-script@v6 + uses: actions/github-script@v7 with: # language=JavaScript script: | @@ -75,15 +75,15 @@ jobs: permissions: contents: write # for softprops/action-gh-release to create GitHub release steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Get release version id: get_version - uses: actions/github-script@v6 + uses: actions/github-script@v7 with: script: core.setOutput('version', context.ref.replace("refs/tags/", "")) - name: Create GitHub release - uses: softprops/action-gh-release@v1 + uses: softprops/action-gh-release@v2 if: startsWith(github.ref, 'refs/tags/') with: name: "sphinxcontrib-serializinghtml ${{ steps.get_version.outputs.version }}" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 856df5b..4586b92 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -30,14 +30,14 @@ jobs: fail-fast: false steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 if: "!endsWith(matrix.python, '-dev')" with: python-version: ${{ matrix.python }} - name: Set up Python ${{ matrix.python }} (deadsnakes) - uses: deadsnakes/action@v2.1.1 + uses: deadsnakes/action@v3.1.0 if: "endsWith(matrix.python, '-dev')" with: python-version: ${{ matrix.python }} @@ -53,9 +53,9 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: "3" - name: Install dependencies @@ -76,9 +76,9 @@ jobs: - mypy steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: "3" diff --git a/.github/transifex.yml b/.github/workflows/transifex.yml similarity index 92% rename from .github/transifex.yml rename to .github/workflows/transifex.yml index b0427ac..fbfba9a 100644 --- a/.github/transifex.yml +++ b/.github/workflows/transifex.yml @@ -15,9 +15,9 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: 3 - name: Install transifex client @@ -44,9 +44,9 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: 3 - name: Install transifex client @@ -67,7 +67,7 @@ jobs: - name: Compile message catalogs run: python utils/babel_runner.py compile - name: Create Pull Request - uses: peter-evans/create-pull-request@v4 + uses: peter-evans/create-pull-request@v6 with: commit-message: "[internationalisation] Update translations" branch: bot/pull-translations From 5762a0e58de31f71744e97f1b82c02d64e2cc14f Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+aa-turner@users.noreply.github.com> Date: Sun, 28 Jul 2024 18:31:09 +0100 Subject: [PATCH 33/38] Run mypy without command-line options --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 233022d..3198abf 100644 --- a/tox.ini +++ b/tox.ini @@ -34,4 +34,4 @@ extras = test lint commands= - mypy sphinxcontrib/ --explicit-package-bases + mypy From 85cbe329a7775c70631ca5a55f361e4d80bfb019 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+aa-turner@users.noreply.github.com> Date: Sun, 28 Jul 2024 18:38:15 +0100 Subject: [PATCH 34/38] Run CI with Python 3.12 releases --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4586b92..e337f0f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -25,7 +25,7 @@ jobs: - "3.9" - "3.10" - "3.11" - - "3.12-dev" + - "3.12" - "3.13-dev" fail-fast: false @@ -44,7 +44,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - python -m pip install .[test,standalone] + python -m pip install .[standalone,test] - name: Test with pytest run: python -m pytest -vv --durations 25 From 4806eec58dc8868888b36486b8493cb3a2682a26 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+aa-turner@users.noreply.github.com> Date: Sun, 28 Jul 2024 18:48:20 +0100 Subject: [PATCH 35/38] Rename CHANGES to CHANGES.rst --- CHANGES => CHANGES.rst | 0 pyproject.toml | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename CHANGES => CHANGES.rst (100%) diff --git a/CHANGES b/CHANGES.rst similarity index 100% rename from CHANGES rename to CHANGES.rst diff --git a/pyproject.toml b/pyproject.toml index 27d3008..bbc7b49 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -65,7 +65,7 @@ name = "sphinxcontrib.serializinghtml" [tool.flit.sdist] include = [ - "CHANGES", + "CHANGES.rst", "LICENSE", # Tests "tests/", From a3d1b70c68edbad003a4f4156dde49f314c505b3 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+aa-turner@users.noreply.github.com> Date: Sun, 28 Jul 2024 19:00:41 +0100 Subject: [PATCH 36/38] Rename LICENSE to LICENCE.rst --- LICENSE => LICENCE.rst | 0 pyproject.toml | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename LICENSE => LICENCE.rst (100%) diff --git a/LICENSE b/LICENCE.rst similarity index 100% rename from LICENSE rename to LICENCE.rst diff --git a/pyproject.toml b/pyproject.toml index bbc7b49..e5f4447 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -66,7 +66,7 @@ name = "sphinxcontrib.serializinghtml" [tool.flit.sdist] include = [ "CHANGES.rst", - "LICENSE", + "LICENCE.rst", # Tests "tests/", "tox.ini", From b70697cd8825afe2f3a9ce9a8c207cc1b6037ee2 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+aa-turner@users.noreply.github.com> Date: Sun, 28 Jul 2024 19:32:58 +0100 Subject: [PATCH 37/38] Update CHANGES links --- .github/workflows/create-release.yml | 2 +- pyproject.toml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index 6d19bbb..fa90c2b 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -87,4 +87,4 @@ jobs: if: startsWith(github.ref, 'refs/tags/') with: name: "sphinxcontrib-serializinghtml ${{ steps.get_version.outputs.version }}" - body: "Changelog: https://www.sphinx-doc.org/en/master/changes.html" + body: "Changelog: https://github.com/sphinx-doc/sphinxcontrib-serializinghtml/blob/master/CHANGES.rst" diff --git a/pyproject.toml b/pyproject.toml index e5f4447..f14054e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,11 +8,11 @@ name = "sphinxcontrib-serializinghtml" description = """sphinxcontrib-serializinghtml is a sphinx extension which \ outputs "serialized" HTML files (json and pickle)""" readme = "README.rst" -urls.Changelog = "https://www.sphinx-doc.org/en/master/changes.html" -urls.Code = "https://github.com/sphinx-doc/sphinxcontrib-serializinghtml" +urls.Changelog = "https://github.com/sphinx-doc/sphinxcontrib-serializinghtml/blob/master/CHANGES.rst" +urls.Code = "https://github.com/sphinx-doc/sphinxcontrib-serializinghtml/" urls.Download = "https://pypi.org/project/sphinxcontrib-serializinghtml/" urls.Homepage = "https://www.sphinx-doc.org/" -urls."Issue tracker" = "https://github.com/sphinx-doc/sphinx/issues" +urls."Issue tracker" = "https://github.com/sphinx-doc/sphinx/issues/" license.text = "BSD-2-Clause" requires-python = ">=3.9" From f0f3b15b2e6bb47570d605ebd5687643d7a85b9d Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+aa-turner@users.noreply.github.com> Date: Mon, 29 Jul 2024 01:52:17 +0100 Subject: [PATCH 38/38] Bump to 2.0.0 --- CHANGES.rst | 7 +++++++ sphinxcontrib/serializinghtml/__init__.py | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 98dbc74..6425c1e 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,10 @@ +Release 2.0.0 (2024-07-28) +========================== + +* Adopt Ruff +* Tighten MyPy settings +* Update GitHub actions versions + Release 1.1.10 (2024-01-13) =========================== diff --git a/sphinxcontrib/serializinghtml/__init__.py b/sphinxcontrib/serializinghtml/__init__.py index ee41019..bdbeb6f 100644 --- a/sphinxcontrib/serializinghtml/__init__.py +++ b/sphinxcontrib/serializinghtml/__init__.py @@ -23,8 +23,8 @@ def dumps(self, obj: Any, *args: Any, **kwargs: Any) -> str | bytes: ... def load(self, file: Any, *args: Any, **kwargs: Any) -> Any: ... def loads(self, data: Any, *args: Any, **kwargs: Any) -> Any: ... -__version__ = '1.1.10' -__version_info__ = (1, 1, 10) +__version__ = '2.0.0' +__version_info__ = (2, 0, 0) package_dir = path.abspath(path.dirname(__file__)) pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy