Description
I'm looking for clarity on the purpose of packages.sdist.name & packages.wheels.name. They lead to the same question. Here's the example for packages.wheels.name:
Lines 646 to 653 in 5625a11
Focusing on:
Required?: no, not when the last component of
path
/url
would be
the same value
Under what scenario does the "would be" derive from? I ask because when I initially implemented PEP-751 "installer" support in Pex I took the presence of such a name to trump the basename of the associated path or URL. I didn't think about the path case, but for the URL case I assumed a scenario like this:
sdist = {name = "foo-1.2.3.tar.gz", url = "https://my.index/foo-1.2.3.tar.gz/content" ...}
In other words I assumed the context was universal; e.g.: anyone accessing the artifact URL https://my.index/foo-1.2.3.tar.gz/content would get a content disposition header like Content-Disposition: attachment; filename="foo-1.2.3.tar.gz"
such that a typical agent implementation would save the file as "foo-1.2.3.tar.gz" and not as "content".
I ran across uv
's use, which appears to be to place the name it happens to store the wheel file as (a normalized wheel name) when the index URL basename was a non-normalized version of the name. For example:
wheels = [{ name = "pyyaml-6.0.2-cp310-cp310-macosx_10_9_x86_64.whl", url = "https://files.pythonhosted.org/packages/9b/95/a3fac87cb7158e231b5a6012e438c647e1a87f09f8e0d123acec8ab8bf71/PyYAML-6.0.2-cp310-cp310-macosx_10_9_x86_64.whl" ...}]
The response served up by https://files.pythonhosted.org/packages/9b/95/a3fac87cb7158e231b5a6012e438c647e1a87f09f8e0d123acec8ab8bf71/PyYAML-6.0.2-cp310-cp310-macosx_10_9_x86_64.whl does not, in fact use a Content-Disposition
header to suggest an alternate filename; so my initial implementation suffered a bug as a result.
As a result I now just ignore the name
field, but I'm uneasy about this. I feel like I'm missing the intent. Do either of @brettcannon or @charliermarsh have insight on this?
Any help understanding this is appreciated. I'm willing to take what I learn and send up a PR to clarify either this PEP or that other location this info is stored now.
C.F: