Skip to content

Commit 11a5cee

Browse files
authored
Merge branch 'main' into pep832-update
2 parents 0efe82c + 964db59 commit 11a5cee

32 files changed

Lines changed: 2657 additions & 602 deletions

‎.github/CODEOWNERS‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -711,6 +711,10 @@ peps/pep-0832.rst @brettcannon
711711
peps/pep-0833.rst @dstufft
712712
peps/pep-0835.rst @ilevkivskyi
713713
peps/pep-0836.rst @savannahostrowski @Fidget-Spinner @brandtbucher
714+
peps/pep-0837.rst @serhiy-storchaka
715+
peps/pep-0838.rst @AlexWaygood
716+
peps/pep-0840.rst @jeremyhylton @gvanrossum
717+
peps/pep-0842.rst @ZeroIntensity
714718
# ...
715719
peps/pep-2026.rst @hugovk
716720
# ...

‎.github/workflows/lint.yml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ jobs:
1818
runs-on: ubuntu-latest
1919

2020
steps:
21-
- uses: actions/checkout@v7
21+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
2222
with:
2323
persist-credentials: false
2424

2525
- name: Run pre-commit hooks
26-
uses: j178/prek-action@v2.0.4
26+
uses: j178/prek-action@e98a699c41eb69ab013a45817a0406469a748f8d # v2.0.5
2727

2828
- name: Check spelling
29-
uses: j178/prek-action@v2.0.4
29+
uses: j178/prek-action@e98a699c41eb69ab013a45817a0406469a748f8d #v2.0.5
3030
continue-on-error: true
3131
with:
3232
extra_args: --all-files --hook-stage manual codespell

‎.github/workflows/render.yml‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,13 @@ jobs:
2727

2828
steps:
2929
- name: Checkout
30-
uses: actions/checkout@v7
30+
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 #v7.0.0
3131
with:
3232
fetch-depth: 0 # fetch all history so that last modified date-times are accurate
33+
persist-credentials: false
3334

3435
- name: Set up Python ${{ matrix.python-version }}
35-
uses: actions/setup-python@v6
36+
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
3637
with:
3738
python-version: ${{ matrix.python-version }}
3839
cache: pip
@@ -42,7 +43,7 @@ jobs:
4243
python -m pip install --upgrade pip
4344
4445
- name: Render PEPs
45-
run: make dirhtml search JOBS=$(nproc)
46+
run: make dirhtml search JOBS="$(nproc)"
4647

4748
# remove the .doctrees folder when building for deployment as it takes two thirds of disk space
4849
- name: Clean up files
@@ -51,7 +52,7 @@ jobs:
5152
- name: Deploy to GitHub pages
5253
# This allows CI to build branches for testing
5354
if: (github.ref == 'refs/heads/main') && (matrix.python-version == '3.x')
54-
uses: JamesIves/github-pages-deploy-action@v4
55+
uses: JamesIves/github-pages-deploy-action@d92aa235d04922e8f08b40ce78cc5442fcfbfa2f #v4.8.0
5556
with:
5657
folder: build # Synchronise with Makefile -> BUILDDIR
5758
single-commit: true # Delete existing files

‎.github/workflows/test.yml‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,18 @@ jobs:
4242
- "ubuntu-latest"
4343

4444
steps:
45-
- uses: actions/checkout@v7
45+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
4646
with:
4747
persist-credentials: false
4848

4949
- name: Set up Python ${{ matrix.python-version }}
50-
uses: actions/setup-python@v6
50+
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
5151
with:
5252
python-version: ${{ matrix.python-version }}
5353
allow-prereleases: true
5454

5555
- name: Install uv
56-
uses: hynek/setup-cached-uv@v2
56+
uses: hynek/setup-cached-uv@4300ec2180bc77d705e626a34e381b81a4772c51 # v2.5.0
5757
with:
5858
cache-dependency-path: |
5959
requirements.txt
@@ -63,7 +63,7 @@ jobs:
6363
uvx --with tox-uv tox -e py -- -v --cov-report term
6464
6565
- name: Upload coverage
66-
uses: codecov/codecov-action@v7
66+
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
6767
with:
6868
flags: ${{ matrix.os }}
6969
name: ${{ matrix.os }} Python ${{ matrix.python-version }}

‎.pre-commit-config.yaml‎

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ repos:
4848
name: "Check YAML"
4949

5050
- repo: https://github.com/psf/black-pre-commit-mirror
51-
rev: 25.12.0
51+
rev: 26.5.1
5252
hooks:
5353
- id: black
5454
name: "Format with Black"
@@ -58,7 +58,7 @@ repos:
5858
files: '^(peps/conf\.py|pep_sphinx_extensions/tests/.*)$'
5959

6060
- repo: https://github.com/astral-sh/ruff-pre-commit
61-
rev: v0.14.10
61+
rev: v0.15.21
6262
hooks:
6363
- id: ruff-check
6464
name: "Lint with Ruff"
@@ -71,8 +71,24 @@ repos:
7171
- '--check'
7272
files: '^release_management/'
7373

74+
- repo: https://github.com/python-jsonschema/check-jsonschema
75+
rev: 0.37.4
76+
hooks:
77+
- id: check-dependabot
78+
- id: check-github-workflows
79+
80+
- repo: https://github.com/rhysd/actionlint
81+
rev: v1.7.12
82+
hooks:
83+
- id: actionlint
84+
85+
- repo: https://github.com/zizmorcore/zizmor-pre-commit
86+
rev: v1.26.1
87+
hooks:
88+
- id: zizmor
89+
7490
- repo: https://github.com/tox-dev/tox-ini-fmt
75-
rev: 1.7.1
91+
rev: 1.7.2
7692
hooks:
7793
- id: tox-ini-fmt
7894
name: "Format tox.ini"
@@ -99,7 +115,7 @@ repos:
99115

100116
# Manual codespell check
101117
- repo: https://github.com/codespell-project/codespell
102-
rev: v2.4.1
118+
rev: v2.4.2
103119
hooks:
104120
- id: codespell
105121
name: "Check for common misspellings in text files"
@@ -125,3 +141,8 @@ repos:
125141
files: "^release_management/"
126142
pass_filenames: false
127143
require_serial: true
144+
145+
- repo: meta
146+
hooks:
147+
- id: check-hooks-apply
148+
- id: check-useless-excludes

‎pep_sphinx_extensions/pep_theme/templates/page.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
<h1 data-pagefind-ignore>Python Enhancement Proposals</h1>
3838
<ul class="breadcrumbs">
3939
<li><a href="https://www.python.org/" title="The Python Programming Language">Python</a> &raquo; </li>
40-
<li><a href="{{ pathto("pep-0000") }}">PEP Index</a> &raquo; </li>
40+
<li><a href="{{ pathto('', resource=True) }}" title="Python Enhancement Proposals (PEPs)">PEP Index</a> &raquo; </li>
4141
<li>{{ title.split("–")[0].strip() }}</li>
4242
</ul>
4343
<button id="colour-scheme-cycler" onClick="setColourScheme(nextColourScheme())">

‎pep_sphinx_extensions/pep_zero_generator/pep_index_generator.py‎

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,17 +60,45 @@ def write_peps_json(peps: list[parser.PEP], path: Path) -> None:
6060
Path(path, "api", "peps.json").write_text(json_peps, encoding="utf-8")
6161

6262

63+
def build_release_peps(peps: list[parser.PEP]) -> dict[str, int]:
64+
"""Map each Python version to its release-schedule PEP number.
65+
66+
Handles release PEPs that cover multiple versions jointly
67+
(e.g. "2.6, 3.0"), so individual versions also resolve.
68+
"""
69+
release_peps: dict[str, int] = {}
70+
71+
for pep in peps:
72+
if pep.python_version and "release" in pep.topic:
73+
for version in map(str.strip, pep.python_version.split(",")):
74+
release_peps[version] = pep.number
75+
76+
return release_peps
77+
78+
6379
def create_pep_zero(app: Sphinx, env: BuildEnvironment, docnames: list[str]) -> None:
6480
peps = _parse_peps(Path(app.srcdir))
6581

66-
numerical_index_text = writer.PEPZeroWriter().write_numerical_index(peps)
82+
release_peps = build_release_peps(peps)
83+
84+
numerical_index_text = writer.PEPZeroWriter(
85+
release_peps
86+
).write_numerical_index(peps)
6787
subindices.update_sphinx("numerical", numerical_index_text, docnames, env)
6888

69-
pep0_text = writer.PEPZeroWriter().write_pep0(peps, builder=env.settings["builder"])
89+
pep0_text = writer.PEPZeroWriter(
90+
release_peps
91+
).write_pep0(peps, builder=env.settings["builder"])
7092
pep0_path = subindices.update_sphinx("pep-0000", pep0_text, docnames, env)
7193
peps.append(parser.PEP(pep0_path))
7294

73-
subindices.generate_subindices(SUBINDICES_BY_TOPIC, peps, docnames, env)
95+
subindices.generate_subindices(
96+
SUBINDICES_BY_TOPIC,
97+
peps,
98+
release_peps,
99+
docnames,
100+
env,
101+
)
74102

75103
write_peps_json(peps, Path(app.outdir))
76104

‎pep_sphinx_extensions/pep_zero_generator/subindices.py‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ def update_sphinx(filename: str, text: str, docnames: list[str], env: BuildEnvir
3535
def generate_subindices(
3636
subindices: dict[str, str],
3737
peps: list[PEP],
38+
release_peps: dict[str, int],
3839
docnames: list[str],
3940
env: BuildEnvironment,
4041
) -> None:
@@ -58,8 +59,11 @@ def generate_subindices(
5859
5960
{additional_description}
6061
"""
61-
subindex_text = writer.PEPZeroWriter().write_pep0(
62-
filtered_peps, header, subindex_intro, is_pep0=False,
62+
subindex_text = writer.PEPZeroWriter(release_peps).write_pep0(
63+
filtered_peps,
64+
header,
65+
subindex_intro,
66+
is_pep0=False,
6367
)
6468
update_sphinx(f"topic/{subindex}", subindex_text, docnames, env)
6569

‎pep_sphinx_extensions/pep_zero_generator/writer.py‎

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,9 @@ class PEPZeroWriter:
5959
801: "Warsaw",
6060
}
6161

62-
def __init__(self):
62+
def __init__(self, release_peps: dict[str, int] | None = None):
6363
self.output: list[str] = []
64+
self.release_peps = release_peps or {}
6465

6566
def emit_text(self, content: str) -> None:
6667
# Appends content argument to the output list
@@ -87,7 +88,17 @@ def emit_pep_row(
8788
self.emit_text(f" - :pep:`{title.replace('`', '')} <{number}>`")
8889
self.emit_text(f" - {authors}")
8990
if python_version is not None:
90-
self.emit_text(f" - {python_version}")
91+
linked_versions = []
92+
93+
for version in map(str.strip, python_version.split(",")):
94+
release_pep = self.release_peps.get(version)
95+
96+
if release_pep is not None:
97+
linked_versions.append(f":pep:`{version} <{release_pep}>`")
98+
else:
99+
linked_versions.append(version)
100+
101+
self.emit_text(f" - {', '.join(linked_versions)}")
91102

92103
def emit_column_headers(self, *, include_version=True) -> None:
93104
"""Output the column headers for the PEP indices."""

‎pep_sphinx_extensions/tests/pep_zero_generator/test_pep_index_generator.py‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,13 @@ def test_create_pep_json():
99
out = pep_index_generator.create_pep_json(peps)
1010

1111
assert '"url": "https://peps.python.org/pep-0008/"' in out
12+
13+
14+
def test_build_release_peps_links_individual_versions_from_joint_release_pep():
15+
peps = [
16+
parser.PEP(PEP_ROOT / "pep-0361.rst"), # "2.6, 3.0" joint release PEP
17+
]
18+
19+
release_peps = pep_index_generator.build_release_peps(peps)
20+
21+
assert release_peps == {"2.6": 361, "3.0": 361}

0 commit comments

Comments
 (0)