Skip to content

Commit 9d0f1c4

Browse files
authored
Merge branch 'main' into configparser-default-section-none
2 parents 37d4e4b + 6cc14b4 commit 9d0f1c4

72 files changed

Lines changed: 1044 additions & 362 deletions

Some content is hidden

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

CONTRIBUTING.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,12 @@ when running stubtest. For example: `mypy-plugins = ["mypy_django_plugin.main"]`
235235
* `mypy-plugins-config` (default: `{}`): A dictionary mapping plugin names to their
236236
configuration dictionaries for use by mypy plugins. For example:
237237
`mypy-plugins-config = {"django-stubs" = {"django_settings_module" = "@tests.django_settings"}}`
238+
* `install-environment` (default: `{}`): A dictionary of environment variables
239+
to set while `pip install`ing the package and its dependencies for stubtest.
240+
Useful for packages that read build-time options from the environment, for
241+
example to disable CPU-specific compiler flags that do not survive CI's
242+
shared wheel cache. For example:
243+
`install-environment = { HNSWLIB_NO_NATIVE = "1" }`
238244

239245
`*-dependencies` are usually packages needed to `pip install` the implementation
240246
distribution.

lib/ts_utils/metadata.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ def _is_nested_dict(obj: object) -> TypeGuard[dict[str, dict[str, Any]]]:
5353
return isinstance(obj, dict) and all(isinstance(k, str) and isinstance(v, dict) for k, v in obj.items())
5454

5555

56+
def _is_dict_of_strings(obj: object) -> TypeGuard[dict[str, str]]:
57+
return isinstance(obj, dict) and all(isinstance(k, str) and isinstance(v, str) for k, v in obj.items())
58+
59+
5660
@functools.cache
5761
def get_oldest_supported_python() -> str:
5862
with PYPROJECT_PATH.open("rb") as config:
@@ -85,6 +89,7 @@ class StubtestSettings:
8589
stubtest_dependencies: list[str]
8690
mypy_plugins: list[str]
8791
mypy_plugins_config: dict[str, dict[str, Any]]
92+
install_environment: dict[str, str]
8893

8994
def system_requirements_for_platform(self, platform: str) -> list[str]:
9095
assert platform in _STUBTEST_PLATFORM_MAPPING, f"Unrecognised platform {platform!r}"
@@ -110,6 +115,7 @@ def read_stubtest_settings(distribution: str) -> StubtestSettings:
110115
stubtest_dependencies: object = data.get("stubtest-dependencies", [])
111116
mypy_plugins: object = data.get("mypy-plugins", [])
112117
mypy_plugins_config: object = data.get("mypy-plugins-config", {})
118+
install_environment: object = data.get("install-environment", {})
113119

114120
assert type(skip) is bool
115121
assert type(ignore_missing_stub) is bool
@@ -124,6 +130,7 @@ def read_stubtest_settings(distribution: str) -> StubtestSettings:
124130
assert _is_list_of_strings(stubtest_dependencies)
125131
assert _is_list_of_strings(mypy_plugins)
126132
assert _is_nested_dict(mypy_plugins_config)
133+
assert _is_dict_of_strings(install_environment)
127134

128135
unrecognised_platforms = set(ci_platforms) - _STUBTEST_PLATFORM_MAPPING.keys()
129136
assert not unrecognised_platforms, f"Unrecognised ci-platforms specified for {distribution!r}: {unrecognised_platforms}"
@@ -152,6 +159,7 @@ def read_stubtest_settings(distribution: str) -> StubtestSettings:
152159
stubtest_dependencies=stubtest_dependencies,
153160
mypy_plugins=mypy_plugins,
154161
mypy_plugins_config=mypy_plugins_config,
162+
install_environment=install_environment,
155163
)
156164

157165

@@ -227,6 +235,7 @@ def all_dependencies(self) -> list[Requirement]:
227235
"stubtest-dependencies",
228236
"mypy-plugins",
229237
"mypy-plugins-config",
238+
"install-environment",
230239
}
231240
}
232241
_DIST_NAME_RE: Final = re.compile(r"^[a-z0-9]([a-z0-9._-]*[a-z0-9])?$", re.IGNORECASE)

stdlib/configparser.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import sys
22
from _typeshed import BytesPath, GenericPath, MaybeNone, StrOrBytesPath, StrPath, SupportsWrite
3-
from collections.abc import Callable, ItemsView, Iterable, Iterator, Mapping, MutableMapping, Sequence
3+
from collections.abc import Callable, ItemsView, Iterable, Iterator, Mapping, MutableMapping, Sequence, ValuesView
44
from re import Pattern
55
from typing import Any, AnyStr, ClassVar, Final, Literal, TypeAlias, TypeVar, overload, type_check_only
66
from typing_extensions import deprecated
@@ -333,6 +333,7 @@ class RawConfigParser(_Parser):
333333
@overload
334334
def items(self, section: _SectionName, raw: bool = False, vars: _Section | None = None) -> list[tuple[str, str]]: ...
335335

336+
def values(self) -> ValuesView[SectionProxy]: ...
336337
def set(self, section: _SectionName, option: str, value: str | None = None) -> None: ...
337338
def write(self, fp: SupportsWrite[str], space_around_delimiters: bool = True) -> None: ...
338339
def remove_option(self, section: _SectionName, option: str) -> bool: ...

stdlib/sys/__init__.pyi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ excepthook: Callable[[type[BaseException], BaseException, TracebackType | None],
4242
exec_prefix: str
4343
executable: str
4444
float_repr_style: Literal["short", "legacy"]
45+
_framework: str # empty string on non-macOS platforms
4546
hexversion: int
4647
last_type: type[BaseException] | None
4748
last_value: BaseException | None

stubs/JACK-Client/METADATA.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ dependencies = ["numpy>=1.20", "types-cffi"]
55

66
[tool.stubtest]
77
# darwin and win32 are equivalent
8-
# TODO (2026-06-26): darwin temporarily disabled, see
9-
# https://github.com/python/typeshed/issues/15947
10-
ci-platforms = ["linux"]
8+
ci-platforms = ["darwin", "linux"]
119
apt-dependencies = ["libjack-dev"]
1210
brew-dependencies = ["jack"]
1311
# No need to install on the CI. Leaving here as information for Windows contributors.

stubs/braintree/braintree/search.pyi

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from _typeshed import Incomplete
2+
from typing import overload
23

34
class Search:
45
class IsNodeBuilder:
@@ -41,7 +42,12 @@ class Search:
4142
name: Incomplete
4243
whitelist: Incomplete
4344
def __init__(self, name, whitelist=[]) -> None: ...
44-
def in_list(self, *values): ...
45+
46+
@overload
47+
def in_list(self, value: list[str]) -> Search.Node: ...
48+
@overload
49+
def in_list(self, *values: str) -> Search.Node: ...
50+
4551
def __eq__(self, value): ...
4652

4753
class MultipleValueOrTextNodeBuilder(TextNodeBuilder, MultipleValueNodeBuilder):

stubs/docker/docker/models/containers.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class Container(Model):
2222
@property
2323
def image(self) -> Image | None: ...
2424
@property
25-
def labels(self): ...
25+
def labels(self) -> dict[str, str]: ...
2626
@property
2727
def status(self) -> str: ...
2828
@property

stubs/docutils/@tests/stubtest_allowlist.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ docutils.transforms.Transform.apply # method apply is not implemented
1414
docutils.transforms.Transform.__getattr__
1515
docutils.TransformSpec.unknown_reference_resolvers
1616
docutils.writers.latex2e.PreambleCmds... contents
17+
docutils.writers.latex2e.PreambleCmds.inline role \w+ # attribute names with spaces, set with setattr() from docutils.sty
1718

1819
# Files that don't exist at runtime of stubtests, raises ImportError:
1920
docutils.parsers.commonmark_wrapper

stubs/docutils/METADATA.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
version = "0.22.3"
1+
version = "0.23"
22
upstream-repository = "https://sourceforge.net/p/docutils/code"

stubs/docutils/docutils/core.pyi

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ from _typeshed import Incomplete, StrPath
22
from typing import Final
33
from typing_extensions import deprecated
44

5-
from docutils import SettingsSpec
6-
from docutils.io import FileInput, Input, Output
5+
from docutils import SettingsSpec, nodes
6+
from docutils.io import Input, Output
77
from docutils.parsers import Parser
88
from docutils.readers import Reader
99
from docutils.utils import SystemMessage
@@ -12,24 +12,24 @@ from docutils.writers import Writer, _WriterParts
1212
__docformat__: Final = "reStructuredText"
1313

1414
class Publisher:
15-
document: Incomplete | None
15+
document: nodes.document | None
1616
reader: Reader[Incomplete]
1717
parser: Parser
1818
writer: Writer[Incomplete]
1919
source: Input[Incomplete]
20-
source_class: Incomplete
20+
source_class: type[Input[Incomplete]]
2121
destination: Output | None
22-
destination_class: Incomplete
22+
destination_class: type[Output]
2323
settings: dict[str, Incomplete]
2424
def __init__(
2525
self,
2626
reader: Reader[Incomplete] | None = None,
2727
parser: Parser | None = None,
2828
writer: Writer[Incomplete] | None = None,
2929
source: Input[Incomplete] | None = None,
30-
source_class=...,
30+
source_class: type[Input[Incomplete]] = ...,
3131
destination: Output | None = None,
32-
destination_class=...,
32+
destination_class: type[Output] = ...,
3333
settings: dict[str, Incomplete] | None = None,
3434
) -> None: ...
3535
def set_reader(self, reader: str, parser: Parser | None = None, parser_name: str | None = None) -> None: ...
@@ -129,7 +129,7 @@ def publish_string(
129129
def publish_parts(
130130
source,
131131
source_path: StrPath | None = None,
132-
source_class=...,
132+
source_class: type[Input[Incomplete]] = ...,
133133
destination_path: StrPath | None = None,
134134
reader=None,
135135
reader_name: str | None = None,
@@ -146,7 +146,7 @@ def publish_parts(
146146
def publish_doctree(
147147
source,
148148
source_path: StrPath | None = None,
149-
source_class=...,
149+
source_class: type[Input[Incomplete]] = ...,
150150
reader=None,
151151
reader_name: str | None = None,
152152
parser=None,
@@ -185,13 +185,13 @@ def publish_cmdline_to_binary(
185185
usage: str = "%prog [options] [<source> [<destination>]]",
186186
description: str = ...,
187187
destination=None,
188-
destination_class=...,
188+
destination_class: type[Output] = ...,
189189
): ...
190190
def publish_programmatically(
191-
source_class: type[FileInput],
191+
source_class: type[Input[Incomplete]],
192192
source,
193193
source_path: StrPath | None,
194-
destination_class,
194+
destination_class: type[Output],
195195
destination,
196196
destination_path: StrPath | None,
197197
reader,

0 commit comments

Comments
 (0)