@@ -46,10 +46,10 @@ names will become available once they install a project.
46
46
47
47
There is also no easy way to know whether installing two projects will conflict
48
48
with one another based on the import names they provide. For instance, if two
49
- different projects have a ``_utils `` module, installing both project will lead
49
+ different projects have a ``_utils `` module, installing both projects will lead
50
50
to a clash as one project's ``_utils `` module would take precedence over the
51
- other project's version. This issue has been
52
- `seen in the wild <https://github.com/astral-sh/uv/pull/13437 >`__.
51
+ other project's version by overwriting the other project's file; this issue
52
+ has been `seen in the wild <https://github.com/astral-sh/uv/pull/13437 >`__.
53
53
54
54
It may also help with spam detection. If a project specifies the same import
55
55
names as a very popular project it can act as a signal to take a closer look
@@ -84,7 +84,7 @@ a specification that is somehow strict about what can be listed would be near
84
84
impossible to get right due to how flexible Python's import system is. As such,
85
85
this PEP only requires that valid import names be used and that projects don't
86
86
lie (and it is acknowledged the latter requirements cannot be validated
87
- programmatically). Project do, though, need to account for all levels of the
87
+ programmatically). Projects do, though, need to account for all levels of the
88
88
names they list (e.g. you can't list ``a.b.c `` and not account for ``a `` and
89
89
``a.b ``).
90
90
@@ -98,7 +98,7 @@ read the table of contents of the zip file). This sort of calculation is also
98
98
currently repeated by everyone independently instead of having the metadata
99
99
hosted by a central index server like PyPI. It also doesn't work for sdists
100
100
as the structure of the wheel isn't known yet, and so inferring the structure
101
- of the code installed isn't known yet . As well, these solutions are not
101
+ of the code installed isn't possible . As well, these solutions are not
102
102
necessarily accurate as it is based on inference instead of being explicitly
103
103
provided by the project owners. All of these accuracy issues affect even having
104
104
an index hosting the information to avoid the compute costs of gathering the
@@ -137,29 +137,20 @@ value on the user's behalf if desired, if the user declares the key in
137
137
Projects SHOULD list all the shortest import names that are exclusively provided
138
138
by a project which would cover all import name scenarios. If any of the shortest
139
139
names are dotted names, all intervening names from that name to the top-level
140
- name should also be listed appropriately in ``Import-Namespace ``.
141
- For instance, a project which is a single package named ``spam `` with multiple
142
- submodules would only list ``project.import-names = ["spam"] ``. A project that
143
- provides ``spam.bacon.eggs `` which is exclusively from the project while the
144
- intervening names are namespaces would have
145
- ``project-names = ["spam.bacon.eggs"] `` and
146
- ``project-namespaces = ["spam", "spam.bacon"] ``. Listing all names acts as a
147
- check that the intent of the import names is as expected.
140
+ name should also be listed appropriately in ``Import-Namespace `` and/or
141
+ ``Import-Names ``. For instance, a project which is a single package named
142
+ ``spam `` with multiple submodules would only list
143
+ ``project.import-names = ["spam"] ``. A project that lists ``spam.bacon.eggs ``
144
+ would also need to account for ``spam `` and ``spam.bacon `` appropriately in
145
+ ``project-names `` and ``project-namespaces ``. Listing all names acts as a check
146
+ that the intent of the import names is as expected.
148
147
149
148
Tools SHOULD raise an error when two projects that are to be installed list
150
149
names that overlap in each others' ``Import-Name `` entries. This is to avoid
151
150
projects unexpectedly shadowing another project's code. The same applies to when
152
151
a project has an entry in ``Import-Name `` that overlaps with another project's
153
152
``Import-Namespace `` entries.
154
153
155
- Tools SHOULD raise an error when an entry in ``Import-Name `` is higher than
156
- ``Import-Namespace `` in the same project, e.g.
157
- ``project.import-names = ["spam"] `` and
158
- ``project.import-namespaces = ["spam.bacon"] ``. This is because if a project
159
- exclusively owns a higher import name then that would mean it is impossible for
160
- another project to install with the same import name found in ``Import-Name ``
161
- in order to contribute to the namespace listed in ``Import-Namespace ``.
162
-
163
154
Projects MAY leave ``Import-Name `` and ``Import-Namespace `` empty. In that
164
155
instance, tools SHOULD assume that the normalized project name when converted to
165
156
an import name would be an entry in ``Import-Name ``
@@ -253,6 +244,17 @@ listing something that would be interpreted as an implicit namespace, but it
253
244
also made the data more self-documenting.
254
245
255
246
247
+ Require that names listed in ``Import-Namespace `` never be contained by a name in ``Import-Name ``
248
+ -------------------------------------------------------------------------------------------------
249
+
250
+ The way Python's import system works by default means that it isn't possible to
251
+ have an import name contain an namespace. But Python's import system is flexible
252
+ enough that user code could make that possible. As such, the requirement that
253
+ tools error out if an import name contained a namespace name --
254
+ ``import-names = ["spam"] `` and ``import-namespaces = ["spam.bacon"] `` -- was
255
+ removed.
256
+
257
+
256
258
Re-purpose the ``Provides `` field
257
259
----------------------------------
258
260
0 commit comments