Skip to content

Commit 165e36a

Browse files
authored
Merge branch 'master' into whats-new-template
2 parents 6fd1fcb + 6efdea0 commit 165e36a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+4096
-1513
lines changed

.coveragerc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ exclude_also =
66
# Don't complain if non-runnable code isn't run:
77
if __name__ == .__main__.
88
def main
9+
def get_arg_parser

.github/dependabot.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,14 @@ updates:
88
actions:
99
patterns:
1010
- "*"
11+
12+
- package-ecosystem: pip
13+
directory: "/"
14+
schedule:
15+
interval: monthly
16+
assignees:
17+
- "ezio-melotti"
18+
groups:
19+
pip:
20+
patterns:
21+
- "*"

.github/workflows/lint.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ jobs:
1414

1515
steps:
1616
- uses: actions/checkout@v4
17+
with:
18+
persist-credentials: false
1719
- uses: actions/setup-python@v5
1820
with:
1921
python-version: "3.x"

.github/workflows/source-and-docs-release.yml

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,17 @@ on:
3737

3838
name: "Build Python source and docs artifacts"
3939

40+
permissions: {}
41+
4042
# Set from inputs for workflow_dispatch, or set defaults to test push/PR events
4143
env:
4244
GIT_REMOTE: ${{ github.event.inputs.git_remote || 'python' }}
43-
GIT_COMMIT: ${{ github.event.inputs.git_commit || 'f6650f9ad73359051f3e558c2431a109bc016664' }}
44-
CPYTHON_RELEASE: ${{ github.event.inputs.cpython_release || '3.12.3' }}
45+
GIT_COMMIT: ${{ github.event.inputs.git_commit || '4f8bb3947cfbc20f970ff9d9531e1132a9e95396' }}
46+
CPYTHON_RELEASE: ${{ github.event.inputs.cpython_release || '3.13.2' }}
4547

4648
jobs:
4749
verify-input:
48-
runs-on: ubuntu-22.04
50+
runs-on: ubuntu-24.04
4951
outputs:
5052
# Needed because env vars are not available in the build-docs check below
5153
cpython_release: ${{ env.CPYTHON_RELEASE }}
@@ -57,8 +59,9 @@ jobs:
5759
echo "cpython_release: $CPYTHON_RELEASE"
5860
5961
- name: "Checkout ${{ env.GIT_REMOTE }}/cpython"
60-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
62+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
6163
with:
64+
persist-credentials: false
6265
repository: "${{ env.GIT_REMOTE }}/cpython"
6366
ref: "v${{ env.CPYTHON_RELEASE }}"
6467
path: "cpython"
@@ -71,24 +74,27 @@ jobs:
7174
fi
7275
7376
build-source:
74-
runs-on: ubuntu-22.04
77+
runs-on: ubuntu-24.04
7578
needs:
7679
- verify-input
7780
steps:
7881
- name: "Checkout python/release-tools"
79-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
82+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
83+
with:
84+
persist-credentials: false
8085

8186
- name: "Checkout ${{ env.GIT_REMOTE }}/cpython"
82-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
87+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
8388
with:
89+
persist-credentials: false
8490
repository: "${{ env.GIT_REMOTE }}/cpython"
8591
ref: "v${{ env.CPYTHON_RELEASE }}"
8692
path: "cpython"
8793

8894
- name: "Setup Python"
89-
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
95+
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
9096
with:
91-
python-version: 3.11
97+
python-version: 3.12
9298

9399
- name: "Install source dependencies"
94100
run: |
@@ -101,30 +107,31 @@ jobs:
101107
python ../release.py --export "$CPYTHON_RELEASE" --skip-docs
102108
103109
- name: "Upload the source artifacts"
104-
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
110+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
105111
with:
106112
name: source
107113
path: |
108114
cpython/${{ env.CPYTHON_RELEASE }}/src
109115
110116
build-docs:
111-
runs-on: ubuntu-22.04
117+
runs-on: ubuntu-24.04
112118
needs:
113119
- verify-input
114120

115121
# Docs aren't built for alpha or beta releases.
116122
if: (!(contains(needs.verify-input.outputs.cpython_release, 'a') || contains(needs.verify-input.outputs.cpython_release, 'b')))
117123
steps:
118124
- name: "Checkout ${{ env.GIT_REMOTE }}/cpython"
119-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
125+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
120126
with:
127+
persist-credentials: false
121128
repository: "${{ env.GIT_REMOTE }}/cpython"
122129
ref: "v${{ env.CPYTHON_RELEASE }}"
123130

124131
- name: "Setup Python"
125-
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
132+
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
126133
with:
127-
python-version: 3.11
134+
python-version: 3.12
128135

129136
- name: "Install docs dependencies"
130137
run: |
@@ -143,19 +150,19 @@ jobs:
143150
SPHINXOPTS="-j10" make dist
144151
145152
- name: "Upload the docs artifacts"
146-
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
153+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
147154
with:
148155
name: docs
149156
path: |
150157
Doc/dist/
151158
152159
test-source:
153-
runs-on: ubuntu-22.04
160+
runs-on: ubuntu-24.04
154161
needs:
155162
- build-source
156163
steps:
157164
- name: "Download the source artifacts"
158-
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
165+
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
159166
with:
160167
name: source
161168

.github/workflows/test.yml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,27 @@ name: Test
22

33
on: [push, pull_request, workflow_dispatch]
44

5+
permissions: {}
6+
57
env:
68
FORCE_COLOR: 1
79

810
jobs:
911
tests:
1012
name: "Tests"
11-
runs-on: ubuntu-latest
13+
runs-on: ${{ matrix.os }}
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
python-version: ["3.12", "3.13"]
18+
os: [macos-latest, ubuntu-latest]
1219
steps:
13-
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
14-
- uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
20+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
21+
with:
22+
persist-credentials: false
23+
- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
1524
with:
16-
python-version: 3.x
25+
python-version: ${{ matrix.python-version }}
1726
cache: pip
1827
cache-dependency-path: dev-requirements.txt
1928
- run: |
@@ -22,6 +31,6 @@ jobs:
2231
tox -e py
2332
2433
- name: Upload coverage
25-
uses: codecov/codecov-action@v4
34+
uses: codecov/codecov-action@v5
2635
with:
2736
token: ${{ secrets.CODECOV_ORG_TOKEN }}

.pre-commit-config.yaml

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,61 @@
11
repos:
22
- repo: https://github.com/astral-sh/ruff-pre-commit
3-
rev: v0.3.5
3+
rev: v0.9.6
44
hooks:
55
- id: ruff
66
args: [--exit-non-zero-on-fix]
77

88
- repo: https://github.com/psf/black-pre-commit-mirror
9-
rev: 24.4.2
9+
rev: 25.1.0
1010
hooks:
1111
- id: black
1212

1313
- repo: https://github.com/pre-commit/pre-commit-hooks
14-
rev: v4.6.0
14+
rev: v5.0.0
1515
hooks:
1616
- id: check-added-large-files
1717
- id: check-case-conflict
1818
- id: check-merge-conflict
1919
- id: check-toml
2020
- id: check-yaml
21-
exclude: windows-release/azure-pipelines.yml
21+
exclude: windows-release/(azure-pipelines|msi-steps).yml
2222
- id: debug-statements
2323
- id: end-of-file-fixer
2424
- id: forbid-submodules
2525
- id: trailing-whitespace
2626

2727
- repo: https://github.com/python-jsonschema/check-jsonschema
28-
rev: 0.28.1
28+
rev: 0.31.1
2929
hooks:
3030
- id: check-dependabot
3131
- id: check-github-workflows
3232

3333
- repo: https://github.com/rhysd/actionlint
34-
rev: v1.6.27
34+
rev: v1.7.7
3535
hooks:
3636
- id: actionlint
3737

38+
- repo: https://github.com/woodruffw/zizmor-pre-commit
39+
rev: v1.3.1
40+
hooks:
41+
- id: zizmor
42+
3843
- repo: https://github.com/tox-dev/pyproject-fmt
39-
rev: 2.1.3
44+
rev: v2.5.0
4045
hooks:
4146
- id: pyproject-fmt
4247

4348
- repo: https://github.com/abravalheri/validate-pyproject
44-
rev: v0.18
49+
rev: v0.23
4550
hooks:
4651
- id: validate-pyproject
4752

4853
- repo: https://github.com/tox-dev/tox-ini-fmt
49-
rev: 1.3.1
54+
rev: 1.5.0
5055
hooks:
5156
- id: tox-ini-fmt
5257

5358
- repo: meta
5459
hooks:
5560
- id: check-hooks-apply
5661
- id: check-useless-excludes
57-
58-
ci:
59-
autoupdate_schedule: quarterly

add_to_pydotorg.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@
2929
import re
3030
import subprocess
3131
import sys
32+
from collections.abc import Generator
3233
from os import path
33-
from typing import Any, Generator, NoReturn
34+
from typing import Any, NoReturn
3435

3536
import requests
3637

@@ -422,13 +423,23 @@ def has_sigstore_signature(filename: str) -> bool:
422423
filename_sigstore = filename + ".sigstore"
423424

424425
if os.path.exists(filename_sigstore):
425-
run_cmd(sigstore_verify_argv + ["--bundle", filename_sigstore, filename])
426+
run_cmd(
427+
sigstore_verify_argv + ["--bundle", filename_sigstore, filename],
428+
stderr=subprocess.STDOUT, # Sigstore sends stderr on success.
429+
)
426430

427431
# We use an 'or' here to error out if one of the files is missing.
428432
if os.path.exists(filename_sig) or os.path.exists(filename_crt):
429433
run_cmd(
430434
sigstore_verify_argv
431-
+ ["--certificate", filename_crt, "--signature", filename_sig, filename]
435+
+ [
436+
"--certificate",
437+
filename_crt,
438+
"--signature",
439+
filename_sig,
440+
filename,
441+
],
442+
stderr=subprocess.STDOUT, # Sigstore sends stderr on success.
432443
)
433444

434445

buildbotapi.py

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import asyncio
21
import json
32
from dataclasses import dataclass
43
from typing import Any, cast
@@ -12,7 +11,6 @@
1211
class Builder:
1312
builderid: int
1413
description: str | None
15-
masterids: list[int]
1614
name: str
1715
tags: list[str]
1816

@@ -23,26 +21,6 @@ def __hash__(self) -> int:
2321
return hash(self.builderid)
2422

2523

26-
@dataclass
27-
class Build:
28-
id: int
29-
is_currently_failing: bool
30-
builderid: int
31-
builder: Builder | None
32-
33-
def __init__(self, **kwargs: Any) -> None:
34-
self.__dict__.update(**kwargs)
35-
self.id = int(kwargs.get("number", -1))
36-
self.is_currently_failing = kwargs.get("currently_failing", False)
37-
self.builder = None
38-
39-
def __eq__(self, other: object) -> bool:
40-
return isinstance(other, Build) and self.id == other.id
41-
42-
def __hash__(self) -> int:
43-
return hash(self.id)
44-
45-
4624
class BuildBotAPI:
4725
def __init__(self, session: ClientSession) -> None:
4826
self._session = session
@@ -91,44 +69,3 @@ async def is_builder_failing_currently(self, builder: Builder) -> bool:
9169
if build["results"] == 2:
9270
return True
9371
return False
94-
95-
async def get_build(self, builder_id: int, build_id: int) -> Build:
96-
data = await self._fetch_json(
97-
f"https://buildbot.python.org/all/api/v2/builders/{builder_id}"
98-
f"/builds/{build_id}"
99-
)
100-
(build_data,) = data["builds"]
101-
build: Build = Build(**build_data)
102-
build.builder = (await self.all_builders())[build.builderid]
103-
build.is_currently_failing = await self.is_builder_failing_currently(
104-
build.builder
105-
)
106-
return build
107-
108-
async def get_recent_failures(self, limit: int = 100) -> set[Build]:
109-
data = await self._fetch_json(
110-
f"https://buildbot.python.org/all/api/v2/builds?"
111-
f"complete__eq=true&&results__eq=2&&"
112-
f"order=-complete_at&&limit={limit}"
113-
)
114-
115-
stable_builders = await self.stable_builders()
116-
117-
all_failures = {
118-
Build(**build)
119-
for build in data["builds"]
120-
if build["builderid"] in stable_builders
121-
}
122-
123-
for failure in all_failures:
124-
failure.builder = stable_builders[failure.builderid]
125-
126-
async def _get_missing_info(failure: Build) -> None:
127-
assert failure.builder is not None
128-
failure.is_currently_failing = await self.is_builder_failing_currently(
129-
failure.builder
130-
)
131-
132-
await asyncio.gather(*[_get_missing_info(failure) for failure in all_failures])
133-
134-
return all_failures

dev-requirements.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
pytest
2+
pytest-aiohttp
23
pytest-cov
34
pytest-mock

0 commit comments

Comments
 (0)