@@ -54,11 +54,7 @@ Rationale
54
54
55
55
This PEP proposes extending the packaging :ref: `packaging:core-metadata ` so
56
56
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.
62
58
63
59
Putting this metadata in the core metadata means the data is (potentially)
64
60
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
94
90
as the structure of the wheel isn't known yet, and so inferring the structure
95
91
of the code installed isn't known yet. As well, these solutions are not
96
92
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.
98
96
99
97
100
98
Specification
@@ -106,22 +104,22 @@ latest core metadata version to 2.5.
106
104
The ``Import-Name `` field is a "multiple uses" field. Each entry of
107
105
``Import-Name `` MUST be a valid import name. The names specified in
108
106
``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
110
108
consistent across all sdists and wheels for a project release). This does
111
109
imply that the information isn't specific to the distribution artifact it is
112
110
found in, but for the release version the distribution artifact belongs to.
113
111
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.
115
113
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 ``).
125
123
126
124
If a project chooses not to provide any ``Import-Name `` entries, tools MAY
127
125
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
137
135
Examples
138
136
--------
139
137
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 .
143
141
144
142
`In pytest 8.3.5
145
143
<https://pypi-browser.org/package/pytest/pytest-8.3.5-py3-none-any.whl> `__
0 commit comments