From fe363d2e60357f726f3fb0da249740b690db6d55 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 21 Aug 2023 23:10:11 +0000 Subject: [PATCH 01/15] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/pre-commit/mirrors-prettier: v3.0.0 → v3.0.2](https://github.com/pre-commit/mirrors-prettier/compare/v3.0.0...v3.0.2) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d032cbd..0652788 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -18,6 +18,6 @@ repos: hooks: - id: isort - repo: https://github.com/pre-commit/mirrors-prettier - rev: "v3.0.0" + rev: "v3.0.2" hooks: - id: prettier From b0cdd40483be9b6f81963728df6f32c83816a066 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 4 Sep 2023 19:11:02 +0000 Subject: [PATCH 02/15] Bump actions/checkout from 3 to 4 Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 04c4ac6..3a81d8a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,7 +17,7 @@ jobs: pre-commit: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/setup-python@v4 with: python-version: "3.x" @@ -28,7 +28,7 @@ jobs: outputs: noxenvs: ${{ steps.noxenvs-matrix.outputs.noxenvs }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up nox uses: wntrblm/nox@2023.04.22 - id: noxenvs-matrix @@ -47,7 +47,7 @@ jobs: noxenv: ${{ fromJson(needs.list.outputs.noxenvs) }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install dependencies run: > sudo apt-get update && @@ -83,7 +83,7 @@ jobs: id-token: write steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v4 with: From 8f38bba9100b1c73c6c6533332e02aefdf3e6eb8 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 4 Sep 2023 23:17:02 +0000 Subject: [PATCH 03/15] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/pre-commit/mirrors-prettier: v3.0.2 → v3.0.3](https://github.com/pre-commit/mirrors-prettier/compare/v3.0.2...v3.0.3) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0652788..c06d366 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -18,6 +18,6 @@ repos: hooks: - id: isort - repo: https://github.com/pre-commit/mirrors-prettier - rev: "v3.0.2" + rev: "v3.0.3" hooks: - id: prettier From cd5f76af9c9ba9c387bd01917f37ff1666d04d23 Mon Sep 17 00:00:00 2001 From: Julian Berman Date: Wed, 20 Sep 2023 09:40:08 -0400 Subject: [PATCH 04/15] Update the readthedocs config. --- .readthedocs.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.readthedocs.yml b/.readthedocs.yml index f78bde4..e6ab173 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -1,5 +1,10 @@ version: 2 +build: + os: ubuntu-22.04 + tools: + python: "3.11" + sphinx: builder: dirhtml configuration: docs/conf.py @@ -8,8 +13,5 @@ sphinx: formats: all python: - version: "3.8" install: - requirements: docs/requirements.txt - - method: pip - path: . From 49dafc9bf1110b0be3ccf33a6d1e78d16762f6cb Mon Sep 17 00:00:00 2001 From: Julian Berman Date: Wed, 20 Sep 2023 09:42:33 -0400 Subject: [PATCH 05/15] Update requirements. --- docs/requirements.txt | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/docs/requirements.txt b/docs/requirements.txt index 5db1537..1fb35b7 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -2,7 +2,7 @@ # This file is autogenerated by pip-compile with Python 3.11 # by the following command: # -# pip-compile --config=pyproject.toml docs/requirements.in +# pip-compile docs/requirements.in # alabaster==0.7.13 # via sphinx @@ -14,15 +14,15 @@ certifi==2023.7.22 # via requests charset-normalizer==3.2.0 # via requests -contourpy==1.1.0 +contourpy==1.1.1 # via matplotlib cycler==0.11.0 # via matplotlib docutils==0.20.1 # via sphinx -fonttools==4.41.1 +fonttools==4.42.1 # via matplotlib -furo==2023.7.26 +furo==2023.9.10 # via -r docs/requirements.in idna==3.4 # via requests @@ -30,15 +30,15 @@ imagesize==1.4.1 # via sphinx jinja2==3.1.2 # via sphinx -kiwisolver==1.4.4 +kiwisolver==1.4.5 # via matplotlib lxml==4.9.3 # via sphinx-json-schema-spec markupsafe==2.1.3 # via jinja2 -matplotlib==3.7.2 +matplotlib==3.8.0 # via sphinxext-opengraph -numpy==1.25.2 +numpy==1.26.0 # via # contourpy # matplotlib @@ -46,15 +46,15 @@ packaging==23.1 # via # matplotlib # sphinx -pillow==10.0.0 +pillow==10.0.1 # via matplotlib pyenchant==3.2.2 # via sphinxcontrib-spelling -pygments==2.15.1 +pygments==2.16.1 # via # furo # sphinx -pyparsing==3.0.9 +pyparsing==3.1.1 # via matplotlib python-dateutil==2.8.2 # via matplotlib @@ -64,35 +64,40 @@ six==1.16.0 # via python-dateutil snowballstemmer==2.2.0 # via sphinx -soupsieve==2.4.1 +soupsieve==2.5 # via beautifulsoup4 -sphinx==7.1.2 +sphinx==7.2.6 # via # -r docs/requirements.in # furo # sphinx-basic-ng # sphinx-json-schema-spec + # sphinxcontrib-applehelp + # sphinxcontrib-devhelp + # sphinxcontrib-htmlhelp + # sphinxcontrib-qthelp + # sphinxcontrib-serializinghtml # sphinxcontrib-spelling # sphinxext-opengraph sphinx-basic-ng==1.0.0b2 # via furo file:.#egg=sphinx_json_schema_spec # via -r docs/requirements.in -sphinxcontrib-applehelp==1.0.4 +sphinxcontrib-applehelp==1.0.7 # via sphinx -sphinxcontrib-devhelp==1.0.2 +sphinxcontrib-devhelp==1.0.5 # via sphinx -sphinxcontrib-htmlhelp==2.0.1 +sphinxcontrib-htmlhelp==2.0.4 # via sphinx sphinxcontrib-jsmath==1.0.1 # via sphinx -sphinxcontrib-qthelp==1.0.3 +sphinxcontrib-qthelp==1.0.6 # via sphinx -sphinxcontrib-serializinghtml==1.1.5 +sphinxcontrib-serializinghtml==1.1.9 # via sphinx sphinxcontrib-spelling==8.0.0 # via -r docs/requirements.in sphinxext-opengraph==0.8.2 # via -r docs/requirements.in -urllib3==2.0.4 +urllib3==2.0.5 # via requests From b37d91d12d3f5e3c12710605d76bfaaf1e553e19 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 9 Oct 2023 18:29:04 +0000 Subject: [PATCH 06/15] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/pre-commit/pre-commit-hooks: v4.4.0 → v4.5.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.4.0...v4.5.0) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c06d366..b17c29b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: v4.5.0 hooks: - id: check-ast - id: check-docstring-first From 8576e5239f1425d9f82af9220f9d7c93c2472db3 Mon Sep 17 00:00:00 2001 From: Julian Berman Date: Mon, 30 Oct 2023 08:57:59 -0400 Subject: [PATCH 07/15] Update docs requirements. --- docs/requirements.txt | 36 ++++++------------------------------ 1 file changed, 6 insertions(+), 30 deletions(-) diff --git a/docs/requirements.txt b/docs/requirements.txt index 1fb35b7..fcc4f2d 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -6,22 +6,16 @@ # alabaster==0.7.13 # via sphinx -babel==2.12.1 +babel==2.13.1 # via sphinx beautifulsoup4==4.12.2 # via furo certifi==2023.7.22 # via requests -charset-normalizer==3.2.0 +charset-normalizer==3.3.1 # via requests -contourpy==1.1.1 - # via matplotlib -cycler==0.11.0 - # via matplotlib docutils==0.20.1 # via sphinx -fonttools==4.42.1 - # via matplotlib furo==2023.9.10 # via -r docs/requirements.in idna==3.4 @@ -30,38 +24,20 @@ imagesize==1.4.1 # via sphinx jinja2==3.1.2 # via sphinx -kiwisolver==1.4.5 - # via matplotlib lxml==4.9.3 # via sphinx-json-schema-spec markupsafe==2.1.3 # via jinja2 -matplotlib==3.8.0 - # via sphinxext-opengraph -numpy==1.26.0 - # via - # contourpy - # matplotlib -packaging==23.1 - # via - # matplotlib - # sphinx -pillow==10.0.1 - # via matplotlib +packaging==23.2 + # via sphinx pyenchant==3.2.2 # via sphinxcontrib-spelling pygments==2.16.1 # via # furo # sphinx -pyparsing==3.1.1 - # via matplotlib -python-dateutil==2.8.2 - # via matplotlib requests==2.31.0 # via sphinx -six==1.16.0 - # via python-dateutil snowballstemmer==2.2.0 # via sphinx soupsieve==2.5 @@ -97,7 +73,7 @@ sphinxcontrib-serializinghtml==1.1.9 # via sphinx sphinxcontrib-spelling==8.0.0 # via -r docs/requirements.in -sphinxext-opengraph==0.8.2 +sphinxext-opengraph==0.9.0 # via -r docs/requirements.in -urllib3==2.0.5 +urllib3==2.0.7 # via requests From ba03c04d48f4bf0bbd347b584d80383a4813e3a5 Mon Sep 17 00:00:00 2001 From: Julian Berman Date: Fri, 3 Nov 2023 10:53:26 -0400 Subject: [PATCH 08/15] Apparently this setting is now autodetected. Thanks mastodocs (https://mastodon.social/deck/@hynek/111347150437324121) --- pyproject.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 08dffbe..24ee867 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -60,7 +60,6 @@ multi_line_output = 3 [tool.ruff] line-length = 79 -target-version = "py38" select = ["B", "D", "E", "F", "Q", "UP", "W"] ignore = [ # raise SomeException(...) is fine. From 0e521c2bc9fabf0264ee5840a5d34cb4969aeaff Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 13 Nov 2023 18:29:58 +0000 Subject: [PATCH 09/15] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/pre-commit/mirrors-prettier: v3.0.3 → v3.1.0](https://github.com/pre-commit/mirrors-prettier/compare/v3.0.3...v3.1.0) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b17c29b..2a13248 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -18,6 +18,6 @@ repos: hooks: - id: isort - repo: https://github.com/pre-commit/mirrors-prettier - rev: "v3.0.3" + rev: "v3.1.0" hooks: - id: prettier From 6f56b61abd8cafd8b73226c3ce37018af62f7bc4 Mon Sep 17 00:00:00 2001 From: Julian Berman Date: Thu, 7 Dec 2023 14:27:08 -0500 Subject: [PATCH 10/15] Update pre-commit hooks. --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2a13248..a355508 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -18,6 +18,6 @@ repos: hooks: - id: isort - repo: https://github.com/pre-commit/mirrors-prettier - rev: "v3.1.0" + rev: "v4.0.0-alpha.3-1" hooks: - id: prettier From ca97f152bd760478526ec6a0694f96ba40d1e840 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 11 Dec 2023 18:27:49 +0000 Subject: [PATCH 11/15] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/PyCQA/isort: 5.12.0 → 5.13.0](https://github.com/PyCQA/isort/compare/5.12.0...5.13.0) - [github.com/pre-commit/mirrors-prettier: v4.0.0-alpha.3-1 → v4.0.0-alpha.4](https://github.com/pre-commit/mirrors-prettier/compare/v4.0.0-alpha.3-1...v4.0.0-alpha.4) --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a355508..f55a6e3 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -14,10 +14,10 @@ repos: args: [--fix, lf] - id: trailing-whitespace - repo: https://github.com/PyCQA/isort - rev: 5.12.0 + rev: 5.13.0 hooks: - id: isort - repo: https://github.com/pre-commit/mirrors-prettier - rev: "v4.0.0-alpha.3-1" + rev: "v4.0.0-alpha.4" hooks: - id: prettier From 8e942f3947fe037f8766ed66b1338c8cef5a5695 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Dec 2023 19:14:03 +0000 Subject: [PATCH 12/15] Bump actions/setup-python from 4 to 5 Bumps [actions/setup-python](https://github.com/actions/setup-python) from 4 to 5. - [Release notes](https://github.com/actions/setup-python/releases) - [Commits](https://github.com/actions/setup-python/compare/v4...v5) --- updated-dependencies: - dependency-name: actions/setup-python dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3a81d8a..750e1bb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,7 +18,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 with: python-version: "3.x" - uses: pre-commit/action@v3.0.0 @@ -57,7 +57,7 @@ jobs: run: brew install enchant if: runner.os == 'macOS' && startsWith(matrix.noxenv, 'docs') - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: | 3.8 @@ -85,7 +85,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: "3.x" - name: Install dependencies From a31057b96d0392a6da581c607e40e534df9ce9d0 Mon Sep 17 00:00:00 2001 From: Julian Berman Date: Fri, 5 Jan 2024 13:40:06 -0500 Subject: [PATCH 13/15] Fix the fromutctimestamp warning on 3.12. Drop old versions, as generally we build docs using a recent version. --- noxfile.py | 2 +- pyproject.toml | 5 +---- sphinx_json_schema_spec/__init__.py | 10 +++------- 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/noxfile.py b/noxfile.py index b8faca4..a7961d1 100644 --- a/noxfile.py +++ b/noxfile.py @@ -21,7 +21,7 @@ def _session(fn): return _session -@session(python=["3.8", "3.9", "3.10", "3.11", "3.12", "pypy3"]) +@session(python=["3.11", "3.12"]) def tests(session): session.install("pytest", ROOT) session.run("pytest", *session.posargs, PACKAGE) diff --git a/pyproject.toml b/pyproject.toml index 24ee867..de820b4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,7 +10,7 @@ name = "sphinx_json_schema_spec" description = "Sphinx support for the JSON Schema specifications" readme = "README.rst" license = {text = "MIT"} -requires-python = ">=3.8" +requires-python = ">=3.11" keywords = ["json schema", "jsonschema", "data validation", "sphinx", "json"] authors = [ {email = "Julian+sphinx-json-schema-spec@GrayVines.com"}, @@ -22,9 +22,6 @@ classifiers = [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", - "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 :: Implementation :: CPython", diff --git a/sphinx_json_schema_spec/__init__.py b/sphinx_json_schema_spec/__init__.py index fa7acf7..fe4bcd9 100644 --- a/sphinx_json_schema_spec/__init__.py +++ b/sphinx_json_schema_spec/__init__.py @@ -2,17 +2,13 @@ Sphinx support for interlinking to the JSON Schema specifications. """ from contextlib import suppress -from datetime import datetime +from datetime import UTC, datetime +from importlib import metadata from pathlib import Path from urllib.parse import urljoin import ssl import urllib.request -try: - from importlib import metadata -except ImportError: - import importlib_metadata as metadata # type: ignore - from docutils import nodes from lxml import html @@ -76,7 +72,7 @@ def fetch_or_load(cache_path, url): headers = {"User-Agent": f"sphinx-json-schema-spec v{version}"} with suppress(FileNotFoundError): - modified = datetime.utcfromtimestamp(cache_path.stat().st_mtime) + modified = datetime.fromtimestamp(cache_path.stat().st_mtime, UTC) date = modified.strftime("%a, %d %b %Y %I:%M:%S UTC") headers["If-Modified-Since"] = date From 29e2270b8dd01160285991c0526ac9fa04445ede Mon Sep 17 00:00:00 2001 From: Julian Berman Date: Fri, 5 Jan 2024 13:44:45 -0500 Subject: [PATCH 14/15] Update requirements. --- docs/requirements.txt | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/docs/requirements.txt b/docs/requirements.txt index fcc4f2d..78120b6 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,30 +1,30 @@ # -# This file is autogenerated by pip-compile with Python 3.11 +# This file is autogenerated by pip-compile with Python 3.12 # by the following command: # -# pip-compile docs/requirements.in +# pip-compile --strip-extras docs/requirements.in # alabaster==0.7.13 # via sphinx -babel==2.13.1 +babel==2.14.0 # via sphinx beautifulsoup4==4.12.2 # via furo -certifi==2023.7.22 +certifi==2023.11.17 # via requests -charset-normalizer==3.3.1 +charset-normalizer==3.3.2 # via requests docutils==0.20.1 # via sphinx furo==2023.9.10 # via -r docs/requirements.in -idna==3.4 +idna==3.6 # via requests imagesize==1.4.1 # via sphinx jinja2==3.1.2 # via sphinx -lxml==4.9.3 +lxml==5.0.0 # via sphinx-json-schema-spec markupsafe==2.1.3 # via jinja2 @@ -32,7 +32,7 @@ packaging==23.2 # via sphinx pyenchant==3.2.2 # via sphinxcontrib-spelling -pygments==2.16.1 +pygments==2.17.2 # via # furo # sphinx @@ -73,7 +73,7 @@ sphinxcontrib-serializinghtml==1.1.9 # via sphinx sphinxcontrib-spelling==8.0.0 # via -r docs/requirements.in -sphinxext-opengraph==0.9.0 +sphinxext-opengraph==0.9.1 # via -r docs/requirements.in -urllib3==2.0.7 +urllib3==2.1.0 # via requests From 3d778d65a43dca5746cc702ed7e39774fa2617ff Mon Sep 17 00:00:00 2001 From: Julian Berman Date: Fri, 5 Jan 2024 13:51:56 -0500 Subject: [PATCH 15/15] Enable the rest of the ruff rulesets. --- docs/conf.py | 2 +- noxfile.py | 44 +++++++++++++-- pyproject.toml | 85 ++++++++++++++++++++--------- sphinx_json_schema_spec/__init__.py | 6 +- 4 files changed, 101 insertions(+), 36 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 9c744b1..ba105a0 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -37,7 +37,7 @@ def entire_domain(host): linkcheck_ignore = [ entire_domain("img.shields.io"), "https://github.com/python-jsonschema/sphinx-json-schema-spec/actions", - "https://github.com/python-jsonschema/sphinx-json-schema-spec/workflows/CI/badge.svg", # noqa: E501 + "https://github.com/python-jsonschema/sphinx-json-schema-spec/workflows/CI/badge.svg", ] # = Extensions = diff --git a/noxfile.py b/noxfile.py index a7961d1..85d9421 100644 --- a/noxfile.py +++ b/noxfile.py @@ -8,33 +8,51 @@ DOCS = ROOT / "docs" PACKAGE = ROOT / "sphinx_json_schema_spec" +REQUIREMENTS = dict( + docs=DOCS / "requirements.txt", +) +REQUIREMENTS_IN = [ # this is actually ordered, as files depend on each other + path.parent / f"{path.stem}.in" for path in REQUIREMENTS.values() +] + +SUPPORTED = ["3.11", "3.12"] +LATEST = "3.12" nox.options.sessions = [] -def session(default=True, **kwargs): +def session(default=True, python=LATEST, **kwargs): # noqa: D103 def _session(fn): if default: nox.options.sessions.append(kwargs.get("name", fn.__name__)) - return nox.session(**kwargs)(fn) + return nox.session(python=python, **kwargs)(fn) return _session -@session(python=["3.11", "3.12"]) +@session(python=SUPPORTED) def tests(session): + """ + Run the test suite with a corresponding Python version. + """ session.install("pytest", ROOT) session.run("pytest", *session.posargs, PACKAGE) @session() def audit(session): + """ + Audit dependencies for vulnerabilities. + """ session.install("pip-audit", ROOT) session.run("python", "-m", "pip_audit") @session(tags=["build"]) def build(session): + """ + Build a distribution suitable for PyPI and check its validity. + """ session.install("build", "twine") with TemporaryDirectory() as tmpdir: session.run("python", "-m", "build", ROOT, "--outdir", tmpdir) @@ -43,12 +61,18 @@ def build(session): @session(tags=["style"]) def style(session): + """ + Check Python code style. + """ session.install("ruff") session.run("ruff", "check", ROOT) @session() def typing(session): + """ + Check static typing. + """ session.install("mypy", "types-docutils", "types-lxml", ROOT) session.run("python", "-m", "mypy", PACKAGE) @@ -68,7 +92,10 @@ def typing(session): ], ) def docs(session, builder): - session.install("-r", DOCS / "requirements.txt") + """ + Build the documentation using a specific Sphinx builder. + """ + session.install("-r", REQUIREMENTS["docs"]) with TemporaryDirectory() as tmpdir_str: tmpdir = Path(tmpdir_str) argv = ["-n", "-T", "-W"] @@ -89,6 +116,9 @@ def docs(session, builder): @session(tags=["docs", "style"], name="docs(style)") def docs_style(session): + """ + Check the documentation style. + """ session.install( "doc8", "pygments", @@ -99,12 +129,16 @@ def docs_style(session): @session(default=False) def requirements(session): + """ + Update the project's pinned requirements. Commit the result. + """ session.install("pip-tools") - for each in [DOCS / "requirements.in"]: + for each in REQUIREMENTS_IN: session.run( "pip-compile", "--resolver", "backtracking", + "--strip-extras", "-U", each.relative_to(ROOT), ) diff --git a/pyproject.toml b/pyproject.toml index de820b4..a089c38 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,9 +8,9 @@ source = "vcs" [project] name = "sphinx_json_schema_spec" description = "Sphinx support for the JSON Schema specifications" +requires-python = ">=3.11" readme = "README.rst" license = {text = "MIT"} -requires-python = ">=3.11" keywords = ["json schema", "jsonschema", "data validation", "sphinx", "json"] authors = [ {email = "Julian+sphinx-json-schema-spec@GrayVines.com"}, @@ -31,61 +31,92 @@ classifiers = [ "Topic :: File Formats :: JSON :: JSON Schema", ] dynamic = ["version"] - dependencies = [ "lxml", "sphinx>=5.1.1", ] [project.urls] -Documentation = "https://sphinx-json-schema-spec.readthedocs.io/" Homepage = "https://github.com/python-jsonschema/sphinx-json-schema-spec" +Documentation = "https://sphinx-json-schema-spec.readthedocs.io/" Issues = "https://github.com/python-jsonschema/sphinx-json-schema-spec/issues/" Funding = "https://github.com/sponsors/Julian" Source = "https://github.com/python-jsonschema/sphinx-json-schema-spec" [tool.doc8] ignore = [ + "D000", # see PyCQA/doc8#125 "D001", # one sentence per line, so max length doesn't make sense ] [tool.isort] combine_as_imports = true +ensure_newline_before_comments = true from_first = true include_trailing_comma = true multi_line_output = 3 +use_parentheses = true [tool.ruff] line-length = 79 -select = ["B", "D", "E", "F", "Q", "UP", "W"] +select = ["ALL"] ignore = [ - # raise SomeException(...) is fine. - "B904", - # It's fine to not have docstrings for magic methods. - "D105", - # This rule makes diffs uglier when expanding docstrings (and it's uglier) - "D200", - # No blank lines before docstrings. - "D203", - # Start docstrings on the second line. - "D212", - # This rule misses sassy docstrings ending with ! or ?. - "D400", - # Section headers should end with a colon not a newline - "D406", - # Underlines aren't needed - "D407", - # Plz spaces after section headers - "D412", - # We support 3.8 + 3.9 - "UP007", + "A001", # It's fine to shadow builtins + "A002", + "A003", + "ARG", # This is all wrong whenever an interface is involved + "ANN", # Just let the type checker do this + "B006", # Mutable arguments require care but are OK if you don't abuse them + "B008", # It's totally OK to call functions for default arguments. + "B904", # raise SomeException(...) is fine. + "B905", # No need for explicit strict, this is simply zip's default behavior + "C408", # Calling dict is fine when it saves quoting the keys + "C901", # Not really something to focus on + "D105", # It's fine to not have docstrings for magic methods. + "D107", # __init__ especially doesn't need a docstring + "D200", # This rule makes diffs uglier when expanding docstrings + "D203", # No blank lines before docstrings. + "D212", # Start docstrings on the second line. + "D400", # This rule misses sassy docstrings ending with ! or ? + "D401", # This rule is too flaky. + "D406", # Section headers should end with a colon not a newline + "D407", # Underlines aren't needed + "D412", # Plz spaces after section headers + "EM101", # These don't bother me, it's fine there's some duplication. + "EM102", + "FBT", # It's worth avoiding boolean args but I don't care to enforce it + "FIX", # Yes thanks, if I could it wouldn't be there + "I001", # We can't yet use ruff's isort + "N", # These naming rules are silly + "PLR0912", # These metrics are fine to be aware of but not to enforce + "PLR0913", + "PLR0915", + "PLW2901", # Shadowing for loop variables is occasionally fine. + "PT006", # pytest parametrize takes strings as well + "PYI025", # wat, I'm not confused, thanks. + "RET502", # Returning None implicitly is fine + "RET503", + "RET505", # These push you to use `if` instead of `elif`, but for no reason + "RET506", + "RSE102", # Ha, what, who even knew you could leave the parens off. But no. + "S", # Security warnings with lots of false positives, as usual + "SIM300", # Not sure what heuristic this uses, but it's easily incorrect + "SLF001", # Private usage within this package itself is fine + "TD", # These TODO style rules are also silly ] extend-exclude = ["suite"] +[tool.ruff.lint.flake8-pytest-style] +mark-parentheses = false + [tool.ruff.flake8-quotes] docstring-quotes = "double" +[tool.ruff.lint.isort] +combine-as-imports = true +from-first = true + [tool.ruff.per-file-ignores] -"docs/*" = ["ANN", "D"] -"sphinx_json_schema_spec/tests/*" = ["ANN", "D"] -"noxfile.py" = ["ANN", "D"] +"noxfile.py" = ["ANN", "D100", "S101", "T201"] +"docs/*" = ["ANN", "D", "INP001"] +"sphinx_json_schema_spec/tests/*" = ["ANN", "D", "RUF012", "S", "PLR", "TRY"] diff --git a/sphinx_json_schema_spec/__init__.py b/sphinx_json_schema_spec/__init__.py index fe4bcd9..87111b5 100644 --- a/sphinx_json_schema_spec/__init__.py +++ b/sphinx_json_schema_spec/__init__.py @@ -18,9 +18,9 @@ "validation": urljoin(BASE_URL, "json-schema-validation.html"), } HARDCODED = { - "$dynamicRef": "https://json-schema.org/draft/2020-12/json-schema-core.html#dynamic-ref", # noqa: E501 + "$dynamicRef": "https://json-schema.org/draft/2020-12/json-schema-core.html#dynamic-ref", "$ref": "https://json-schema.org/draft/2020-12/json-schema-core.html#ref", - "format": "https://json-schema.org/draft/2020-12/json-schema-validation.html#name-implementation-requirements", # noqa: E501 + "format": "https://json-schema.org/draft/2020-12/json-schema-validation.html#name-implementation-requirements", } @@ -80,7 +80,7 @@ def fetch_or_load(cache_path, url): context = ssl.create_default_context() response = urllib.request.urlopen(request, context=context) - if response.code == 200: + if response.code == 200: # noqa: PLR2004 with cache_path.open("w+b") as out: out.writelines(response) out.seek(0)