Skip to content

Commit d8a4033

Browse files
msarahanhugovk
andcommitted
PEP 766: explicit priority choices among multiple indexes
Apply suggestions from code review Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
1 parent dc267d3 commit d8a4033

File tree

2 files changed

+26
-25
lines changed

2 files changed

+26
-25
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -642,6 +642,7 @@ peps/pep-0761.rst @sethmlarson @hugovk
642642
peps/pep-0762.rst @pablogsal @ambv @lysnikolaou @emilyemorehouse
643643
peps/pep-0763.rst @dstufft
644644
peps/pep-0765.rst @iritkatriel @ncoghlan
645+
peps/pep-0766.rst @warsaw
645646
# ...
646647
peps/pep-0777.rst @warsaw
647648
# ...
Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
1-
PEP: 9999
1+
PEP: 766
22
Title: Explicit Priority Choices Among Multiple Indexes
33
Author: Michael Sarahan, msarahan@gmail.com
44
Sponsor: Barry Warsaw, barry@python.org
5-
PEP-Delegate: <PEP delegate’s real name>
6-
Discussions-To: <REQUIRED: URL of current canonical discussion thread>
5+
PEP-Delegate: Paul Moore <p.f.moore@gmail.com>
6+
Discussions-To: https://discuss.python.org/t/pep-for-handling-multiple-indexes-index-priority/71589
77
Status: Draft
88
Type: Informational
99
Topic: Packaging
1010
Requires: 777
11-
Created: 05-Nov-2024
12-
Post-History: <REQUIRED: dates, in dd-mmm-yyyy format, and corresponding links to PEP discussion threads>
11+
Created: 18-Nov-2024
12+
Post-History: `18-Nov-2024 <https://discuss.python.org/t/pep-for-handling-multiple-indexes-index-priority/71589>`__,
1313

1414
Abstract
1515
========
1616

17-
Package resolution is a key part of the Python user experience as the
18-
means of extending Python's core functionality. The experience of package
19-
resolution is mostly taken for granted until someone encounters a
20-
situation where the package installer does something they don't expect.
17+
Package resolution is a key part of the Python user experience as the
18+
means of extending Python's core functionality. The experience of package
19+
resolution is mostly taken for granted until someone encounters a
20+
situation where the package installer does something they don't expect.
2121
The installer behavior with multiple indexes has been `a common source of unexpected behavior <https://github.com/pypa/pip/issues/8606>`__.
22-
Through its ubiquity, pip has long defined the standard expected behavior
23-
across other tools in the ecosystem, but Python installers are diverging
24-
with respect to how they handle multiple indexes. At the core of this
25-
divergence is whether index contents are combined before resolving distributions,
22+
Through its ubiquity, pip has long defined the standard expected behavior
23+
across other tools in the ecosystem, but Python installers are diverging
24+
with respect to how they handle multiple indexes. At the core of this
25+
divergence is whether index contents are combined before resolving distributions,
2626
or each index is handled individually in order. Pip merges all indexes
2727
before matching distributions, while uv matches distributions on one index
2828
before moving on to the next. Each approach has advantages and disadvantages.
29-
This PEP aims to describe each of these behaviors, which are referred to
29+
This PEP aims to describe each of these behaviors, which are referred to
3030
as “version priority” and “index priority” respectively, so that community
31-
discussions and troubleshooting can share a common vocabulary, and so that tools can
31+
discussions and troubleshooting can share a common vocabulary, and so that tools can
3232
implement predictable behavior based on these descriptions.
3333

3434
Motivation
@@ -46,7 +46,7 @@ Goals
4646
- Provide guidelines for how ecosystem tools should implement index
4747
priority if they would like, and suggest reasons why they might want
4848
to do so
49-
- Augment `PEP 708 <https://peps.python.org/pep-0708/>`__ as a more
49+
- Augment `PEP 708 <https://peps.python.org/pep-0708/>`__ as a more
5050
user-configurable system for expressing different levels of trust
5151
among configured indexes
5252

@@ -67,11 +67,11 @@ Rationale
6767
=========
6868

6969
This PEP describes two modes of installer behavior when using multiple
70-
sources in the hopes that the user experience and expectations across
71-
tools can be more explicit and more predictable. Pip has long defined
72-
the de-facto standard installer behavior in the ecosystem, but new tools
70+
sources in the hopes that the user experience and expectations across
71+
tools can be more explicit and more predictable. Pip has long defined
72+
the de-facto standard installer behavior in the ecosystem, but new tools
7373
have been implementing new approaches in response to both security concerns
74-
and desire to prioritize one index over another. Uv and PDM have each
74+
and desire to prioritize one index over another. Uv and PDM have each
7575
added support for some notion of index priority.
7676

7777
Index priority is `the default behavior in
@@ -112,8 +112,8 @@ different contents than other indexes, such as builds for special
112112
hardware, and this version priority behavior can lead to undesirable,
113113
unexpected outcomes, and this is when users generally look for some kind
114114
of index priority. Additionally, when there is a difference in trust among
115-
indexes, version priority does not provide a way to prefer more trusted
116-
indexes over less trusted indexes. This has been the subject of dependency
115+
indexes, version priority does not provide a way to prefer more trusted
116+
indexes over less trusted indexes. This has been the subject of dependency
117117
confusion attacks, and :pep:`708` was
118118
proposed as a way of hard-coding a notion of trusted external indexes into
119119
the index.
@@ -160,15 +160,15 @@ packages are compared.
160160
“Index priority”
161161
----------------
162162

163-
In index priority, the resolver finds candidates for each index, one at a time.
163+
In index priority, the resolver finds candidates for each index, one at a time.
164164
The resolver proceeds to subsequent indexes only if the current
165165
package request has no viable candidates. Index priority does not combine
166-
indexes into one global, flat namespace. Because indexes are searched in order,
166+
indexes into one global, flat namespace. Because indexes are searched in order,
167167
the package from an earlier index will be preferred over a package from a later index, regardless of whether
168168
the later index had a better match. Uv’s calls this "first-match"
169169
behavior, and the version priority behavior "best-match". The criteria and process for
170170
evaluating “best match” is the same for both index priority and version
171-
priority. It is only the treatment of multiple indexes that differs:
171+
priority. It is only the treatment of multiple indexes that differs:
172172
all together for version priority, and individually for index priority.
173173

174174
The index (or “source” in PDM terms) priority is

0 commit comments

Comments
 (0)