On 2024-11-05 13:52, Jon Turney via Cygwin-apps wrote:
On 14/08/2024 08:17, Brian Inglis via Cygwin-apps wrote:
new source packages on pythonhosted appear to change dashes in package
names to underscores in archive names and directories, for example:

python-license-expression ->
license-expression ->
https://files.pythonhosted.org/packages/source/l/license_expression/license_expression-30.3.1.tar.gz
-> license_expression-30.3.1/

although dashes in pythonhosted package directory names
still seem to work as an alternative:

https://files.pythonhosted.org/packages/source/l/license{-,_}expression/license_expression-30.3.1.tar.gz

but dashes work and underscores do not in older package version
archives, although underscores in pythonhosted package directory names
still seem to work as an alternative:

https://files.pythonhosted.org/packages/source/l/license{-,_}expression/license-expression-30.3.0.tar.gz

Thanks for this.

Sorry about the delay in looking at this, but I have been very short of time recently.

So, first off, I am a bit unhappy about guessing how this supposed to work. Have PyPI not made any announcement of this change, explaining exactly what it is?

PEP 625 2020

https://peps.python.org/pep-0625/

normalization:

https://packaging.python.org/en/latest/specifications/binary-distribution-format/

TL;DR: distribution names cannot contain '-' as that is used to delimit version:

"In distribution names, any run of -_. characters (HYPHEN-MINUS, LOW LINE and FULL STOP) should be replaced with _ (LOW LINE), and uppercase characters should be replaced with corresponding lowercase ones.
This is equivalent to *regular* name normalization followed by replacing - with 
_.
Tools consuming wheels must be prepared to accept . (FULL STOP) and uppercase letters, however, as these were allowed by an earlier version of this specification."

as opposed to project ("regular" above) name normalization rules:

https://packaging.python.org/en/latest/specifications/core-metadata/#core-metadata

https://packaging.python.org/en/latest/specifications/name-normalization/#name-normalization

So unnormalized names may work, or lowercased, or s/[-._]\+/-/, or s/[-._]\+/_/!

Secondly, I'm not crazy about the "try all the alternatives" approach. Perhaps it would be better to form the URL using the current (new) rules, with an escape (e.g. define PYTHON_ORG_OLD_STYLE_URL to form it using the old rules)?

        https://warehouse.pypa.io/api-reference/legacy.html#upload-api

"All fields need to be renamed to lowercase and hyphens need to replaced by underscores. So instead of “Description-Content-Type” the field must be named “description_content_type”. Note that adding a field “Description-Content-Type” will not raise an error but will be silently ignored."

        https://github.com/pypi/warehouse/milestone/12

"Post Legacy Shutdown priorities
Important issues that have gotten unblocked now that legacy PyPI is dead (RIP). See https://lwn.net/Articles/751458/ for more info."

        https://lwn.net/Articles/751458/

Perhaps we should consider the Gentoo eclass changes:

"It should be noted that legacy URLs are no longer supported and may stop working at an arbitrary time."

like recently:

        https://projects.gentoo.org/python/guide/pypi.html

--
Take care. Thanks, Brian Inglis              Calgary, Alberta, Canada

La perfection est atteinte                   Perfection is achieved
non pas lorsqu'il n'y a plus rien à ajouter  not when there is no more to add
mais lorsqu'il n'y a plus rien à retirer     but when there is no more to cut
                                -- Antoine de Saint-Exupéry

Reply via email to