[Python-Dev] PEP 441 - Improving Python ZIP Application Support

Petr Viktorin encukou at gmail.com
Thu Feb 19 10:19:57 CET 2015


On Wed, Feb 18, 2015 at 10:16 PM, Paul Moore <p.f.moore at gmail.com> wrote:
> On 18 February 2015 at 20:48, Jim J. Jewett <jimjjewett at gmail.com> wrote:
>> Barry Warsaw wrote:
>>>> I don't know exactly what the procedure would be to claim .pyz for *nix,
>>>> e.g. updating /etc/mime.types, but I think the PEP should at least mention
>>>> this.  I think we want to get as official support for .pyz files on *nix as
>>>> possible.
>>
>> Paul Moore wrote:
>>> I'll add a note to the PEP, but I have no idea how we would even go
>>> about that, so that's all I can do, unfortunately.
>>
>> Are you just looking for
>>
>>     http://www.iana.org/assignments/media-types/media-types.xhtml
>>
>> and its references, including the registration procedures
>>
>>     http://tools.ietf.org/html/rfc6838#section-4.2.5
>>
>> and the application form at
>>
>>     http://www.iana.org/form/media-types
>>
>> ?
>
> That covers mime types, but not file extensions, so it's not really
> what *I* thought Barry was talking about.
>
> Actually, I guess the first question is whether ".py" is reserved for
> Python scripts. If it is, then certainly /pyz should be reserved in a
> similar way for Python Zip Applications. If there's no formal
> registration of .py, then it seems a bit unreasonable to bother for
> .pyz...
>
> Also, I don't think reserving anything is something I, as an
> individual (and specifically a non-Unix user) should do. It probably
> should be handled by the PSF, as the process seems to need a contact
> email address...

There is no extension registry for Unixy systems, because extensions
traditionally don't matter. File types are identified by their
contents; there is a "magic"* database that maps file contents to
types (MIME types, nowadays). The `file` command is the CLI interface
for that. Some programs will fall back on the extension if that
doesn't give a result, but that would depend on the program.

For a pyz file to run when you "open" it (for most values of "open"),
it needs to have the executable bit set, and have a shebang line.

* /usr/share/misc/magic – it originally contained just magic numbers,
such as those you might find at the beginning of a .pyc file.


More information about the Python-Dev mailing list