Hi,

For some time now I’ve been wanting to change the pypi.bbclass variables so 
that they’re more logical and useful, specifically PYPI_PACKAGE.  The impetus 
behind this was a mix of the meaning not being entirely obvious, and a desire 
to auto-generate python package dependencies, which would need the correct 
package name to be known.  I’ve been meaning to send this for the entire 
release cycle but never actually finished it until now, so I’m posting this as 
a RFC now that we most likely merge in M1 after the next release.

Currently, PYPI_PACKAGE is actually the name of the sdist (source distribution) 
tarball.  As some releases are quite old this may or may not have been 
normalised, so the sdist name can’t always be used for homepage links, upgrade 
checking, or dependencies.

We default PYPI_PACKAGE to the recipe name with "python3-“ stripped off, but as 
proper sdist filename normalisation involves the standard normalisation and 
then turning - to _ (see [1]), and _ in recipe names is a bad idea, we now need 
to explicitly assign PYPI_PACKAGE in a third of recipes in oe-core (and that 
percentage will only increase as more packages are uploaded with normalised 
names).

I propose switching PYPI_PACKAGE to be the actual package name (defaulting to a 
value derived from the recipe name as before), which we then normalise as 
needed for the update check and sdist filename.  As the update check URLs are 
specified to be the normalised name that will always work, and we can cater for 
non-normalised sdists by adding PYPI_PACKAGE_SDIST for that purpose.

This involves a bit of churn to update PYPI_PACKAGE and set PYPI_PACKAGE_SDIST 
where needed, but it’s a net reduction[2] and over time the number of 
PYPI_PACKAGE_SDIST assignments will tend to zero.

Obviously, I have this work done already in oe-core-contrib:ross/wip/pypi-wip 
and have also updated meta-oe.

I think this is the right thing to do, but one thing is niggling me which is 
why I always stalled on finishing the series. We could say that PYPI_PACKAGE is 
the normalised package name (so, jinja2 not Jinja2, qemp-qmp not qemu.qmp) 
instead of the real name and that would remove the need to normalise it any 
further.  The sdist is based on this normalised name, the releases API uses the 
normalised name, the homepage links work with both original and normalised 
names, and in any future automatic dependency generation we can work with 
normalised names anyway.

I’m torn on this: using the real package name is “correct” and easy to explain 
(it’s the name on pypi.org <http://pypi.org/>, or in the pyproject.toml) but 
using the normalised name means more recipes would work without assignments. 
For example, with this change in core we’d no longer need to set PYPI_PACKAGE 
for python3-jinja2 (Jinja2), python3-pysocks (PySocks), or python3-qemu-qmp 
(qemu.qmp).

Any thoughts?

Cheers,
Ross

[1] 
https://packaging.python.org/en/latest/specifications/source-distribution-format/
[2] For oe-core, 46 files changed, 15 insertions(+), 69 deletions(-)
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#245256): 
https://lists.openembedded.org/g/openembedded-core/message/245256
Mute This Topic: https://lists.openembedded.org/mt/121127954/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to