Skip to content

Commit e9e61ac

Browse files
authored
PEP 794: Address comments (#4571)
Just clarifying a few points.
1 parent 19c5f59 commit e9e61ac

File tree

1 file changed

+22
-13
lines changed

1 file changed

+22
-13
lines changed

peps/pep-0794.rst

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -165,20 +165,27 @@ If a project lists the same name in both ``Import-Name`` and
165165
``Import-Namespace``, then tools MUST raise an error due to ambiguity; this also
166166
applies to ``import-names`` and ``import-namespaces``, respectively.
167167

168-
Tools SHOULD raise an error when two projects that are to be installed list
169-
names that overlap in each other's ``Import-Name`` entries. This is to avoid
170-
projects unexpectedly shadowing another project's code. The same applies to when
171-
a project has an entry in ``Import-Name`` that overlaps with another project's
168+
Tools SHOULD raise an error when two projects that are about to be installed by
169+
a tool list names that overlap in each other's ``Import-Name`` entries (i.e.
170+
installed in the same command/action). This is to avoid projects unexpectedly
171+
shadowing another project's code. The same applies to when a project has an
172+
entry in ``Import-Name`` that overlaps with another project's
172173
``Import-Namespace`` entries. This does not apply to overlapping
173-
``Import-Namespace`` entries as that's the purpose of namespace packages.
174-
175-
Projects MAY leave ``Import-Name`` and ``Import-Namespace`` out of the core
176-
metadata for a project. In that instance, tools SHOULD assume that when the
177-
core metadata is 2.5 or newer, the normalized project name, when converted to
178-
an import name, would be an entry in ``Import-Name`` (i.e. ``-`` replaced with
179-
``_`` in the normalized project name). This is deemed reasonable as this will
180-
only occur for projects that make a new release once their build back-end
181-
supports core metadata 2.5 or newer as proposed by this PEP.
174+
``Import-Namespace`` entries as that's the purpose of namespace packages. Tools
175+
MAY warn or raise an error when installing a project into a preexisting
176+
environment where there is import name overlap with a project that is already
177+
installed. This is a "MAY" and not a "SHOULD" due to some users purposefully
178+
overwriting import names when installation is done in multiple steps (e.g.
179+
using different installers with the same environment).
180+
181+
Tools MAY leave ``Import-Name`` and ``Import-Namespace`` out of the core
182+
metadata for a project. In that instance, tools consuming such metadata SHOULD
183+
assume that when the core metadata is 2.5 or newer, the normalized project name,
184+
when converted to an import name, would be an entry in ``Import-Name`` (i.e.
185+
``-`` replaced with ``_`` in the normalized project name). This is deemed
186+
reasonable as this will only occur for projects that make a new release once
187+
their build back-end supports core metadata 2.5 or newer as proposed by this
188+
PEP.
182189

183190
Projects MAY set ``import-names`` or ``import-namespaces`` -- as well as
184191
``Import-Name`` or ``Import-Namespace``, respectively -- to the normalized
@@ -211,6 +218,8 @@ there would be 3 expected entries:
211218
.. code-block:: TOML
212219
213220
[project]
221+
# The pytest docs list code out of all of these modules, so it isn't
222+
# obvious whether they would mark any as private.
214223
import-names = ["_pytest", "py", "pytest"]
215224
216225

0 commit comments

Comments
 (0)