@@ -46,10 +46,10 @@ names will become available once they install a project.
4646
4747There is also no easy way to know whether installing two projects will conflict
4848with 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
5050to 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 >`__.
5353
5454It may also help with spam detection. If a project specifies the same import
5555names 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
8484impossible to get right due to how flexible Python's import system is. As such,
8585this PEP only requires that valid import names be used and that projects don't
8686lie (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
8888names they list (e.g. you can't list ``a.b.c `` and not account for ``a `` and
8989``a.b ``).
9090
@@ -98,7 +98,7 @@ read the table of contents of the zip file). This sort of calculation is also
9898currently repeated by everyone independently instead of having the metadata
9999hosted by a central index server like PyPI. It also doesn't work for sdists
100100as 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
102102necessarily accurate as it is based on inference instead of being explicitly
103103provided by the project owners. All of these accuracy issues affect even having
104104an 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
137137Projects SHOULD list all the shortest import names that are exclusively provided
138138by a project which would cover all import name scenarios. If any of the shortest
139139names 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.
148147
149148Tools SHOULD raise an error when two projects that are to be installed list
150149names that overlap in each others' ``Import-Name `` entries. This is to avoid
151150projects unexpectedly shadowing another project's code. The same applies to when
152151a project has an entry in ``Import-Name `` that overlaps with another project's
153152``Import-Namespace `` entries.
154153
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-
163154Projects MAY leave ``Import-Name `` and ``Import-Namespace `` empty. In that
164155instance, tools SHOULD assume that the normalized project name when converted to
165156an 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
253244also made the data more self-documenting.
254245
255246
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+
256258Re-purpose the ``Provides `` field
257259----------------------------------
258260
0 commit comments