[Distutils] The Simple API - What URLs are "supported"

Donald Stufft donald at stufft.io
Thu Sep 18 12:31:34 CEST 2014


> On Sep 18, 2014, at 6:22 AM, holger krekel <holger at merlinux.eu> wrote:
> 
> On Thu, Sep 18, 2014 at 06:17 -0400, Donald Stufft wrote:
>>> On Sep 18, 2014, at 3:48 AM, Nick Coghlan <ncoghlan at gmail.com> wrote:
>>> 
>>> What about an approach where pip first tries the canonical name, and if that fails, tries the exact given name?
>>> 
>>> Seems to me like that should handle legacy mirrors without the big download.
>>> 
>>> Cheers,
>>> Nick.
>>> 
>> 
>> The exact implementation I had in mind has the /simple/{name}/{version}/ url
>> being removed immediately since it’s a cost that's *always* paid if you use ==
>> and as far as I know it's not supported/used anywhere. 
> 
> I agree and think that's just fine.
> 
>> However the fallback to
>> /simple/ would go through the 2 release deprecation cycle since it's both
>> actually useful for use with older mirrors and it's only paid if it needs to
>> be used right now.
>> 
>> I think that the deprecation cycle is probably fine to handle that, because
>> even if we do as you suggested we'll still need to fall back to /simple/
>> because of cases like ``pip install django`` where the "real" name is Django
>> and we have no way of knowing that.
> 
> Not sure i follow.  Do you mean "pip install django" needs to fall back
> to /simple/ when it works against a static file server?
> What significance does the "real" name have in "pip install" context?

As of right now, bandersnatch uses the "real" name of a project as the
directory name, so in the case of Django, which captilizes it's "real" name on
PyPI, it has URLs like /simple/Django/. Historically this matched what PyPI
did. Since bandersnatch is a static mirror it generally couldn't do a redirect
from /simple/django/ to /simple/Django/ so if someone typed
``pip install django`` pip would request /simple/django/, get a 404 and then
request /simple/, find that the "real" name of "django" is "Django", and then
it will request /simple/Django/.

The benefit of the change I made to PyPI to prefer the normalized name instead
of the "real" name is that tools like pip can know ahead of time what
/simple/{name}/ URL to request regardless of what the "real" name is on PyPI.

---
Donald Stufft
PGP: 7C6B 7C5D 5E2B 6356 A926 F04F 6E3C BCE9 3372 DCFA

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/distutils-sig/attachments/20140918/1900bcfc/attachment.html>


More information about the Distutils-SIG mailing list