Skip to content

Commit d8fe8d1

Browse files
authored
Merge branch 'main' into pagefind-search
2 parents e88877e + 39375d2 commit d8fe8d1

12 files changed

Lines changed: 3222 additions & 153 deletions

File tree

.github/CODEOWNERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -692,6 +692,8 @@ peps/pep-0811.rst @sethmlarson @gpshead
692692
peps/pep-0814.rst @vstinner @corona10
693693
peps/pep-0815.rst @emmatyping
694694
peps/pep-0816.rst @brettcannon
695+
peps/pep-0817.rst @warsaw @dstufft
696+
peps/pep-0817/ @warsaw @dstufft
695697
# ...
696698
peps/pep-0819.rst @emmatyping
697699
peps/pep-0820.rst @encukou

README.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ Shortcut redirects are also available.
2020
For example, ``https://peps.python.org/8`` redirects to the canonical link.
2121

2222

23+
API
24+
===
25+
26+
Several data files are available at https://peps.python.org/api/
27+
28+
2329
Contributing to PEPs
2430
====================
2531

pep_sphinx_extensions/pep_processor/html/pep_html_builder.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ def get_doc_context(self, docname: str, body: str, _metatags: str) -> dict:
3333
toc_tree = self.env.tocs[docname].deepcopy()
3434
if len(toc_tree) and len(toc_tree[0]) > 1:
3535
toc_tree = toc_tree[0][1] # don't include document title
36-
del toc_tree[0] # remove contents node
36+
if docname.startswith("pep-"):
37+
del toc_tree[0] # remove contents node from PEPs
3738
for node in toc_tree.findall(nodes.reference):
3839
node["refuri"] = node["anchorname"] or '#' # fix targets
3940
toc = self.render_partial(toc_tree)["fragment"]

peps/api/index.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,3 +207,9 @@ for example:
207207
]
208208
}
209209
}
210+
211+
release-schedule.ics
212+
--------------------
213+
214+
An iCalendar file of Python release dates is available at
215+
https://peps.python.org/api/release-schedule.ics.

peps/pep-0011.rst

Lines changed: 72 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Post-History: `18-Aug-2007 <https://mail.python.org/archives/list/python-dev@pyt
99
`14-May-2014 <https://mail.python.org/archives/list/python-dev@python.org/thread/T7WTUJ6TD3IGYGWV3M4PHJWNLM2WPZAW/>`__,
1010
`20-Feb-2015 <https://mail.python.org/archives/list/python-dev@python.org/thread/OEQHRR2COYZDL6LZ42RBZOMIUB32WI34/>`__,
1111
`10-Mar-2022 <https://mail.python.org/archives/list/python-committers@python.org/thread/K757345KX6W5ZLTWYBUXOXQTJJTL7GW5/>`__,
12+
`21-Nov-2025 <https://discuss.python.org/t/104986>`__,
1213

1314

1415
Abstract
@@ -35,15 +36,20 @@ unmaintainability: without having experts for a large number of
3536
platforms, it is not possible to determine whether a certain
3637
change to the CPython source code will work on all supported
3738
platforms.
38-
3939
To reduce this risk, this PEP specifies what is required for a
40-
platform to be considered supported by CPython as well as providing a
41-
procedure to remove code for platforms with few or no CPython
42-
users.
40+
platform to be considered supported by the CPython core team,
41+
as well as providing a procedure to remove code for platforms
42+
with few or no CPython users.
43+
44+
On the other hand, allowing these fragments in the main repository
45+
can promote collaboration, can help identify non-portable parts of
46+
the code base, and is necessary for bootstrapping support for
47+
a "new" platform.
48+
This PEP specifies what it means for a platform to be "unsupported",
49+
and how the core team handles code for such platforms.
4350

44-
This PEP also lists what platforms *are* supported by the CPython
45-
interpreter. This lets people know what platforms are directly
46-
supported by the CPython development team.
51+
This PEP also explicitly lists what platforms are directly
52+
*supported* by the CPython development team.
4753

4854

4955
Support tiers
@@ -135,17 +141,43 @@ x86_64-unknown-freebsd BSD libc, clang Victor Stinner
135141
================================ =========================== ========
136142

137143

138-
All other platforms
139-
-------------------
144+
Unsupported platforms
145+
---------------------
146+
147+
All platforms not listed in the above tiers are *unsupported* by the core team.
148+
The core team does not develop and test on such platforms, and so they
149+
cannot provide any promises that Python will work on them.
150+
151+
However, the code base does include unsupported code -- that is, code
152+
specific to unsupported platforms.
153+
Contributions in this area are welcome as long as they:
154+
155+
- pose a minimal maintenance burden to the core team, and
156+
- benefit substantially more people than the contributor.
157+
158+
We assume contributors are able to maintain modifications/patches,
159+
test patched builds, redistribute modified code, make promises to their users,
160+
and otherwise support "their" platform.
161+
With that in mind, it is generally unnecessary to backport unsupported
162+
fixes to CPython's maintenance branches.
163+
164+
Unsupported code that *does* cause a maintenance burden, or obstructs
165+
general improvements, may be rejected or removed from the code base
166+
without a deprecation process.
167+
Core team members that do this intentionally are encouraged to notify people
168+
listed in the `Platforms experts list`_ in the CPython contributor's guide,
169+
to review any submitted fixes (if unobtrusive), and to consider adding
170+
configuration or extension capabilities necessary for workarounds.
171+
172+
People interested in unsupported platforms may add themselves to the
173+
`Platforms experts list`_ to request that they be notified on issues
174+
related to "their" platform.
175+
There is, however, no formal guarantee that they *will* be notified.
140176

141-
Support for a platform may be partial within the code base, such as
142-
from active development around platform support or accidentally.
143-
Code changes to platforms not listed in the above tiers may be rejected
144-
or removed from the code base without a deprecation process if they
145-
cause a maintenance burden or obstruct general improvements.
177+
.. _Platforms experts list: https://devguide.python.org/core-team/experts/#platforms
146178

147-
Platforms not listed here may be supported by the wider Python
148-
community in some way. If your desired platform is not listed above,
179+
Platforms not listed in this PEP may also be supported by the wider Python
180+
community in other ways. If your desired platform is not listed above,
149181
please perform a search online to see if someone is already providing
150182
support in some form.
151183

@@ -207,6 +239,27 @@ source tree 3 years after the extended support for the compiler has
207239
ended (but continue to remain available in revision control).
208240

209241

242+
POSIX
243+
'''''
244+
245+
Features specified in POSIX are expected to work according to the standard.
246+
This cuts two ways:
247+
248+
- If a POSIX feature is available, it is expected to conform to POSIX.
249+
250+
Workarounds for out-of-spec platforms are acceptable.
251+
For unsupported platforms, disabling functionality is
252+
preferred over a non-trivial workaround.
253+
254+
- CPython should make no assumptions about POSIX features beyond what's
255+
specified in POSIX.
256+
257+
For example, while POSIX specifies ``errno`` as an ``int`` with no
258+
restrictions, error codes on all supported platforms happen to be positive.
259+
Relying on this would be considered a bug, even if it only manifests on
260+
unsupported platforms.
261+
262+
210263
Legacy C Locale
211264
'''''''''''''''
212265

@@ -373,6 +426,9 @@ No-longer-supported platforms
373426
Discussions
374427
===========
375428

429+
* November 2025: `Policy for unsupported platforms
430+
<https://discuss.python.org/t/104986>`_
431+
(Petr Viktorin)
376432
* April 2022: `Consider adding a Tier 3 to tiered platform support
377433
<https://mail.python.org/archives/list/python-committers@python.org/thread/V3OZPJGA5VJFYM6XYGPZIVPOIYKX6KTD/>`_
378434
(Victor Stinner)

peps/pep-0807.rst

Lines changed: 71 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ apply to all parts of this PEP's specification:
114114
clients **MUST** reject any URLs that do not meet this constraint.
115115

116116
In practice, this means that a discovery request to
117-
``https://upload.example.com/.well-known/pytp/{key}`` can only
117+
``https://upload.example.com/.well-known/pytp?discover={key}`` can only
118118
return URLs with the ``upload.example.com`` host.
119119

120120
* All client requests **SHOULD** have an
@@ -157,39 +157,57 @@ The discovery mechanism is as follows:
157157
For the above example, the path component is
158158
``/legacy/``.
159159

160-
3. The uploading client takes the SHA2-256 hash of the path component,
161-
producing the *discovery key*.
160+
3. The uploading client performs a query-safe URL encoding of the path component
161+
(i.e. percent-encoding as defined in :rfc:`3986`, including encoding
162+
of forward slashes and spaces), producing the *discovery key*.
162163

163164
For the above example, the discovery key is
164-
``0cace9579789849db6e16d48df183951c8f17582200d84bc93c7678d6c8f78a7``. [#fn-hash]_
165+
``%2Flegacy%2F``. [#fn-discovery-key]_
165166

166167
4. The uploading client constructs a *discovery URL* by taking the
167168
scheme and authority components (as defined in :rfc:`3986`)
168-
of the upload URL and appending ``/.well-known/pytp/``
169-
and the discovery key.
169+
of the upload URL and appending ``/.well-known/pytp`` as the path.
170+
Then, the uploading client appends the discovery key as the value
171+
of the ``discover`` query parameter.
170172

171173
For the above example, the discovery URL is
172-
``https://upload.example.com/.well-known/pytp/af030c06750716b1b35852298fe852b90def13dcbd012a5fe5148470f1206bfc``.
174+
``https://upload.example.com/.well-known/pytp?discover=%2Flegacy%2F``.
173175

174176
5. The uploading client performs an HTTP GET request to the discovery URL.
175177

176178
6. The server responds with a ``200 OK`` status code and a body
177179
containing a JSON object if the index supports Trusted Publishing
178-
for the given upload URL. The JSON object **MUST** contain the following
180+
for the given upload URL.
181+
182+
The JSON object **MUST** contain the following
179183
fields:
180184

181185
- ``audience-endpoint``: a string containing the URL of the OIDC
182186
audience endpoint to be used during token exchange.
183187
- ``token-mint-endpoint``: a string containing the URL of the
184188
token minting endpoint to be used during token exchange.
185189

190+
Additionally, the JSON object **MAY** contain the following fields:
191+
192+
- ``features``: an array of strings indicating optional features
193+
supported by the index's Trusted Publishing implementation.
194+
The set of possible features is defined under `<Feature Negotiation_>`__.
195+
196+
- ``default-features``: an array of strings indicating the default
197+
features used by the index's Trusted Publishing implementation
198+
if a request does not explicitly specify any features.
199+
If the ``default-features`` field is not present, the uploading client
200+
**MUST** assume a default of ``["multi-use-token"]``.
201+
186202
For the above example, a valid response body would be:
187203

188204
.. code-block:: json
189205
190206
{
191207
"audience-endpoint": "https://upload.example.com/_/oidc/audience",
192-
"token-mint-endpoint": "https://upload.example.com/_/oidc/mint-token"
208+
"token-mint-endpoint": "https://upload.example.com/_/oidc/mint-token",
209+
"features": ["single-use-token", "multi-use-token"],
210+
"default-features": ["multi-use-token"]
193211
}
194212
195213
If the server does not support Trusted Publishing for the given
@@ -250,6 +268,20 @@ POST request **MUST** be a JSON object containing the following:
250268

251269
- ``token``: a string containing the identity credential
252270
obtained from the Trusted Publishing provider.
271+
- ``features``: an **optional** array of strings
272+
indicating the desired features for the minted upload credential.
273+
If this field is not provided by the client, the server **MUST** use
274+
its own default features as specified in the
275+
``default-features`` field during discovery.
276+
277+
For example, a valid request body would be:
278+
279+
.. code-block:: json
280+
281+
{
282+
"token": "ey...",
283+
"features": ["single-use-token"]
284+
}
253285
254286
On success, the server responds with a ``200 OK`` status code and a body
255287
containing a JSON object with the following fields:
@@ -275,6 +307,32 @@ containing a JSON object with the following fields:
275307
On failure, the server **MUST** respond with any standard HTTP
276308
error code in the 400 or 500 range to indicate the appropriate error condition.
277309

310+
Feature Negotiation
311+
~~~~~~~~~~~~~~~~~~~
312+
313+
The protocol defined in this PEP supports an *optional* mechanism for
314+
negotiating non-default features between the uploading client and the
315+
receiving index server. These features are advertised as an array of
316+
strings in the ``features`` field of the discovery response; the client
317+
can then request one or more features by including them in the ``features``
318+
field of the token minting request.
319+
320+
The following features are defined:
321+
322+
- ``single-use-token``: the tokens minted by the index server
323+
**MUST** be single-use tokens. In other words, the token returned
324+
by the token minting endpoint **MUST** only be usable for a single
325+
upload operation. Any subsequent upload attempts using the same
326+
token **MUST** be rejected by the index server. Clients that request
327+
the ``single-use-token`` feature **MUST** be prepared to perform
328+
multiple token minting operations if multiple upload operations
329+
are needed.
330+
331+
- ``multi-use-token``: the tokens minted by the index server
332+
**MUST** be multi-use tokens. In other words, the token returned
333+
by the token minting endpoint **MAY** be usable for multiple
334+
upload operations until it expires.
335+
278336
Security Implications
279337
=====================
280338

@@ -389,17 +447,17 @@ This approach too has downsides:
389447
Footnotes
390448
=========
391449

392-
.. [#fn-hash]
450+
.. [#fn-discovery-key]
393451
394452
The discovery key may be computed thusly:
395453
396454
.. code-block:: pycon
397455
398-
>>> import hashlib
456+
>>> import urllib.parse
399457
>>> path = "/legacy/"
400-
>>> key = hashlib.sha256(path.encode("utf-8")).hexdigest()
458+
>>> key = urllib.parse.quote_plus(path)
401459
>>> print(key)
402-
0cace9579789849db6e16d48df183951c8f17582200d84bc93c7678d6c8f78a7
460+
'%2Flegacy%2F'
403461
404462
.. [#fn-oidc] Widely used CI/CD and cloud providers variously implement "ambient"
405463
OIDC token retrieval mechanisms that aren't standardized.

0 commit comments

Comments
 (0)