Skip to content

Commit c546ac4

Browse files
Merge branch 'main' into slice_annotations
2 parents 4286a65 + 9f28171 commit c546ac4

File tree

769 files changed

+16165
-10796
lines changed

Some content is hidden

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

769 files changed

+16165
-10796
lines changed

.github/workflows/daily.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ jobs:
3434
runs-on: ${{ matrix.os }}
3535
strategy:
3636
matrix:
37-
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
37+
# As of 2024-10-18, ubuntu-latest can refer to different Ubuntu versions,
38+
# which can can cause problems with os module constants.
39+
os: ["ubuntu-24.04", "windows-latest", "macos-latest"]
3840
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
3941
fail-fast: false
4042

@@ -119,8 +121,7 @@ jobs:
119121
- uses: actions/setup-python@v5
120122
with:
121123
python-version: "3.12"
122-
- name: Install uv
123-
run: curl -LsSf https://astral.sh/uv/install.sh | sh
124+
- uses: astral-sh/setup-uv@v5
124125
- name: Run tests
125126
run: |
126127
cd stub_uploader
@@ -144,6 +145,6 @@ jobs:
144145
owner: "python",
145146
repo: "typeshed",
146147
title: `Daily tests failed on ${new Date().toDateString()}`,
147-
body: "Runs listed here: https://github.com/python/typeshed/actions/workflows/daily.yml",
148+
body: "Run listed here: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}",
148149
labels: ["help wanted"],
149150
})

.github/workflows/mypy_primer.yml

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
fetch-depth: 0
3232
- uses: actions/setup-python@v5
3333
with:
34-
python-version: "3.12"
34+
python-version: "3.13"
3535
- name: Install dependencies
3636
run: pip install git+https://github.com/hauntsaninja/mypy_primer.git
3737
- name: Run mypy_primer
@@ -57,18 +57,35 @@ jobs:
5757
--output concise \
5858
| tee diff_${{ matrix.shard-index }}.txt
5959
) || [ $? -eq 1 ]
60-
- name: Upload mypy_primer diff
61-
uses: actions/upload-artifact@v4
62-
with:
63-
name: mypy_primer_diff_${{ matrix.shard-index }}
64-
path: diff_${{ matrix.shard-index }}.txt
6560
- if: ${{ matrix.shard-index == 0 }}
6661
name: Save PR number
6762
run: |
6863
echo ${{ github.event.pull_request.number }} | tee pr_number.txt
69-
- if: ${{ matrix.shard-index == 0 }}
70-
name: Upload PR number
64+
- name: Upload mypy_primer diff + PR number
7165
uses: actions/upload-artifact@v4
66+
if: ${{ matrix.shard-index == 0 }}
67+
with:
68+
name: mypy_primer_diffs-${{ matrix.shard-index }}
69+
path: |
70+
diff_${{ matrix.shard-index }}.txt
71+
pr_number.txt
72+
- name: Upload mypy_primer diff
73+
uses: actions/upload-artifact@v4
74+
if: ${{ matrix.shard-index != 0 }}
75+
with:
76+
name: mypy_primer_diffs-${{ matrix.shard-index }}
77+
path: diff_${{ matrix.shard-index }}.txt
78+
79+
join_artifacts:
80+
name: Join artifacts
81+
runs-on: ubuntu-latest
82+
needs: [mypy_primer]
83+
permissions:
84+
contents: read
85+
steps:
86+
- name: Merge artifacts
87+
uses: actions/upload-artifact/merge@v4
7288
with:
73-
name: mypy_primer_diff_pr_number
74-
path: pr_number.txt
89+
name: mypy_primer_diffs
90+
pattern: mypy_primer_diffs-*
91+
delete-merged: true

.github/workflows/mypy_primer_comment.yml

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Post mypy_primer comment
1+
name: Comment with mypy_primer diff
22

33
on:
44
workflow_run:
@@ -14,8 +14,8 @@ permissions:
1414
jobs:
1515
comment:
1616
name: Comment PR from mypy_primer
17-
if: ${{ github.event.workflow_run.conclusion == 'success' }}
1817
runs-on: ubuntu-latest
18+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
1919
steps:
2020
- name: Download diffs
2121
uses: actions/github-script@v7
@@ -27,28 +27,26 @@ jobs:
2727
repo: context.repo.repo,
2828
run_id: ${{ github.event.workflow_run.id }},
2929
});
30-
const matchArtifacts = artifacts.data.artifacts.filter((artifact) =>
31-
artifact.name.startsWith("mypy_primer_diff"));
30+
const [matchArtifact] = artifacts.data.artifacts.filter((artifact) =>
31+
artifact.name == "mypy_primer_diffs");
3232
33-
for (const matchArtifact of matchArtifacts) {
34-
const download = await github.rest.actions.downloadArtifact({
35-
owner: context.repo.owner,
36-
repo: context.repo.repo,
37-
artifact_id: matchArtifact.id,
38-
archive_format: "zip",
39-
});
40-
fs.writeFileSync(`${matchArtifact.name}.zip`, Buffer.from(download.data));
41-
}
33+
const download = await github.rest.actions.downloadArtifact({
34+
owner: context.repo.owner,
35+
repo: context.repo.repo,
36+
artifact_id: matchArtifact.id,
37+
archive_format: "zip",
38+
});
39+
fs.writeFileSync("diff.zip", Buffer.from(download.data));
4240
43-
- run: for file in *.zip; do unzip $file; done
41+
- run: unzip diff.zip
4442
- run: |
4543
cat diff_*.txt | tee fulldiff.txt
4644
4745
- name: Post comment
4846
id: post-comment
4947
uses: actions/github-script@v7
5048
with:
51-
github-token: ${{secrets.GITHUB_TOKEN}}
49+
github-token: ${{ secrets.GITHUB_TOKEN }}
5250
script: |
5351
const fs = require('fs')
5452
let data = fs.readFileSync('fulldiff.txt', { encoding: 'utf8' })
@@ -61,6 +59,9 @@ jobs:
6159
data = truncated_data + `\n\n... (truncated ${lines_truncated} lines) ...\n`
6260
}
6361
62+
console.log("Diff from mypy_primer:")
63+
console.log(data)
64+
6465
let body
6566
if (data.trim()) {
6667
body = 'Diff from [mypy_primer](https://github.com/hauntsaninja/mypy_primer), showing the effect of this PR on open source code:\n```diff\n' + data + '```'

.github/workflows/stubsabot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,5 @@ jobs:
5252
owner: "python",
5353
repo: "typeshed",
5454
title: `Stubsabot failed on ${new Date().toDateString()}`,
55-
body: "Stubsabot runs are listed here: https://github.com/python/typeshed/actions/workflows/stubsabot.yml",
55+
body: "Stubsabot run is listed here: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}",
5656
})

.github/workflows/stubtest_stdlib.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ jobs:
3030
runs-on: ${{ matrix.os }}
3131
strategy:
3232
matrix:
33-
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
33+
# As of 2024-10-18, ubuntu-latest can refer to different Ubuntu versions,
34+
# which can can cause problems with os module constants.
35+
os: ["ubuntu-24.04", "windows-latest", "macos-latest"]
3436
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
3537
fail-fast: false
3638

.github/workflows/tests.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ jobs:
4343
with:
4444
# Max supported Python version as of pytype 2024.9.13
4545
python-version: "3.12"
46-
- name: Install uv
47-
run: curl -LsSf https://astral.sh/uv/install.sh | sh
46+
- uses: astral-sh/setup-uv@v5
4847
- run: uv pip install -r requirements-tests.txt --system
4948
- name: Install external dependencies for 3rd-party stubs
5049
run: |
@@ -121,8 +120,7 @@ jobs:
121120
- uses: actions/setup-python@v5
122121
with:
123122
python-version: "3.12"
124-
- name: Install uv
125-
run: curl -LsSf https://astral.sh/uv/install.sh | sh
123+
- uses: astral-sh/setup-uv@v5
126124
- name: Install typeshed test-suite requirements
127125
# Install these so we can run `get_external_stub_requirements.py`
128126
run: uv pip install -r requirements-tests.txt --system
@@ -183,8 +181,7 @@ jobs:
183181
- uses: actions/setup-python@v5
184182
with:
185183
python-version: "3.12"
186-
- name: Install uv
187-
run: curl -LsSf https://astral.sh/uv/install.sh | sh
184+
- uses: astral-sh/setup-uv@v5
188185
- name: Run tests
189186
run: |
190187
cd stub_uploader

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ repos:
1111
args: [--fix=lf]
1212
- id: check-case-conflict
1313
- repo: https://github.com/astral-sh/ruff-pre-commit
14-
rev: v0.7.1 # must match requirements-tests.txt
14+
rev: v0.8.5 # must match requirements-tests.txt
1515
hooks:
1616
- id: ruff
1717
name: Run ruff on stubs, tests and scripts

.vscode/settings.default.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,14 @@
7070
"editor.defaultFormatter": "ms-python.black-formatter",
7171
"editor.codeActionsOnSave": {
7272
// Let Ruff lint fixes handle imports
73-
"source.organizeImports": "never"
73+
"source.organizeImports": "never",
74+
"source.unusedImports": "never"
7475
}
7576
},
7677
// python.analysis is Pylance (pyright) configurations
7778
"python.analysis.fixAll": [
78-
"source.unusedImports"
7979
// Explicitly omiting "source.convertImportFormat", some stubs use relative imports
80+
// Explicitly omiting "source.unusedImports", Let Ruff lint fixes handle imports
8081
],
8182
"python.analysis.typeshedPaths": [
8283
"${workspaceFolder}"

lib/ts_utils/metadata.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323

2424
__all__ = [
2525
"NoSuchStubError",
26-
"StubMetadata",
2726
"PackageDependencies",
27+
"StubMetadata",
2828
"StubtestSettings",
2929
"get_recursive_requirements",
3030
"read_dependencies",
@@ -184,7 +184,7 @@ def is_obsolete(self) -> bool:
184184

185185

186186
class NoSuchStubError(ValueError):
187-
"""Raise NoSuchStubError to indicate that a stubs/{distribution} directory doesn't exist"""
187+
"""Raise NoSuchStubError to indicate that a stubs/{distribution} directory doesn't exist."""
188188

189189

190190
@cache
@@ -302,9 +302,10 @@ def read_metadata(distribution: str) -> StubMetadata:
302302

303303

304304
def update_metadata(distribution: str, **new_values: object) -> tomlkit.TOMLDocument:
305-
"""Updates a distribution's METADATA.toml.
305+
"""Update a distribution's METADATA.toml.
306306
307-
Return the updated TOML dictionary for use without having to open the file separately."""
307+
Return the updated TOML dictionary for use without having to open the file separately.
308+
"""
308309
path = metadata_path(distribution)
309310
try:
310311
with path.open("rb") as file:

lib/ts_utils/utils.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from termcolor import colored as colored # pyright: ignore[reportAssignmentType]
1818
except ImportError:
1919

20-
def colored(text: str, color: str | None = None, **kwargs: Any) -> str: # type: ignore[misc]
20+
def colored(text: str, color: str | None = None, **kwargs: Any) -> str: # type: ignore[misc] # noqa: ARG001
2121
return text
2222

2323

@@ -92,7 +92,6 @@ def venv_python(venv_dir: Path) -> Path:
9292
@cache
9393
def parse_requirements() -> Mapping[str, Requirement]:
9494
"""Return a dictionary of requirements from the requirements file."""
95-
9695
with REQUIREMENTS_PATH.open(encoding="UTF-8") as requirements_file:
9796
stripped_lines = map(strip_comments, requirements_file)
9897
stripped_more = [li for li in stripped_lines if not li.startswith("-")]

0 commit comments

Comments
 (0)