Subject: bug#47746: pypi importer generates wrong pypi-uri without underscore

From: Maxim Cournoyer <[email-masked]>
Date: Sun, 18 Apr 2021 22:37:16 -0400

Hi,

Xinglu Chen <[email-masked]> writes:

> On Tue, Apr 13 2021, Ricardo Wurmus wrote:
>
>> You’re right, this only affects some packages.  Here are two 
>> examples:
>>
>> [...]
>>
>> They both have a redirection in common, but the pypi-uri is 
>> incorrect as it needs to have the underscore.
>
> Looking at the JSON object at
> <https://pypi.org/pypi/jupyterlab-widgets/json>, it specifies
> “jupyterlabs-widgets” as ‘info.downloads.name’, which is what the PyPi
> importer reads to determine the PyPi URI.
>
> Would it make sense to just make it read the name that the user
> specifies in the shell, i.e. ‘./pre-inst-env guix import pypi
> PACKAGE-NAME’ (see the patch below)?  Or will this potentially mess up
> other PyPi URIs?
>
>>>From ec5612e9d4c2026541874c6a3eaf7c9009ce4a31 Mon Sep 17 00:00:00 2001
> Message-Id: <[email-masked]>
> From: Xinglu Chen <[email-masked]>
> Date: Wed, 14 Apr 2021 14:37:01 +0200
> Subject: [PATCH] import: pypi: Use package name from the shell to construct
>  the URI.
>
> Some packages will list an incorrect package name in the JSON object,
> resulting in PyPi URIs that lead to nowhere.

In my opinion, if a package contains wrong values in their metadata,
it's a problem that should be reported to that package.  As with other
things, garbage in -> garbage out; Guix cannot do much here.  I seem to
recall that some older PyPI mirror had that problem.  It may be that
their metadata name -> URI is not consistent.  We could try to find what
that 2nd scheme is and attempt both, although that's not very elegant
and it probably points to packages being very outdated to start with.

Thanks,

Maxim