From df7ef7207806e3d75c63284cbf0dea49db353128 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Tue, 14 Jan 2025 09:31:35 +0200 Subject: [PATCH 1/6] Bump GitHub Actions --- .github/workflows/test-translations.yml | 2 +- .github/workflows/test.yml | 4 ++-- .github/workflows/translation.yml | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test-translations.yml b/.github/workflows/test-translations.yml index 45dc60aa3..e793937b8 100644 --- a/.github/workflows/test-translations.yml +++ b/.github/workflows/test-translations.yml @@ -67,7 +67,7 @@ jobs: run: python -m pip install --upgrade nox virtualenv sphinx-lint - name: Set Sphinx problem matcher - uses: sphinx-doc/github-problem-matcher@v1.0 + uses: sphinx-doc/github-problem-matcher@v1.1 - name: Build translated docs in ${{ matrix.language }} run: nox -s build -- -q -D language=${{ matrix.language }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8503ca720..799e95204 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -24,10 +24,10 @@ jobs: - linkcheck 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.11" cache: 'pip' diff --git a/.github/workflows/translation.yml b/.github/workflows/translation.yml index 7cfae2991..2a24a8e36 100644 --- a/.github/workflows/translation.yml +++ b/.github/workflows/translation.yml @@ -19,14 +19,14 @@ jobs: steps: - name: Grab the repo src - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 # To reach the common commit - name: Set up git user as [bot] # Refs: # * https://github.community/t/github-actions-bot-email-address/17204/6 # * https://github.com/actions/checkout/issues/13#issuecomment-724415212 - uses: fregante/setup-git-user@v1.1.0 + uses: fregante/setup-git-user@v2.0.2 - name: Switch to the translation source branch run: | @@ -51,7 +51,7 @@ jobs: git merge '${{ github.event.repository.default_branch }}' - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: >- 3.10 From 6339a91e4318719aaa160a05a413cc70b2cac2b0 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Tue, 14 Jan 2025 16:08:02 +0200 Subject: [PATCH 2/6] Add Spinx Lint and extra linters to pre-commit --- .pre-commit-config.yaml | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index db8b1131a..e5c546604 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,16 +2,22 @@ ci: autoupdate_schedule: quarterly repos: +- repo: https://github.com/pre-commit/pygrep-hooks + rev: v1.10.0 + hooks: + - id: rst-backticks + - repo: https://github.com/pre-commit/pre-commit-hooks rev: v5.0.0 hooks: - id: check-added-large-files - id: check-case-conflict - id: check-merge-conflict - - id: check-symlinks + - id: check-json - id: check-yaml - id: end-of-file-fixer - id: mixed-line-ending + - id: requirements-txt-fixer - id: trailing-whitespace - repo: https://github.com/codespell-project/codespell @@ -37,7 +43,17 @@ repos: - id: rst-inline-touching-normal - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.7.1 + rev: v0.9.1 hooks: - id: ruff - id: ruff-format + +- repo: https://github.com/sphinx-contrib/sphinx-lint + rev: v1.0.0 + hooks: + - id: sphinx-lint + +- repo: meta + hooks: + - id: check-hooks-apply + - id: check-useless-excludes From e2a552e92ac56c47369b8fe1a6ca2176b22f60cb Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Tue, 14 Jan 2025 16:08:28 +0200 Subject: [PATCH 3/6] Apply requirements-txt-fixer --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index a3269a025..2aca1384a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ furo==2024.8.6 sphinx==7.2.6 sphinx-autobuild==2021.3.14 -sphinx-inline-tabs==2023.4.21 sphinx-copybutton==0.5.2 +sphinx-inline-tabs==2023.4.21 sphinx-toolbox==3.5.0 From 08107d586ac8f334a4c613c0b9295f1c3bdc5eda Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Tue, 14 Jan 2025 16:08:55 +0200 Subject: [PATCH 4/6] Fix tab to spaces, found by Sphinx Lint --- source/glossary.rst | 2 +- source/guides/creating-command-line-tools.rst | 24 +++++++++---------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/source/glossary.rst b/source/glossary.rst index dc6211833..f3eb2591d 100644 --- a/source/glossary.rst +++ b/source/glossary.rst @@ -257,7 +257,7 @@ Glossary `_, and discuss issues on the `distutils-sig mailing list `_ - and `the Python Discourse forum `__. + and `the Python Discourse forum `__. Python Package Index (PyPI) diff --git a/source/guides/creating-command-line-tools.rst b/source/guides/creating-command-line-tools.rst index 49ce0c9ed..495e69d78 100644 --- a/source/guides/creating-command-line-tools.rst +++ b/source/guides/creating-command-line-tools.rst @@ -102,9 +102,9 @@ so initizalize the command-line interface here: .. code-block:: python - if __name__ == "__main__": - from greetings.cli import app - app() + if __name__ == "__main__": + from greetings.cli import app + app() .. note:: @@ -123,8 +123,8 @@ For the project to be recognised as a command-line tool, additionally a ``consol .. code-block:: toml - [project.scripts] - greet = "greetings.cli:app" + [project.scripts] + greet = "greetings.cli:app" Now, the project's source tree is ready to be transformed into a :term:`distribution package `, which makes it installable. @@ -145,12 +145,12 @@ Let's test it: .. code-block:: console - $ greet --knight Lancelot - Greetings, dear Sir Lancelot! - $ greet --gender feminine Parks - Greetings, dear Ms. Parks! - $ greet --gender masculine - Greetings, dear Mr. what's-his-name! + $ greet --knight Lancelot + Greetings, dear Sir Lancelot! + $ greet --gender feminine Parks + Greetings, dear Ms. Parks! + $ greet --gender masculine + Greetings, dear Mr. what's-his-name! Since this example uses ``typer``, you could now also get an overview of the program's usage by calling it with the ``--help`` option, or configure completions via the ``--install-completion`` option. @@ -160,7 +160,7 @@ To just run the program without installing it permanently, use ``pipx run``, whi .. code-block:: console - $ pipx run --spec . greet --knight + $ pipx run --spec . greet --knight This syntax is a bit unpractical, however; as the name of the entry point we defined above does not match the package name, we need to state explicitly which executable script to run (even though there is only on in existence). From eb1cf393d73e358ea774a8bb2252e12c0398e068 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Tue, 14 Jan 2025 19:44:17 +0200 Subject: [PATCH 5/6] Remove duplicate --- .pre-commit-config.yaml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e5c546604..ccdd74e3e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,11 +2,6 @@ ci: autoupdate_schedule: quarterly repos: -- repo: https://github.com/pre-commit/pygrep-hooks - rev: v1.10.0 - hooks: - - id: rst-backticks - - repo: https://github.com/pre-commit/pre-commit-hooks rev: v5.0.0 hooks: From 983d39f30d81552aefac5494b9dbb8fa1a974873 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Tue, 14 Jan 2025 23:24:21 +0200 Subject: [PATCH 6/6] Move fast meta hooks to the beginning --- .pre-commit-config.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ccdd74e3e..e6b06cbf8 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,6 +2,11 @@ ci: autoupdate_schedule: quarterly repos: +- repo: meta + hooks: + - id: check-hooks-apply + - id: check-useless-excludes + - repo: https://github.com/pre-commit/pre-commit-hooks rev: v5.0.0 hooks: @@ -47,8 +52,3 @@ repos: rev: v1.0.0 hooks: - id: sphinx-lint - -- repo: meta - hooks: - - id: check-hooks-apply - - id: check-useless-excludes