Skip to content

Commit 6e276e8

Browse files
author
nightcityblade
committed
Merge main into fix/issue-15269
2 parents 47d101b + cd09de9 commit 6e276e8

17 files changed

Lines changed: 101 additions & 26 deletions

File tree

AGENTS.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# typeshed - Python type stub repository
2+
3+
typeshed contains [type stubs](https://typing.python.org/en/latest/spec/distributing.html)
4+
for Python's standard library as well as for some packages available on
5+
[PyPI](https://pypi.org/) (usually called "third-party stubs" in typeshed)
6+
that don't provide their own type annotations.
7+
8+
The standard library stubs get vendored by type checkers. Each third-party
9+
stub package is distributed as a separate package (usually called
10+
`types-<name>`) on PyPI.
11+
12+
## Directory Structure
13+
14+
- `stdlib/` - Python standard library stubs
15+
- `stubs/` - PyPI package stubs, one directory per package
16+
- `scripts`/ - utility scripts
17+
- `tests/` - scripts for various tests, see `tests/README.md`
18+
- `lib/` - utility modules used by multiple scripts
19+
20+
## Running tests
21+
22+
To run all tests:
23+
24+
- Create a new virtual environment (venv), update pip
25+
- Install the dependencies from `requirements-tests.txt` into it
26+
- Run `tests/runtests.py <path>` from the activated venv
27+
28+
`<path>` is either:
29+
30+
- `stdlib/<stub>.pyi`
31+
- `stubs/<package>`
32+
33+
See `tests/README.md` for more information about running tests.
34+
35+
## Pull Requests
36+
37+
When opening pull requests, do the following:
38+
39+
- Follow the guidance from `CONTRIBUTING.md`.
40+
- Run the tests as described above before submitting.
41+
- Don't include tests for .pyi files, unless the situation is complex. See
42+
`tests/REGRESSION.md`.
43+
- Use a concise PR description:
44+
- Either link to an issue or describe the problem briefly, never both.
45+
- Limit the summary of changes to one sentence, unless the PR is complex.
46+
- Don't include a testing plan.
47+
- Add the name of the agent used to the PR description.

MAINTAINERS.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,3 +97,9 @@ requests as "not planned" with an explanation like this:
9797
We gladly accept type stub contributions for third-party libraries that are published on PyPI in typeshed. To contribute a new library, please follow the steps outlined in [CONTRIBUTING.md](/python/typeshed/blob/main/CONTRIBUTING.md). The `create_baseline_stubs.py` script can be useful to create an initial version, suitable for inclusion in typeshed.
9898

9999
That said, we don't keep requests for third-party library stubs open, unless there are issues that need to be addressed before a PR can be opened. Therefore, I'm closing this issue.
100+
101+
### Asking to remove tests
102+
103+
Please remove the tests. In typeshed, we only add regression tests for functions and classes which are known to have caused complex problems in the past, or where stubs are difficult to get right. 100% test coverage for typeshed is neither necessary nor desirable, as it would lead to code duplication.
104+
105+
See [`tests/REGRESSION.md`](https://github.com/python/typeshed/blob/main/tests/REGRESSION.md) for more information.

requirements-tests.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ pyright==1.1.411
55
ty==0.0.59
66

77
# Libraries used by our various scripts.
8-
aiohttp==3.14.1
8+
aiohttp==3.14.3
99
grpcio-tools>=1.76.0; python_version < "3.15" # For grpc_tools.protoc
1010
mypy-protobuf==5.1.0; python_version < "3.15"
1111
packaging==26.2

stdlib/@tests/test_cases/check_tkinter.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ def foo(x: int, y: str) -> None:
2424
root.after(1000, foo, 10, "lol")
2525
root.after(1000, foo, 10, 10) # type: ignore
2626

27-
2827
# Font size must be integer
2928
label = tkinter.Label()
3029
label.config(font=("", 12))

stdlib/_ctypes.pyi

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,3 +373,7 @@ def Py_INCREF(o: _T, /) -> _T: ...
373373
def buffer_info(o: _CData | _CDataType | type[_CData | _CDataType], /) -> tuple[str, int, tuple[int, ...]]: ...
374374
def call_cdeclfunction(address: int, arguments: tuple[Any, ...], /) -> Any: ...
375375
def call_function(address: int, arguments: tuple[Any, ...], /) -> Any: ...
376+
377+
# dllist() is available on Linux and other platforms like NetBSD
378+
if sys.version_info >= (3, 15) and sys.platform != "win32" and sys.platform != "darwin":
379+
def dllist() -> list[str]: ...

stdlib/asyncio/protocols.pyi

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,9 @@ class BufferedProtocol(BaseProtocol):
2727
class DatagramProtocol(BaseProtocol):
2828
__slots__ = ()
2929
def connection_made(self, transport: transports.DatagramTransport) -> None: ... # type: ignore[override]
30-
# addr can be a tuple[int, int] for some unusual protocols like socket.AF_NETLINK.
31-
# Use tuple[str | Any, int] to not cause typechecking issues on most usual cases.
32-
# This could be improved by using tuple[AnyOf[str, int], int] if the AnyOf feature is accepted.
33-
# See https://github.com/python/typing/issues/566
34-
def datagram_received(self, data: bytes, addr: tuple[str | Any, int]) -> None: ...
30+
# addr is a tuple[str, int] for IPv4 or tuple[str, int, int, int] for IPv6.
31+
# It can also be a tuple[int, int] for unusual protocols like socket.AF_NETLINK.
32+
def datagram_received(self, data: bytes, addr: tuple[Any, ...]) -> None: ...
3533
def error_received(self, exc: Exception) -> None: ...
3634

3735
class SubprocessProtocol(BaseProtocol):

stdlib/tkinter/__init__.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3905,7 +3905,7 @@ class OptionMenu(Menubutton):
39053905
variable: StringVar,
39063906
value: str,
39073907
*values: str,
3908-
command: Callable[[StringVar], object] | None = ...,
3908+
command: Callable[[str], object] | None = ...,
39093909
name: str | None = None,
39103910
) -> None: ...
39113911
else:
@@ -3916,7 +3916,7 @@ class OptionMenu(Menubutton):
39163916
variable: StringVar,
39173917
value: str,
39183918
*values: str,
3919-
command: Callable[[StringVar], object] | None = ...,
3919+
command: Callable[[str], object] | None = ...,
39203920
) -> None: ...
39213921
# configure, config, cget are inherited from Menubutton
39223922
# destroy and __getitem__ are overridden, signature does not change

stubs/Authlib/authlib/oauth2/client.pyi

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,16 @@ class OAuth2Client:
6262
def refresh_token(self, url=None, refresh_token=None, body: str = "", auth=None, headers=None, **kwargs): ...
6363
def ensure_active_token(self, token=None): ...
6464
def revoke_token(self, url, token=None, token_type_hint=None, body=None, auth=None, headers=None, **kwargs): ...
65-
def introspect_token(self, url, token=None, token_type_hint=None, body=None, auth=None, headers=None, **kwargs): ...
65+
def introspect_token(
66+
self,
67+
url: str,
68+
token: str | None = None,
69+
token_type_hint: str | None = None,
70+
body: str | None = None,
71+
auth=None,
72+
headers=None,
73+
**kwargs,
74+
): ...
6675
def register_compliance_hook(self, hook_type, hook) -> None: ...
6776
def parse_response_token(self, resp): ...
6877
def __del__(self) -> None: ...

stubs/WebOb/METADATA.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
version = "1.8.*"
1+
version = "~=1.8.11"
22
upstream-repository = "https://github.com/Pylons/webob"

stubs/WebOb/webob/util.pyi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ from collections.abc import Callable
22
from typing import AnyStr
33

44
def html_escape(s: object) -> str: ...
5+
def urljoin(base: str, url: str | None) -> str: ...
56
def header_docstring(header: str, rfc_section: str) -> str: ...
67
def warn_deprecation(text: str, version: str, stacklevel: int) -> None: ...
78

0 commit comments

Comments
 (0)