Skip to content

Commit fe5b74d

Browse files
authored
Merge branch 'main' into default-extras-pep
2 parents e834905 + 431e500 commit fe5b74d

File tree

12 files changed

+1290
-1209
lines changed

12 files changed

+1290
-1209
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ venv:
6666
else \
6767
echo "Creating venv in $(VENVDIR)"; \
6868
if $(UV) --version >/dev/null 2>&1; then \
69-
$(UV) venv $(VENVDIR); \
69+
$(UV) venv --python=$(PYTHON) $(VENVDIR); \
7070
VIRTUAL_ENV=$(VENVDIR) $(UV) pip install -r $(REQUIREMENTS); \
7171
else \
7272
$(PYTHON) -m venv $(VENVDIR); \

peps/pep-0011.rst

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,16 @@ Tier 1
7777
platforms, working.
7878
- Failures on these platforms **block a release**.
7979

80-
======================== =====
81-
Target Triple Notes
82-
======================== =====
83-
aarch64-apple-darwin clang
80+
========================= =====
81+
Target Triple Notes
82+
========================= =====
83+
aarch64-apple-darwin clang
84+
aarch64-unknown-linux-gnu glibc, gcc
8485
i686-pc-windows-msvc
8586
x86_64-pc-windows-msvc
86-
x86_64-apple-darwin BSD libc, clang
87-
x86_64-unknown-linux-gnu glibc, gcc
88-
======================== =====
87+
x86_64-apple-darwin BSD libc, clang
88+
x86_64-unknown-linux-gnu glibc, gcc
89+
========================= =====
8990

9091

9192
Tier 2
@@ -101,9 +102,7 @@ Tier 2
101102
============================= ========================== ========
102103
Target Triple Notes Contacts
103104
============================= ========================== ========
104-
aarch64-unknown-linux-gnu glibc, gcc Petr Viktorin, Victor Stinner
105-
106-
glibc, clang Victor Stinner, Gregory P. Smith
105+
aarch64-unknown-linux-gnu glibc, clang Victor Stinner, Gregory P. Smith
107106
wasm32-unknown-wasip1 WASI SDK, Wasmtime Brett Cannon, Eric Snow
108107
x86_64-unknown-linux-gnu glibc, clang Victor Stinner, Gregory P. Smith
109108
============================= ========================== ========

peps/pep-0735.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@ Author: Stephen Rosen <[email protected]>
44
Sponsor: Brett Cannon <[email protected]>
55
PEP-Delegate: Paul Moore <[email protected]>
66
Discussions-To: https://discuss.python.org/t/39233
7-
Status: Accepted
7+
Status: Final
88
Type: Standards Track
99
Topic: Packaging
1010
Created: 20-Nov-2023
1111
Post-History: `14-Nov-2023 <https://discuss.python.org/t/29684>`__, `20-Nov-2023 <https://discuss.python.org/t/39233>`__
1212
Resolution: `10-Oct-2024 <https://discuss.python.org/t/39233/312>`__
1313

14+
.. canonical-pypa-spec:: :ref:`packaging:dependency-groups`
15+
1416

1517
Abstract
1618
========

peps/pep-0739.rst

Lines changed: 25 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,25 @@ below, which is rendered in an human-readable format here.
115115
* - Required
116116
- **True**
117117

118+
``base_interpreter``
119+
--------------------
120+
121+
.. list-table::
122+
:widths: 25 75
123+
124+
* - Type
125+
- ``string``
126+
* - Description
127+
- The path to the Python interprer of the base installation.
128+
Either an absolute path, or a relative path to the path defined
129+
in the ``base_prefix`` key.
130+
* - Examples
131+
- - ``/usr/bin/python``
132+
- ``bin/python``
133+
- etc.
134+
* - Required
135+
- **False**
136+
118137
``base_prefix``
119138
---------------
120139

@@ -376,42 +395,6 @@ below, which is rendered in an human-readable format here.
376395
* - Required
377396
- **True**
378397

379-
``interpreter``
380-
---------------
381-
382-
.. list-table::
383-
:widths: 25 75
384-
385-
* - Type
386-
- ``object``
387-
* - Description
388-
- Object containing details Python interpreter.
389-
390-
This section MUST be present if the Python installation provides
391-
an interpreter binary, otherwise this section will be missing.
392-
* - Required
393-
- **False**
394-
* - Additional properties
395-
- **Not allowed**
396-
397-
``interpreter.path``
398-
~~~~~~~~~~~~~~~~~~~~
399-
400-
.. list-table::
401-
:widths: 25 75
402-
403-
* - Type
404-
- ``string``
405-
* - Description
406-
- The path to the Python interprer. Either an absolute path, or a
407-
relative path to the path defined in the ``base_prefix`` key.
408-
* - Examples
409-
- - ``/usr/bin/python``
410-
- ``bin/python``
411-
- etc.
412-
* - Required
413-
- **True**
414-
415398
``abi``
416399
-------
417400

@@ -568,8 +551,10 @@ below, which is rendered in an human-readable format here.
568551
defined in the ``base_prefix`` key.
569552

570553
This field MUST be present if the Python installation provides a
571-
dynamic ``libpython`` library, otherwise this entry will be
572-
missing.
554+
dynamic ``libpython`` library targetting the Stable ABI,
555+
otherwise this entry will be missing.
556+
557+
If this key is present ``dynamic`` MUST also be set.
573558
* - Examples
574559
- - ``/usr/lib/libpython3.so``
575560
- ``lib/libpython3.so``
@@ -600,8 +585,8 @@ below, which is rendered in an human-readable format here.
600585
* - Required
601586
- **False**
602587

603-
``libpython.link_to_libpython``
604-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
588+
``libpython.link_extensions``
589+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
605590

606591
.. list-table::
607592
:widths: 25 75

peps/pep-0739/example.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"schema_version": "1.0",
3+
"base_interpreter": "/usr/bin/python",
34
"base_prefix": "/usr",
45
"platform": "linux-x86_64",
56
"language": {
@@ -25,9 +26,6 @@
2526
"cache_tag": "cpython-314",
2627
"_multiarch": "x86_64-linux-gnu"
2728
},
28-
"interpreter": {
29-
"path": "/usr/bin/python"
30-
},
3129
"abi": {
3230
"flags": ["t", "d"],
3331
"extension_suffix": ".cpython-314-x86_64-linux-gnu.so",
@@ -44,7 +42,7 @@
4442
"dynamic": "/usr/lib/libpython3.14.so.1.0",
4543
"dynamic_stableabi": "/usr/lib/libpython3.so",
4644
"static": "/usr/lib/python3.14/config-3.14-x86_64-linux-gnu/libpython3.14.a",
47-
"link_to_libpython": true
45+
"link_extensions": true
4846
},
4947
"c_api": {
5048
"headers": "/usr/include/python3.14",

peps/pep-0739/python-build-info-v1.0.schema.json

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,14 @@
1616
"description": "Schema version.\n\nThis is a string following the format ``<MAJOR>.<MINOR>``, where ``<MAJOR>`` and ``<MINOR>`` are unpaded numbers and represent the **major** and **minor** components of the version. Versions may be arithmetic compared by intrepreting the version string as a decimal number.\n\nFor this specification version, this value is constant and MUST be ``1.0``.\n\nFuture versions of this schema MUST use a higher version number. Future versions of this schema MUST NOT use the same **major** version component as other schema version unless its specification is deemed backwards-compatible with them — it can't change, or extend, any parts of the current specification in such a way as the semantics of the interpreted data differ, or that data valid under the new specification is invalid under the older specification, with the exception of additional properties (errors caused by ``additionalProperties``).",
1717
"const": "1.0"
1818
},
19+
"base_interpreter": {
20+
"type": "string",
21+
"description": "The path to the Python interprer of the base installation. Either an absolute path, or a relative path to the path defined in the ``base_prefix`` key.",
22+
"examples": [
23+
"/usr/bin/python",
24+
"bin/python"
25+
]
26+
},
1927
"base_prefix": {
2028
"type": "string",
2129
"description": "Base prefix of the Python installation.\n\nEither an absolute path, or a relative path to directory where this file is contained.",
@@ -137,24 +145,6 @@
137145
}
138146
}
139147
},
140-
"interpreter": {
141-
"type": "object",
142-
"description": "Object containing details Python interpreter.\n\nThis section MUST be present if the Python installation provides an interpreter binary, otherwise this section will be missing.",
143-
"required": [
144-
"path"
145-
],
146-
"additionalProperties": false,
147-
"properties": {
148-
"path": {
149-
"type": "string",
150-
"description": "The path to the Python interprer. Either an absolute path, or a relative path to the path defined in the ``base_prefix`` key.",
151-
"examples": [
152-
"/usr/bin/python",
153-
"bin/python"
154-
]
155-
}
156-
}
157-
},
158148
"abi": {
159149
"type": "object",
160150
"description": "Object containing details related to ABI.",
@@ -216,7 +206,7 @@
216206
},
217207
"dynamic_stableabi": {
218208
"type": "string",
219-
"description": "The path to the dynamic ``libpython`` library for the stable ABI. Either an absolute path, or a relative path to the path defined in the ``base_prefix`` key.\n\nThis field MUST be present if the Python installation provides a dynamic ``libpython`` library, otherwise this entry will be missing.",
209+
"description": "The path to the dynamic ``libpython`` library for the stable ABI. Either an absolute path, or a relative path to the path defined in the ``base_prefix`` key.\n\nThis field MUST be present if the Python installation provides a dynamic ``libpython`` library targetting the Stable ABI, otherwise this entry will be missing.\n\nIf this key is present ``dynamic`` MUST also be set.",
220210
"examples": [
221211
"/usr/lib/libpython3.so",
222212
"lib/libpython3.so"
@@ -230,7 +220,7 @@
230220
"lib/python3.14/config-3.14-x86_64-linux-gnu/libpython3.14.a"
231221
]
232222
},
233-
"link_to_libpython": {
223+
"link_extensions": {
234224
"type": "boolean",
235225
"description": "Should extensions built against a dynamic ``libpython`` link to it?\n\nThis field MUST be present if the Python installation provides a dynamic ``libpython`` library, otherwise this entry will be missing."
236226
}

peps/pep-0745.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ Actual:
3939
- 3.14.0 alpha 1: Tuesday, 2024-10-15
4040
- 3.14.0 alpha 2: Tuesday, 2024-11-19
4141
- 3.14.0 alpha 3: Tuesday, 2024-12-17
42+
- 3.14.0 alpha 4: Tuesday, 2025-01-14
4243

4344
Expected:
4445

45-
- 3.14.0 alpha 4: Tuesday, 2025-01-14
4646
- 3.14.0 alpha 5: Tuesday, 2025-02-11
4747
- 3.14.0 alpha 6: Friday, 2025-03-14
4848
- 3.14.0 alpha 7: Tuesday, 2025-04-08

peps/pep-0747.rst

Lines changed: 39 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -243,10 +243,16 @@ be assignable to ``TypeForm``::
243243

244244
v5: TypeForm[set[str]] = "set[str]" # OK
245245

246+
The typing spec defines syntactic rules for type expressions in the form of a
247+
:ref:`formal grammar <typing:expression-grammar>`. Semantic rules are specified
248+
as comments along with the grammar definition. Contextual requirements are detailed
249+
throughout the typing spec in sections that discuss concepts that appear within
250+
type expressions. For example, the special form ``Self`` can be used in a
251+
type expression only within a class, and a type variable can be used within
252+
a type expression only when it is associated with a valid scope.
253+
246254
Expressions that violate one or more of the syntactic, semantic, or contextual
247-
rules for type expressions should not evaluate to a ``TypeForm`` type. The rules
248-
for type expression validity are explained in detail within the typing spec, so
249-
they are not repeated here::
255+
rules for type expressions should not evaluate to a ``TypeForm`` type.::
250256

251257
bad1: TypeForm = tuple() # Error: Call expression not allowed in type expression
252258
bad2: TypeForm = (1, 2) # Error: Tuple expression not allowed in type expression
@@ -300,14 +306,6 @@ Assignability
300306
t1: TypeForm[int | str] = get_type_form() # OK
301307
t2: TypeForm[str] = get_type_form() # Error
302308

303-
``type[T]`` is a subtype of ``TypeForm[T]``, which means that ``type[B]`` is
304-
assignable to ``TypeForm[A]`` if ``B`` is assignable to ``A``::
305-
306-
def get_type() -> type[int]: ...
307-
308-
t3: TypeForm[int | str] = get_type() # OK
309-
t4: TypeForm[str] = get_type() # Error
310-
311309
``TypeForm`` is a subtype of ``object`` and is assumed to have all of the
312310
attributes and methods of ``object``.
313311

@@ -532,6 +530,35 @@ of ``type``.
532530
.. _designed: https://mail.python.org/archives/list/[email protected]/message/D5FHORQVPHX3BHUDGF3A3TBZURBXLPHD/
533531

534532

533+
Treat ``type[T]`` as a subtype of ``TypeForm[T]``
534+
-------------------------------------------------
535+
536+
It was suggested that type ``type[T]`` should be considered a subtype
537+
of ``TypeForm[T]``. This was ultimately rejected because there are ways to
538+
create an object of type ``type[T]`` that does not encode a valid type expression.
539+
For example, the expression ``type[1]`` is not a valid type expression. Likewise,
540+
the expression ``type[S]`` is not a valid type expression if ``S`` is an
541+
out-of-scope type variable. This same argument applies to other special forms
542+
like objects of type ``UnionType``, which may or may not encode a valid type
543+
expression. Rather than carving out a special case for ``type[T]`` that would
544+
allow for potential unsoundness, it was decided to treat all type forms
545+
consistently. Therefore, ``type[T]`` is not considered a subtype of ``TypeForm[T]``.
546+
547+
It was also pointed out that the expression ``C | C`` (where ``C`` is a class
548+
object) is a valid type expression - and therefore a valid ``TypeForm``,
549+
but its runtime type form encoding is an instance of ``UnionType`` and
550+
therefore is not compatible with ``type[C]``.
551+
552+
If a function wishes to indicate that it accepts values of type ``TypeForm[T]``
553+
_and_ ``type[T]``, the parameter can simply be annotated with a union of these
554+
two types.
555+
556+
::
557+
558+
def func[T](t: TypeForm[T] | type[T]) -> None: ...
559+
560+
561+
535562
Accept arbitrary annotation expressions
536563
---------------------------------------
537564

@@ -547,7 +574,7 @@ not as a parameter type or a return type:
547574

548575
def foo(not_reassignable: Final[object]): ... # Error: Final not allowed here
549576

550-
def nonsense() -> Final[object]: ... # Error: Final not alowed here
577+
def nonsense() -> Final[object]: ... # Error: Final not allowed here
551578

552579
With the exception of ``Annotated``, type qualifiers are not allowed in type
553580
expressions. ``TypeForm`` is limited to type expressions because its

0 commit comments

Comments
 (0)