Skip to content

Commit 9022c78

Browse files
authored
Merge branch 'main' into mailbox-improvements
2 parents fdef054 + a9fbf47 commit 9022c78

452 files changed

Lines changed: 6284 additions & 5728 deletions

File tree

Some content is hidden

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

.github/workflows/daily.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
strategy:
3636
matrix:
3737
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
38-
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
38+
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
3939
fail-fast: false
4040

4141
steps:

.github/workflows/meta_tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ jobs:
6565
with:
6666
version: PATH
6767
python-platform: ${{ matrix.python-platform }}
68-
python-version: "3.9" # Oldest version supported for running scripts and tests
68+
python-version: "3.10" # Oldest version supported for running scripts and tests
6969
project: ./pyrightconfig.scripts_and_tests.json
7070
stubsabot-dry-run:
7171
name: Stubsabot dry run

.github/workflows/stubtest_stdlib.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
strategy:
3232
matrix:
3333
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
34-
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
34+
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
3535
fail-fast: false
3636

3737
steps:

.github/workflows/tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
strategy:
4343
matrix:
4444
platform: ["linux", "win32", "darwin"]
45-
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
45+
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
4646
fail-fast: false
4747
steps:
4848
- uses: actions/checkout@v6
@@ -84,7 +84,7 @@ jobs:
8484
strategy:
8585
matrix:
8686
python-platform: ["Linux", "Windows", "Darwin"]
87-
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
87+
python-version: ["3.11", "3.12", "3.13", "3.14"]
8888
fail-fast: false
8989
steps:
9090
- uses: actions/checkout@v6

CONTRIBUTING.md

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,6 @@ Note that some tests require extra setup steps to install the required dependenc
5555
<td>Linux / macOS / WSL</td>
5656
<td>
5757

58-
On Linux and macOS, you will be able to run the full test suite on Python
59-
3.9-3.12.
6058
To install the necessary requirements, run the following commands from a
6159
terminal window:
6260

@@ -134,7 +132,7 @@ there represents a PyPI distribution, and contains the following:
134132
source distribution.
135133
* (Rarely) some docs specific to a given type stub package in `README` file.
136134

137-
When a third party stub is added or
135+
When a third-party stub is added or
138136
modified, an updated version of the corresponding distribution will be
139137
automatically uploaded to PyPI within a few hours.
140138
Each time this happens the least significant
@@ -186,7 +184,7 @@ supported:
186184
stubs for other reasons than the upstream library shipping with type
187185
information.
188186
* `upload` (optional): This field is set to `false` to prevent automatic
189-
uploads to PyPI. This should only used in special cases, e.g. when the stubs
187+
uploads to PyPI. This should only be used in special cases, e.g. when the stubs
190188
break the upload.
191189
* `partial_stub` (optional): This field marks the type stub package as
192190
[partial](https://peps.python.org/pep-0561/#partial-stub-packages). This is for
@@ -344,20 +342,20 @@ the latest mypy (`pip install -r requirements-tests.txt`) before running the scr
344342

345343
### Supported type system features
346344

347-
Since PEP 484 was accepted, there have been many other PEPs that added
348-
new features to the Python type system. In general, new features can
349-
be used in typeshed as soon as the PEP has been accepted and implemented
350-
and most type checkers support the new feature.
345+
Since [PEP 484](https://peps.python.org/pep-0484/) was accepted, there have been
346+
many other PEPs that added new features to the Python type system. In general,
347+
new features can be used in typeshed as soon as the PEP has been accepted and
348+
implemented and most type checkers support the new feature.
351349

352350
Supported features include:
353-
- [PEP 544](https://peps.python.org/pep-0544/) (Protocol)
351+
- [PEP 544](https://peps.python.org/pep-0544/) (`Protocol`)
354352
- [PEP 585](https://peps.python.org/pep-0585/) (builtin generics)
355-
- [PEP 586](https://peps.python.org/pep-0586/) (Literal)
356-
- [PEP 591](https://peps.python.org/pep-0591/) (Final/@final)
357-
- [PEP 589](https://peps.python.org/pep-0589/) (TypedDict)
353+
- [PEP 586](https://peps.python.org/pep-0586/) (`Literal`)
354+
- [PEP 591](https://peps.python.org/pep-0591/) (`Final`/`@final`)
355+
- [PEP 589](https://peps.python.org/pep-0589/) (`TypedDict`)
358356
- [PEP 604](https://peps.python.org/pep-0604/) (`Foo | Bar` union syntax)
359-
- [PEP 612](https://peps.python.org/pep-0612/) (ParamSpec)
360-
- [PEP 647](https://peps.python.org/pep-0647/) (TypeGuard):
357+
- [PEP 612](https://peps.python.org/pep-0612/) (`ParamSpec`)
358+
- [PEP 647](https://peps.python.org/pep-0647/) (`TypeGuard`):
361359
see [#5406](https://github.com/python/typeshed/issues/5406)
362360
- [PEP 655](https://peps.python.org/pep-0655/) (`Required` and `NotRequired`)
363361
- [PEP 673](https://peps.python.org/pep-0673/) (`Self`)

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ the project the stubs are for, but instead report them here to typeshed.**
2121
Further documentation on stub files, typeshed, and Python's typing system in
2222
general, can also be found at https://typing.readthedocs.io/en/latest/.
2323

24-
Typeshed supports Python versions 3.9 to 3.14.
24+
Typeshed supports Python versions 3.10 to 3.14.
2525

2626
## Using
2727

@@ -38,7 +38,7 @@ you can install the type stubs using
3838
$ pip install types-html5lib types-requests
3939
```
4040

41-
These PyPI packages follow [PEP 561](http://www.python.org/dev/peps/pep-0561/)
41+
These PyPI packages follow [the typing spec standards](https://typing.python.org/en/latest/spec/distributing.html)
4242
and are automatically released (up to once a day) by
4343
[typeshed internal machinery](https://github.com/typeshed-internal/stub_uploader).
4444

lib/ts_utils/utils.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,43 @@ def colored(text: str, color: str | None = None, **kwargs: Any) -> str: # type:
2828
return text
2929

3030

31+
_REMOVE_COMMENT_RE = re.compile(
32+
r"""
33+
(\"(?:\\.|[^\\\"])*?\") # matches literal strings
34+
|
35+
(\/\*.*?\*\/ | \/\/[^\r\n]*?(?:[\r\n])) # matches single- and multi-line comments
36+
""",
37+
re.DOTALL | re.VERBOSE,
38+
)
39+
_REMOVE_TRAILING_COMMA_RE = re.compile(
40+
r"""
41+
(\"(?:\\.|[^\\\"])*?\") # matches literal strings
42+
|
43+
,\s*([\]}]) # matches commas before '}' or ']'
44+
""",
45+
re.DOTALL | re.VERBOSE,
46+
)
47+
48+
3149
PYTHON_VERSION: Final = f"{sys.version_info.major}.{sys.version_info.minor}"
3250

3351

3452
def strip_comments(text: str) -> str:
3553
return text.split("#")[0].strip()
3654

3755

56+
def jsonc_to_json(text: str) -> str:
57+
"""Conversion from JSONC format input to valid JSON."""
58+
# Remove comments
59+
if not text.endswith("\n"):
60+
text += "\n"
61+
text = _REMOVE_COMMENT_RE.sub(lambda m: m.group(1) or "", text)
62+
63+
# Remove trailing commas before } or ]
64+
text = _REMOVE_TRAILING_COMMA_RE.sub(lambda m: m.group(1) or m.group(2), text)
65+
return text
66+
67+
3868
# ====================================================================
3969
# Printing utilities
4070
# ====================================================================

pyproject.toml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# https://github.com/astral-sh/uv/issues/8666
44
name = "typeshed"
55
version = "0"
6-
requires-python = ">=3.9" # Minimum version to run tests, used by uv run
6+
requires-python = ">=3.10" # Minimum version to run tests, used by uv run
77

88
[tool.black]
99
line-length = 130
@@ -12,8 +12,6 @@ skip-magic-trailing-comma = true
1212

1313
[tool.ruff]
1414
line-length = 130
15-
# Oldest supported Python version
16-
target-version = "py39"
1715
fix = true
1816
exclude = [
1917
# virtual environment
@@ -149,6 +147,12 @@ extend-safe-fixes = [
149147
"UP036", # Remove unnecessary `sys.version_info` blocks
150148
]
151149
ignore = [
150+
###
151+
# TODO: Disabled temporarily, until Python 3.9 support is fully removed in
152+
# May 2026.
153+
###
154+
"UP035", # import from typing
155+
"UP036", # Remove unnecessary `sys.version_info` blocks
152156
###
153157
# Rules that can conflict with the formatter (Black)
154158
# https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules
@@ -255,12 +259,10 @@ extra-standard-library = [
255259
"_typeshed",
256260
"typing_extensions",
257261
# Extra modules not recognized by Ruff
258-
# Added in Python 3.9
259-
"zoneinfo",
260262
# Added in Python 3.14
261263
"compression",
262264
]
263265
known-first-party = ["_utils", "ts_utils"]
264266

265267
[tool.typeshed]
266-
oldest_supported_python = "3.9"
268+
oldest_supported_python = "3.10"

pyrightconfig.stricter.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@
99
// test cases use a custom pyrightconfig file
1010
"**/@tests/test_cases",
1111
"stdlib/__main__.pyi",
12+
"stdlib/_tkinter.pyi",
1213
"stdlib/distutils/cmd.pyi",
1314
"stdlib/distutils/command",
1415
"stdlib/distutils/dist.pyi",
1516
"stdlib/encodings/__init__.pyi",
1617
"stdlib/lib2to3/fixes/*.pyi",
1718
"stdlib/numbers.pyi",
18-
"stdlib/_tkinter.pyi",
1919
"stdlib/tkinter/__init__.pyi",
20-
"stdlib/tkinter/filedialog.pyi",
2120
"stdlib/tkinter/dialog.pyi",
21+
"stdlib/tkinter/filedialog.pyi",
2222
"stdlib/tkinter/scrolledtext.pyi",
2323
"stdlib/tkinter/tix.pyi",
2424
"stdlib/tkinter/ttk.pyi",
@@ -44,6 +44,7 @@
4444
"stubs/grpcio-reflection/grpc_reflection/v1alpha",
4545
"stubs/grpcio-status/grpc_status",
4646
"stubs/grpcio/grpc/__init__.pyi",
47+
"stubs/gunicorn/gunicorn/dirty",
4748
"stubs/hdbcli/hdbcli/dbapi.pyi",
4849
"stubs/html5lib",
4950
"stubs/httplib2",
@@ -66,7 +67,6 @@
6667
"stubs/opentracing/opentracing/span.pyi",
6768
"stubs/paramiko/paramiko/_winapi.pyi",
6869
"stubs/parsimonious/parsimonious/nodes.pyi",
69-
"stubs/passlib",
7070
"stubs/peewee",
7171
"stubs/pexpect",
7272
"stubs/pika",
@@ -78,7 +78,6 @@
7878
"stubs/pycurl",
7979
"stubs/Pygments",
8080
"stubs/PyMySQL",
81-
"stubs/python-dateutil",
8281
"stubs/python-jose",
8382
"stubs/pywin32",
8483
"stubs/PyYAML",

scripts/create_baseline_stubs.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,18 @@ async def get_upstream_repo_url(project: str) -> str | None:
105105
# Remove `www.`; replace `http://` with `https://`
106106
url = re.sub(r"^(https?://)?(www\.)?", "https://", url_to_check)
107107
netloc = urllib.parse.urlparse(url).netloc
108-
if netloc in {"gitlab.com", "github.com", "bitbucket.org", "foss.heptapod.net"}:
109-
# truncate to https://site.com/user/repo
110-
upstream_repo_url = "/".join(url.split("/")[:5])
111-
async with session.get(upstream_repo_url) as response:
112-
if response.status == HTTPStatus.OK:
113-
return upstream_repo_url
108+
if netloc not in {"gitlab.com", "github.com", "bitbucket.org", "foss.heptapod.net"}:
109+
continue
110+
# truncate to https://site.com/user/repo
111+
upstream_repo_url = "/".join(url.split("/")[:5])
112+
async with session.get(upstream_repo_url, allow_redirects=True) as response:
113+
if response.status != HTTPStatus.OK:
114+
continue
115+
# final url after redirects
116+
final_url = str(response.url)
117+
# normalize again (in case redirect added extra path)
118+
final_repo_url = "/".join(final_url.split("/")[:5])
119+
return final_repo_url
114120
return None
115121

116122

0 commit comments

Comments
 (0)