[Distutils] PEP 503 - Simple Repository API

Marius Gedminas marius at gedmin.as
Sat Sep 5 10:44:33 CEST 2015

On Fri, Sep 04, 2015 at 09:17:18PM -0400, Donald Stufft wrote:
> You can see this PEP online at https://www.python.org/dev/peps/pep-0503/ or I
> have reproduced it inline below.
> Below the root URL is another URL for each individual project contained within
> a repository. The format of this URL is ``/<project>/`` where the ``<project>``
> is replaced by the normalized name for that project, so a project named
> "HolyGrail" would have an URL like ``/holygrail/``. This URL must response with

Typo: "must response" -> "must respond"

> a valid HTML5 page with a single anchor element per file for the project. The
> text of the anchor tag **MUST** be the filename of the file and the href
> attribute **MUST** be an URL that links to the location of the file for
> download. The URL **SHOULD** include a hash in the form of an URL fragment with
> the following syntax: ``#<hashname>=<hashvalue>``, where ``<hashname>`` is the
> lowercase name of the hash function (such as ``sha256``) and ``<hashvalue>`` is
> the hex encoded digest.
> In addition to the above, the following constraints are placed on the API:
> * All URLs **MUST** end with a ``/`` and the repository **SHOULD** redirect the
>   URLs without a ``/`` to add a ``/`` to the end.

(except for URLs pointing to downloadable files, I presume?)

> * There is no constraints on where the files must be hosted relative to the
>   repository.

> Normalized Names
> ----------------
> This PEP references the concept of a "normalized" project name. As per PEP 426
> the only valid characters in a name are the ASCII alphabet, ASCII numbers,
> ``.``, ``-``, and ``_``.

For a second I thought this referred to a normalized name and got
confused ("I thought _ and - were interchangeable?").

Maybe it's worth clarifying with s/in a name/in a ("unnormalized")
name/.  Or maybe not -- the rest of the paragraph clears away the
confusion quickly enough.

> The name should be lowercased with all runs of the
> characters ``.``, ``-``, or ``_`` replaced with a single ``-`` character. This
> can be implemented in Python with the ``re`` module::
>    import re
>    def normalize(name):
>        return re.sub(r"[-_.]+", "-", name).lower()

Oh, excellent!  Having this documented briefly and clearly is most welcome!

Marius Gedminas
<Corsac> yeah, i'm reading the answers, currently
<Corsac> but what I see is that there is no real procedure to rebuild initfs
<Corsac> the common way seems to use a loop device with a jffs2 filesystem, put
         original files there, and add other files, then umount, flash and pray
   <dwd> Corsac: You forgot "ritual sacrifice of a medium sized rodent".
         Without that, it'll never work.
   <zuh> And if it doesn't work the first time, re-adjust towel ordering in the
         restroom and try again
                -- #maemo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 173 bytes
Desc: Digital signature
URL: <http://mail.python.org/pipermail/distutils-sig/attachments/20150905/24730a12/attachment.sig>

More information about the Distutils-SIG mailing list