Skip to content

Commit 101602b

Browse files
authored
Merge branch 'main' into 694-woodruff-dpo
2 parents bdbc533 + 1292ca3 commit 101602b

7 files changed

Lines changed: 78 additions & 17 deletions

File tree

peps/pep-0011.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ aarch64-apple-darwin clang
8383
aarch64-unknown-linux-gnu glibc, gcc
8484
i686-pc-windows-msvc
8585
x86_64-pc-windows-msvc
86-
x86_64-apple-darwin BSD libc, clang
8786
x86_64-unknown-linux-gnu glibc, gcc
8887
========================= =====
8988

@@ -103,6 +102,7 @@ Target Triple Notes Contacts
103102
============================= ========================== ========
104103
aarch64-unknown-linux-gnu glibc, clang Victor Stinner, Gregory P. Smith
105104
wasm32-unknown-wasip1 WASI SDK, Wasmtime Brett Cannon, Michael Droettboom
105+
x86_64-apple-darwin macOS, clang Sam Gross, Barry Warsaw, Ronald Oussoren
106106
x86_64-unknown-linux-gnu glibc, clang Victor Stinner, Gregory P. Smith
107107
============================= ========================== ========
108108

@@ -123,7 +123,7 @@ aarch64-linux-android Russell Keith-Magee
123123
aarch64-pc-windows-msvc Steve Dower
124124
arm64-apple-ios iOS on device Russell Keith-Magee, Ned Deily
125125
arm64-apple-ios-simulator iOS on M1 macOS simulator Russell Keith-Magee, Ned Deily
126-
armv7l-unknown-linux-gnueabihf Raspberry Pi OS, glibc, gcc Gregory P. Smith
126+
armv7l-unknown-linux-gnueabihf 32-bit Raspberry Pi OS, gcc Gregory P. Smith
127127
powerpc64le-unknown-linux-gnu glibc, clang Victor Stinner
128128

129129
glibc, gcc Victor Stinner

peps/pep-0503.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ Created: 04-Sep-2015
1010
Post-History: 04-Sep-2015
1111
Resolution: https://mail.python.org/pipermail/distutils-sig/2015-September/026899.html
1212

13+
.. canonical-pypa-spec:: :ref:`packaging:simple-repository-api`
14+
1315

1416
Abstract
1517
========

peps/pep-0691.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ Created: 04-May-2022
1313
Post-History: `05-May-2022 <https://discuss.python.org/t/pep-691-json-based-simple-api-for-python-package-indexes/15553>`__
1414
Resolution: https://discuss.python.org/t/pep-691-json-based-simple-api-for-python-package-indexes/15553/70
1515

16+
.. canonical-pypa-spec:: :ref:`packaging:simple-repository-api`
17+
1618

1719
Abstract
1820
========

peps/pep-0728.rst

Lines changed: 40 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@ Title: TypedDict with Typed Extra Items
33
Author: Zixuan James Li <p359101898@gmail.com>
44
Sponsor: Jelle Zijlstra <jelle.zijlstra@gmail.com>
55
Discussions-To: https://discuss.python.org/t/pep-728-typeddict-with-typed-extra-items/45443
6-
Status: Draft
6+
Status: Accepted
77
Type: Standards Track
88
Topic: Typing
99
Created: 12-Sep-2023
1010
Python-Version: 3.15
1111
Post-History: `09-Feb-2024 <https://discuss.python.org/t/pep-728-typeddict-with-typed-extra-items/45443>`__,
12+
Resolution: `15-Aug-2025 <https://discuss.python.org/t/pep-728-typeddict-with-typed-extra-items/45443/159>`__
1213

1314

1415
Abstract
@@ -123,6 +124,24 @@ Given the usage of pre-:pep:`692` type annotation for ``**kwargs`` in existing
123124
codebases, it will be valuable to accept and type extra items on TypedDict so
124125
that the old typing behavior can be supported in combination with ``Unpack``.
125126

127+
Previous Discussions
128+
--------------------
129+
130+
The new features introduced in this PEP would address several long-standing feature
131+
requests in the type system. Previous discussions include:
132+
133+
- `Mypy issue <https://github.com/python/mypy/issues/7981>`__ asking for a "final TypedDict"
134+
(2019). While the discussion focuses on the ``@final`` decorator, the underlying feature request
135+
would be addressed by this PEP.
136+
- `Mailing list thread <https://mail.python.org/archives/list/typing-sig@python.org/thread/66RITIHDQHVTUMJHH2ORSNWZ6DOPM367/>`__
137+
asking for a way to say that a ``TypedDict`` can contain arbitrary extra keys (2020).
138+
- `Discussion <https://discuss.python.org/t/pep-692-using-typeddict-for-more-precise-kwargs-typing/17314/87>`__
139+
about an extension of the ``Unpack`` mechanism introduced by :pep:`692` (2023).
140+
- `PEP 705 <https://discuss.python.org/t/pep-705-typeddict-read-only-and-other-keys/36457>`__ in an earlier
141+
draft proposed a similar feature (2023); it was removed to keep that PEP simpler.
142+
- `Discussion <https://discuss.python.org/t/do-we-want-an-exact-typeddict-if-so-how-final-extras-never/44418>`__
143+
about an "exact" ``TypedDict`` (2024).
144+
126145
Rationale
127146
=========
128147

@@ -317,7 +336,7 @@ extra items::
317336
name: str
318337

319338
def f(movie: Movie) -> None:
320-
del movie["name"] # Not OK. The value type of 'name' is 'Required[int]'
339+
del movie["name"] # Not OK. The value type of 'name' is 'Required[str]'
321340
del movie["year"] # OK. The value type of 'year' is 'NotRequired[int]'
322341

323342
Interaction with ``Unpack``
@@ -708,8 +727,8 @@ with signatures matching ``dict[str, VT]``
708727
reveal_type(not_required_num_dict.popitem()) # OK. Revealed type is 'tuple[str, int]'
709728

710729
def f(not_required_num_dict: IntDictWithNum, key: str):
711-
not_required_num_dict[key] = 42 # OK
712-
del not_required_num_dict[key] # OK
730+
not_required_num_dict[key] = 42 # OK
731+
del not_required_num_dict[key] # OK
713732

714733
:ref:`Notes on indexed accesses <pep728-type-narrowing>` from the previous section
715734
still apply.
@@ -723,7 +742,7 @@ because such dict can be a subtype of dict::
723742
def f(might_not_be_a_builtin_dict: dict[str, int]):
724743
int_dict: IntDict = might_not_be_a_builtin_dict # Not OK
725744

726-
not_a_builtin_dict: CustomDict = {"num": 1}
745+
not_a_builtin_dict = CustomDict({"num": 1})
727746
f(not_a_builtin_dict)
728747

729748
Runtime behavior
@@ -747,12 +766,22 @@ valid definition that indicates all extra items must be ``None``.)
747766
How to Teach This
748767
=================
749768

750-
The choice of the spelling ``"extra_items"`` is intended to make this
751-
feature more understandable to new users compared to shorter alternatives like
752-
``"extra"``.
753-
754-
Details of this should be documented in both the typing spec and the
755-
:mod:`typing` documentation.
769+
The new features introduced in this PEP can be taught together with the concept
770+
of inheritance as it applies to ``TypedDict``. A possible outline could be:
771+
772+
- Basics of ``TypedDict``: a ``dict`` with a fixed set of keys and value types.
773+
- ``NotRequired``, ``Required``, and ``total=False``: keys that may be missing.
774+
- ``ReadOnly``: keys that cannot be modified.
775+
- Inheritance: subclasses can add new keys. As a corollary, a value of a ``TypedDict``
776+
type may contain additional keys at runtime that are not specified in the type.
777+
- ``closed=True``: disallowing additional keys and restricting inheritance.
778+
- ``extra_items=VT``: allowing additional keys with a specified value type.
779+
780+
The concept of a closed ``TypedDict`` should also be cross-referenced in documentation
781+
for related concepts. For example, type narrowing with the ``in`` operator works
782+
differently, perhaps more intuitively, with closed ``TypedDict`` types. In addition, when ``Unpack``
783+
is used for keyword arguments, a closed ``TypedDict`` can be useful to restrict the
784+
allowed keyword arguments.
756785

757786
Backwards Compatibility
758787
=======================

peps/pep-0750.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Author: Jim Baker <jim.baker@python.org>,
77
Lysandros Nikolaou <lisandrosnik@gmail.com>,
88
Dave Peck <davepeck@davepeck.org>
99
Discussions-To: https://discuss.python.org/t/71594
10-
Status: Accepted
10+
Status: Final
1111
Type: Standards Track
1212
Created: 08-Jul-2024
1313
Python-Version: 3.14
@@ -17,6 +17,9 @@ Post-History: `09-Aug-2024 <https://discuss.python.org/t/60408>`__,
1717
`18-Nov-2024 <https://discuss.python.org/t/71594>`__,
1818
Resolution: `10-Apr-2025 <https://discuss.python.org/t/71594/130>`__
1919

20+
.. canonical-doc:: :ref:`py3.14:template-strings`
21+
22+
2023
Abstract
2124
========
2225

peps/pep-0772.rst

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,9 @@ Code of Conduct
313313
All Packaging Council Electors and Packaging Council members are subject to, and must abide by the
314314
PSF `Code of Conduct`_, its enforcement procedures, and its remedies for adjudicated violations.
315315

316+
The Packaging Council will moderate its spaces and support PSF Code of Conduct enforcement as
317+
appropriate in the area.
318+
316319
.. _electors:
317320

318321
==========================
@@ -444,7 +447,15 @@ This PEP likely requires an atypical approval process, given the parties that mu
444447
end, the authors will submit this PEP
445448

446449
#. for a vote with the PSF Board, which must approve the linking of Packaging Council Electors to
447-
the PSF Membership, and the deactivation of the Packaging Workgroup
450+
the PSF Membership, and the deactivation of the Packaging Workgroup.
451+
452+
- **RESOLVED** that the Python Software Foundation authorises the creation of a Packaging Council
453+
as described in the draft of PEP 772 as published on 25 July 2025, conditional on the PEP
454+
authors adding language to PEP 772 that explicitly gives the Packaging Council the authority to
455+
enforce the PSF Code of Conduct, in addition to enforcement mechanisms otherwise approved by
456+
the Foundation.
457+
- Requested language added in `PR 4550 <https://github.com/python/peps/pull/4550/files>`_.
458+
448459
#. for a vote on the pypa-committers mailing list, in accordance with the process outlined in
449460
:pep:`609`
450461
#. for formal approval by the Python Steering Council

peps/pep-0800.rst

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,18 @@ use CPython's behavior to determine when to use the ``@disjoint_base`` decorator
190190
add support for alternative implementations (for example, branching on the value of :py:data:`sys.implementation.name <sys.implementation>`),
191191
stubs could condition the presence of the ``@disjoint_base`` decorator on the implementation where necessary.
192192

193-
Similarly, the exact set of classes that are disjoint bases at runtime may change in future versions of Python.
193+
Although the concept of "disjoint bases" (referred to as "solid bases") in the CPython implementation has existed
194+
for decades, the rules for deciding which classes are disjoint bases have occasionally changed.
195+
Before Python 3.12, adding a ``__dict__`` or support for weakrefs relative to the base class could make a
196+
class a disjoint base. In practice, this often meant that Python-implemented classes inheriting from
197+
classes implemented in C, such as :func:`~collections.namedtuple` classes, were themselves disjoint bases.
198+
This behavior was changed in Python 3.12 by
199+
`python/cpython#96028 <https://github.com/python/cpython/pull/96028>`__.
200+
This PEP focuses on supporting the behavior of Python 3.12 and later, which is simpler and easier to understand.
201+
Type checkers may choose to implement a version of the pre-3.12 behavior if they wish, but doing this correctly
202+
requires information that is not currently available in the type system.
203+
204+
The exact set of classes that are disjoint bases at runtime may change again in future versions of Python.
194205
If this were to happen, the type stubs used by type checkers could be updated to reflect this new reality.
195206
In other words, this PEP adds the concept of disjoint bases to the type system, but it does not prescribe exactly
196207
which classes are disjoint bases.
@@ -360,7 +371,10 @@ explain to users why type checkers treat certain branches as unreachable.
360371
Reference Implementation
361372
========================
362373

363-
None yet.
374+
The runtime implementation of the ``@disjoint_base`` decorator will be available in
375+
typing-extensions 4.15.0.
376+
`python/mypy#19678 <https://github.com/python/mypy/pull/19678>`__
377+
implements support for disjoint bases in mypy and in the stubtest tool.
364378

365379
Appendix
366380
========

0 commit comments

Comments
 (0)