[wkrd] Workaround package index & PEP 625
Buildout relies on setuptools to fetch dists from package indexes like PyPI. Setuptools infers the project name of source distributions found in the index from their filename, as derived from their download link. This works on the assumption the sdist filename corresponds losslessly to the project name, and in the way setuptools expects. Setuptools normalizes any occurrence of a non alphanumeric and non '.' character into a '-'. This is actually already lossy for project names that contain other characters; therefore the assumption should instead be that the sdist filename is lossless with regards to this normalized project name - in general project names should respect this normalized form. Since PEP 625, that assumption is definitely broken, i.e. the filename is lossy with regards to the normalized project name: - in the sdist filename, characters . and - must both be replaced by _ - in the sdist filename, all characters must be lowercased Internally, setuptools lowercases the normalized project name in order to compare dists. The possibles consequences of that broken assumption are thus: 1. the sdist is discarded from the search 2. the sdist is found but the project name may be cased differently For example, zc.buildout==3.0.1 yields zc_buildout-3.0.1.tar.gz, which results in setuptools interpreting the project name as zc-buildout and discarding it from the search. Workaround 1. by also looking up the name with . replaced by _. Workaround 2. by fixing the project names back to the looked-up name.
Showing
Please register or sign in to comment