On 30 September 2014 15:25, Paul Moore <p.f.mo...@gmail.com> wrote:
> On 28 August 2014 19:58, Donald Stufft <don...@stufft.io> wrote:
>> To fix this I'm going to modify PyPI so that it uses the normalized name in
>> the /simple/ URL and redirects everything else to the non-normalized name.
>> I'm  also going to submit a PR to bandersnatch so that it will use normalized
>> names for it's directories and such as well. These two changes will make it 
>> so
>> that the client side will know ahead of time exactly what form the server 
>> expects
>> any given name to be in. This will allow a change in pip to happen which
>> will pre-normalize all names which will make the interaction with mirrors
>> better and will reduce the number of HTTP requests that a single ``pip 
>> install``
>> needs to make.
>
> Just to clarify, this means that if I want to find the simple index
> page for a distribution, without hitting redirects, I should first
> normalise the project name (so "Django" becomes "django") and then
> request https://pypi.python.org/simple/<normalised_name>/ (with a
> slash on the end). Is that correct? It seems to match what I see in
> practice (in particular, the version without a terminating slash
> redirects to the version with a terminating slash).
>
> The JSON API has the opposite behaviour -
> https://pypi.python.org/pypi/Django/json redirects to
> https://pypi.python.org/pypi/django/json. Should that not be changed
> to match? Will it be?

One further thought. Where is the definition of how to normalise a
name? I could probably dig through the pip sources and find it, but it
would be nice if it were documented somewhere. From experiment, it
seems like lowercase, and with hyphens rather than underscores, is the
definition. Does PyPI allow names not allowed by
http://legacy.python.org/dev/peps/pep-0426/#name and if it does, how
are they normalised?

In case it's not obvious, I'm writing a client for the PyPI API, and
these questions are coming out of that process.

Paul.

PS The Python wiki has pages for the XMLRPC and JSON API. Any
objections to me adding a page for the simple API? (The obvious
objection being that it's documented somewhere else, and I should just
put a pointer to the real documentation...)

Paul
_______________________________________________
Distutils-SIG maillist  -  Distutils-SIG@python.org
https://mail.python.org/mailman/listinfo/distutils-sig

Reply via email to