Skip to content

Commit cc9be90

Browse files
authored
PEP 794: Clarifications based on feedback (#4462)
1 parent f62fbed commit cc9be90

File tree

1 file changed

+18
-20
lines changed

1 file changed

+18
-20
lines changed

peps/pep-0794.rst

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,7 @@ Rationale
5454

5555
This PEP proposes extending the packaging :ref:`packaging:core-metadata` so
5656
that project owners can specify the highest-level import names that a project
57-
provides and owns if installed.
58-
59-
By keeping the information to the import names a project would own if
60-
installed, it makes it clear which project maps directly to what import name
61-
once the project is installed.
57+
provides and owns if installed on some platform.
6258

6359
Putting this metadata in the core metadata means the data is (potentially)
6460
served independently of any sdist or wheel by an index server. That negates
@@ -94,7 +90,9 @@ hosted by a central index server like PyPI. It also doesn't work for sdists
9490
as the structure of the wheel isn't known yet, and so inferring the structure
9591
of the code installed isn't known yet. As well, these solutions are not
9692
necessarily accurate as it is based on inference instead of being explicitly
97-
provided by the project owners.
93+
provided by the project owners. All of these accuracy issues affect even having
94+
an index hosting the information to avoid the compute costs of gathering the
95+
information.
9896

9997

10098
Specification
@@ -106,22 +104,22 @@ latest core metadata version to 2.5.
106104
The ``Import-Name`` field is a "multiple uses" field. Each entry of
107105
``Import-Name`` MUST be a valid import name. The names specified in
108106
``Import-Name`` MUST be importable when the project is installed on *some*
109-
platform for the same version of the project (i.e. the metadata MUST be
107+
platform for the same version of the project (e.g. the metadata MUST be
110108
consistent across all sdists and wheels for a project release). This does
111109
imply that the information isn't specific to the distribution artifact it is
112110
found in, but for the release version the distribution artifact belongs to.
113111

114-
Projects are not expected to list every single import name that is provided.
112+
Projects are not required to list every single import name that is provided.
115113
Instead, projects SHOULD list the highest-level/shortest import name that the
116-
project would "own" when installed. For example, if you install a project
117-
that has a single package named ``myproj`` which itself has multiple
118-
submodules, the expectation is only ``myproj`` would be listed in
119-
``Import-Name`` and not every submodule. If a project is part of a namespace
120-
package named ``ns`` and it provides a subpackage called ``ns.myproj`` (i.e.
121-
``ns.myproj.__init__`` exists), then ``ns.myproj`` should be listed in
122-
``Import-Name``, but NOT ``ns`` alone as that is not "owned" by the project
123-
upon installation (i.e. other projects can be installed which also contribute to
124-
``ns``).
114+
project would "own" when installed (this includes "private" names). For
115+
example, if you install a project that has a single package named ``myproj``
116+
which itself has multiple submodules, the expectation is only ``myproj``
117+
would be listed in ``Import-Name`` and not every submodule. If a project is
118+
part of a namespace package named ``ns`` and it provides a subpackage called
119+
``ns.myproj`` (i.e. ``ns.myproj.__init__`` exists), then ``ns.myproj`` should
120+
be listed in ``Import-Name``, but NOT ``ns`` alone as that is not "owned" by
121+
the project upon installation (i.e. other projects can be installed which
122+
also contribute to ``ns``).
125123

126124
If a project chooses not to provide any ``Import-Name`` entries, tools MAY
127125
assume the import name matches the project name (including de-normalization of
@@ -137,9 +135,9 @@ value on the user's behalf if desired, if the user declares the key in
137135
Examples
138136
--------
139137

140-
`In httpx 0.28.1
141-
<https://pypi-browser.org/package/httpx/httpx-0.28.1-py3-none-any.whl>`__ ,
142-
an entry for the ``httpx`` package.
138+
`In scikit-learn 1.7.0
139+
<https://pypi-browser.org/package/scikit-learn/scikit_learn-1.7.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl>`__ ,
140+
an entry for the ``sklearn`` package would be used.
143141

144142
`In pytest 8.3.5
145143
<https://pypi-browser.org/package/pytest/pytest-8.3.5-py3-none-any.whl>`__

0 commit comments

Comments
 (0)