From f3276efaca06853a86c40ac611f593c2b893704e Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Wed, 16 Oct 2024 18:05:14 +0300 Subject: [PATCH 1/9] TEMP: Lint on all operating systems --- .github/workflows/lint.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index e7f627cf393..b9efe16a63f 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -16,7 +16,12 @@ env: jobs: pre-commit: name: Run pre-commit - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + # TEMP: Lint on all to test calling check-peps.py from pre-commit + os: [windows-latest, macos-latest, ubuntu-latest] steps: - uses: actions/checkout@v4 From e61cfe8103e38c295718592813ce2ed709659141 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Sat, 19 Oct 2024 12:24:13 +0300 Subject: [PATCH 2/9] Replace deprecated top-level stage name --- .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 b36a5b105c4..3cbdd13ac9b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -6,7 +6,7 @@ minimum_pre_commit_version: '2.8.2' default_language_version: python: python3 -default_stages: [commit] +default_stages: [pre-commit] repos: From 4fb5e336d14c0380d24a8114ac51461f49cf0d85 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Sat, 19 Oct 2024 12:29:45 +0300 Subject: [PATCH 3/9] Run check-peps.py in pre-commit --- .pre-commit-config.yaml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3cbdd13ac9b..060338c8f8f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -98,13 +98,14 @@ repos: # Local checks for PEP headers and more - repo: local hooks: -# # Hook to run "check-peps.py" -# - id: "check-peps" -# name: "Check PEPs for metadata and content enforcement" -# entry: "python check-peps.py" -# language: "system" -# files: "^pep-\d{4}\.(rst|txt)$" -# require_serial: true + # Hook to run "check-peps.py" + - id: "check-peps" + name: "Check PEPs for metadata and content enforcement" + entry: "python3 check-peps.py" + language: "system" + files: '^peps/pep-\d{4}\.rst$' + require_serial: true + types: [rst] - id: check-required-headers name: "PEPs must have all required headers" From 9e052588bab40b20adc82f4d42c4f889b84df3f9 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Sat, 19 Oct 2024 17:46:34 +0300 Subject: [PATCH 4/9] language: "python" --- .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 060338c8f8f..b5a78166533 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -101,8 +101,8 @@ repos: # Hook to run "check-peps.py" - id: "check-peps" name: "Check PEPs for metadata and content enforcement" - entry: "python3 check-peps.py" - language: "system" + entry: "python check-peps.py" + language: "python" files: '^peps/pep-\d{4}\.rst$' require_serial: true types: [rst] From d3a7470d4b2d8875c0c7f955a4828f7b5b0b5055 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Sat, 19 Oct 2024 18:01:52 +0300 Subject: [PATCH 5/9] Remove dedicated check-peps job from lint.yml --- .github/workflows/lint.yml | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index b9efe16a63f..2a33a749dc7 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -38,17 +38,3 @@ jobs: uses: pre-commit/action@v3.0.1 with: extra_args: --all-files --hook-stage manual codespell || true - - check-peps: - name: Run check-peps - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - name: Set up Python 3 - uses: actions/setup-python@v5 - with: - python-version: "3" - - - name: Run check-peps - run: python check-peps.py --detailed From 543c0beb93210d56453c9f976b707a8d5e69c5d8 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Sat, 19 Oct 2024 18:04:42 +0300 Subject: [PATCH 6/9] Remove pre-commit regexes --- .pre-commit-config.yaml | 124 ---------------------------------------- 1 file changed, 124 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b5a78166533..afd51f931ef 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -106,127 +106,3 @@ repos: files: '^peps/pep-\d{4}\.rst$' require_serial: true types: [rst] - - - id: check-required-headers - name: "PEPs must have all required headers" - language: pygrep - entry: '(?-m:^PEP:(?=[\s\S]*\nTitle:)(?=[\s\S]*\nAuthor:)(?=[\s\S]*\nStatus:)(?=[\s\S]*\nType:)(?=[\s\S]*\nCreated:))' - args: ['--negate', '--multiline'] - files: '^peps/pep-\d+\.rst$' - - - id: check-header-order - name: "PEP header order must follow PEP 12" - language: pygrep - entry: '^PEP:[^\n]+\nTitle:[^\n]+\n(Version:[^\n]+\n)?(Last-Modified:[^\n]+\n)?Author:[^\n]+\n( +\S[^\n]+\n)*(Sponsor:[^\n]+\n)?((PEP|BDFL)-Delegate:[^\n]*\n)?(Discussions-To:[^\n]*\n)?Status:[^\n]+\nType:[^\n]+\n(Topic:[^\n]+\n)?(Content-Type:[^\n]+\n)?(Requires:[^\n]+\n)?Created:[^\n]+\n(Python-Version:[^\n]*\n)?(Post-History:[^\n]*\n( +\S[^\n]*\n)*)?(Replaces:[^\n]+\n)?(Superseded-By:[^\n]+\n)?(Resolution:[^\n]*\n)?\n' - args: ['--negate', '--multiline'] - files: '^peps/pep-\d+\.rst$' - - - id: validate-pep-number - name: "'PEP' header must be a number 1-9999" - language: pygrep - entry: '(?-m:^PEP:(?:(?! +(0|[1-9][0-9]{0,3})\n)))' - args: ['--multiline'] - files: '^peps/pep-\d+\.rst$' - - - id: validate-title - name: "'Title' must be 1-79 characters" - language: pygrep - entry: '(?<=\n)Title:(?:(?! +\S.{1,78}\n(?=[A-Z])))' - args: ['--multiline'] - files: '^peps/pep-\d+\.rst$' - exclude: '^peps/pep-(0499)\.rst$' - - - id: validate-author - name: "'Author' must be list of 'Name , ...'" - language: pygrep - entry: '(?<=\n)Author:(?:(?!((( +|\n {1,8})[^!#$%&()*+,/:;<=>?@\[\\\]\^_`{|}~]+( <[\w!#$%&''*+\-/=?^_{|}~.]+(@| at )[\w\-.]+\.[A-Za-z0-9]+>)?)(,|(?=\n[^ ])))+\n(?=[A-Z])))' - args: ["--multiline"] - files: '^peps/pep-\d+\.rst$' - - - id: validate-sponsor - name: "'Sponsor' must have format 'Name '" - language: pygrep - entry: '^Sponsor:(?: (?! *[^!#$%&()*+,/:;<=>?@\[\\\]\^_`{|}~]+( <[\w!#$%&''*+\-/=?^_{|}~.]+(@| at )[\w\-.]+\.[A-Za-z0-9]+>)?$))' - files: '^peps/pep-\d+\.rst$' - - - id: validate-delegate - name: "'Delegate' must have format 'Name '" - language: pygrep - entry: '^(PEP|BDFL)-Delegate: (?:(?! *[^!#$%&()*+,/:;<=>?@\[\\\]\^_`{|}~]+( <[\w!#$%&''*+\-/=?^_{|}~.]+(@| at )[\w\-.]+\.[A-Za-z0-9]+>)?$))' - files: '^peps/pep-\d+\.rst$' - exclude: '^peps/pep-(0451)\.rst$' - - - id: validate-discussions-to - name: "'Discussions-To' must be a thread URL" - language: pygrep - entry: '^Discussions-To: (?:(?!([\w\-]+@(python\.org|googlegroups\.com))|https://((discuss\.python\.org/t/([\w\-]+/)?\d+/?)|(mail\.python\.org/pipermail/[\w\-]+/\d{4}-[A-Za-z]+/[A-Za-z0-9]+\.html)|(mail\.python\.org/archives/list/[\w\-]+@python\.org/thread/[A-Za-z0-9]+/?))$))' - files: '^peps/pep-\d+\.rst$' - - - id: validate-status - name: "'Status' must be a valid PEP status" - language: pygrep - entry: '^Status:(?:(?! +(Draft|Withdrawn|Rejected|Accepted|Final|Active|Provisional|Deferred|Superseded|April Fool!)$))' - files: '^peps/pep-\d+\.rst$' - - - id: validate-type - name: "'Type' must be a valid PEP type" - language: pygrep - entry: '^Type:(?:(?! +(Standards Track|Informational|Process)$))' - files: '^peps/pep-\d+\.rst$' - - - id: validate-topic - name: "'Topic' must be for a valid sub-index" - language: pygrep - entry: '^Topic:(?:(?! +(Governance|Packaging|Typing|Release)(, (Governance|Packaging|Typing|Release))*$))' - files: '^peps/pep-\d+\.rst$' - - - id: validate-content-type - name: "'Content-Type' must be 'text/x-rst'" - language: pygrep - entry: '^Content-Type:(?:(?! +text/x-rst$))' - files: '^peps/pep-\d+\.rst$' - - - id: validate-pep-references - name: "`Requires`/`Replaces`/`Superseded-By` must be 'NNN' PEP IDs" - language: pygrep - entry: '^(Requires|Replaces|Superseded-By):(?:(?! *( (0|[1-9][0-9]{0,3})(,|$))+$))' - files: '^peps/pep-\d+\.rst$' - - - id: validate-created - name: "'Created' must be a 'DD-mmm-YYYY' date" - language: pygrep - entry: '^Created:(?:(?! +([0-2][0-9]|(3[01]))-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(199[0-9]|20[0-9][0-9])$))' - files: '^peps/pep-\d+\.rst$' - - - id: validate-python-version - name: "'Python-Version' must be a 'X.Y[.Z]` version" - language: pygrep - entry: '^Python-Version:(?:(?! *( [1-9]\.([0-9][0-9]?|x)(\.[1-9][0-9]?)?(,|$))+$))' - files: '^peps/pep-\d+\.rst$' - - - id: validate-post-history - name: "'Post-History' must be '`DD-mmm-YYYY `__, ...'" - language: pygrep - entry: '(?<=\n)Post-History:(?:(?! ?\n|((( +|\n {1,14})(([0-2][0-9]|(3[01]))-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(199[0-9]|20[0-9][0-9])|`([0-2][0-9]|(3[01]))-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(199[0-9]|20[0-9][0-9]) `__)(,|(?=\n[^ ])))+\n(?=[A-Z\n]))))' - args: [--multiline] - files: '^peps/pep-\d+\.rst$' - - - id: validate-resolution - name: "'Resolution' must be a direct thread/message URL or '`DD-mmm-YYYY `__'" - language: pygrep - entry: '(?`__))\n' - args: ['--multiline'] - files: '^peps/pep-\d+\.rst$' - - - id: check-direct-pep-links - name: "Check that PEPs aren't linked directly" - language: pygrep - entry: '(dev/peps|peps\.python\.org)/pep-\d+' - files: '^peps/pep-\d+\.rst$' - exclude: '^peps/pep-(0009|0287|0676|0684|8001)\.rst$' - - - id: check-direct-rfc-links - name: "Check that RFCs aren't linked directly" - language: pygrep - entry: '(rfc-editor\.org|ietf\.org)/[\.\-_\?\&\#\w/]*[Rr][Ff][Cc][\-_]?\d+' - types: ['rst'] From 3f79a3ffdbab0860ea329212d1d3b7ed72f43d43 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Sat, 19 Oct 2024 18:41:34 +0300 Subject: [PATCH 7/9] Revert "TEMP: Lint on all operating systems" This reverts commit f3276efaca06853a86c40ac611f593c2b893704e. --- .github/workflows/lint.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 2a33a749dc7..4c820b7c9ab 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -16,12 +16,7 @@ env: jobs: pre-commit: name: Run pre-commit - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - # TEMP: Lint on all to test calling check-peps.py from pre-commit - os: [windows-latest, macos-latest, ubuntu-latest] + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 From 6ca9f0fe043e8a46ba6d5a8c8daaae88f1e0f28c Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Sat, 19 Oct 2024 19:45:38 +0300 Subject: [PATCH 8/9] Update pre-commit --- .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 afd51f931ef..779d524c9c4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -12,7 +12,7 @@ default_stages: [pre-commit] repos: # General file checks and fixers - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.6.0 + rev: v5.0.0 hooks: - id: mixed-line-ending name: "Normalize mixed line endings" @@ -43,7 +43,7 @@ repos: name: "Check YAML" - repo: https://github.com/psf/black-pre-commit-mirror - rev: 24.4.2 + rev: 24.10.0 hooks: - id: black name: "Format with Black" @@ -53,7 +53,7 @@ repos: files: '^(peps/conf\.py|pep_sphinx_extensions/tests/.*)$' - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.5.1 + rev: v0.7.0 hooks: - id: ruff name: "Lint with Ruff" @@ -62,13 +62,13 @@ repos: files: '^pep_sphinx_extensions/tests/' - repo: https://github.com/tox-dev/tox-ini-fmt - rev: 1.3.1 + rev: 1.4.1 hooks: - id: tox-ini-fmt name: "Format tox.ini" - repo: https://github.com/sphinx-contrib/sphinx-lint - rev: v0.9.1 + rev: v1.0.0 hooks: - id: sphinx-lint name: "Sphinx lint" From ceced9e416383b60029565b73f40317a04460b15 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Sun, 20 Oct 2024 13:59:04 +0300 Subject: [PATCH 9/9] types isn't needed, we specify files to include the extension Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com> --- .pre-commit-config.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 779d524c9c4..6e4826f5801 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -105,4 +105,3 @@ repos: language: "python" files: '^peps/pep-\d{4}\.rst$' require_serial: true - types: [rst]