PEP 440/441: reformat according to template

This commit is contained in:
Georg Brandl 2013-04-10 09:30:46 +02:00
parent 5ab4abbe28
commit 9ce9ab923a
3 changed files with 488 additions and 434 deletions

View File

@ -190,7 +190,7 @@ How to Make A Release
___ Check with the IE (if there is one <wink>) to be sure that
Lib/idlelib/NEWS.txt has been similarly updated.
___ For a final release, edit the first paragraph of
___ For a final major release, edit the first paragraph of
Doc/whatsnew/X.Y.rst to include the actual release date; e.g. "Python
2.5 was released on August 1, 2003." There's no need to edit this for
alpha or beta releases. Note that Andrew Kuchling often takes care of

File diff suppressed because it is too large Load Diff

View File

@ -12,18 +12,18 @@ Post-History: 30 March 2013, 1 April 2013
Improving Python ZIP Application Support
========================================
Python has had the ability to execute directories or ZIP-format archives
as scripts since version 2.6 [1]_. When invoked with a zip file or
directory as its first argument the interpreter adds that directory
to sys.path and executes the __main__ module. These archives provide a
great way to publish software that needs to be distributed as a single
file script but is complex enough to need to be written as a collection
of modules.
Python has had the ability to execute directories or ZIP-format
archives as scripts since version 2.6 [1]_. When invoked with a zip
file or directory as its first argument the interpreter adds that
directory to sys.path and executes the __main__ module. These
archives provide a great way to publish software that needs to be
distributed as a single file script but is complex enough to need to
be written as a collection of modules.
This feature is not as popular as it should be mainly because no ones
heard of it as it wasnt promoted as part of Python 2.6 [2]_, but also
because Windows users dont have a file extension (other than .py)
to associate with the launcher.
because Windows users dont have a file extension (other than .py) to
associate with the launcher.
This PEP proposes to fix these problems by re-publicising the feature,
defining the .pyz and .pyzw extensions as “Python ZIP Applications”
@ -34,35 +34,37 @@ A New Python ZIP Application Extension
======================================
The Python 3.4 installer will associate .pyz and .pyzw “Python ZIP
Applications” with the platform launcher so they can be executed. A
.pyz archive is a console application and a .pyzw archive is a windowed
application, indicating whether the console should appear when running
the app.
Applications” with the platform launcher so they can be executed. A
.pyz archive is a console application and a .pyzw archive is a
windowed application, indicating whether the console should appear
when running the app.
Why not use .zip or .py? Users expect a .zip file would be opened with
an archive tool, and users expect .py to contain text. Both would be
an archive tool, and users expect .py to contain text. Both would be
confusing for this use case.
For UNIX users, .pyz applications should be prefixed with a #! line
pointing to the correct Python interpreter and an optional explanation::
pointing to the correct Python interpreter and an optional
explanation::
#!/usr/bin/env python3
# This is a Python application stored in a ZIP archive, created with
# pyzaa.
(binary contents of archive)
As background, ZIP archives are defined with a footer containing relative
offsets from the end of the file. They remain valid when concatenated to
the end of any other file. This feature is completely standard and is how
self-extracting ZIP archives and the bdist_wininst installer format work.
As background, ZIP archives are defined with a footer containing
relative offsets from the end of the file. They remain valid when
concatenated to the end of any other file. This feature is completely
standard and is how self-extracting ZIP archives and the bdist_wininst
installer format work.
Minimal Tooling: The pyzaa Module
=================================
This PEP also proposes including a simple application for working with
these archives: The Python Zip Application Archiver “pyzaa” (rhymes
with “huzzah” or “pizza”). “pyzaa” can archive these files,
compile bytecode, and can write the __main__ module if it is not present.
with “huzzah” or “pizza”). “pyzaa” can archive these files, compile
bytecode, and can write the __main__ module if it is not present.
Usage
-----
@ -88,7 +90,7 @@ Usage
pyzaa pack will warn if the directory contains C extensions or if
it doesnt contain __main__.py.
``python -m pyzaa compile arcname.pyz[w]``
``python -m pyzaa compile arcname.pyz[w]``::
The Python files in arcname.pyz[w] are compiled and appended to the
ZIP file.
@ -97,6 +99,7 @@ A standard ZIP utility or Pythons zipfile module can unpack the
archives.
FAQ
---
Q. Are you sure a standard ZIP utility can handle #! at the beginning?
@ -109,21 +112,31 @@ A. Yes.
Q. How does this compete with existing sdist/bdist formats?
A. There is some overlap, but .pyz files are especially interesting
as a way to distribute an installer. They may also prove useful as a
as a way to distribute an installer. They may also prove useful as a
way to deliver applications when users shouldnt be asked to perform
virtualenv + “pip install”.
References
==========
.. [1] “Allow interpreter to execute a zip file”:
http://bugs.python.org/issue1739468
.. [1] “Allow interpreter to execute a zip file”
(http://bugs.python.org/issue1739468)
.. [2] “Feature is not documented”:
http://bugs.python.org/issue17359
.. [2] “Feature is not documented”
(http://bugs.python.org/issue17359)
Copyright
=========
This document has been placed into the public domain.
..
Local Variables:
mode: indented-text
indent-tabs-mode: nil
sentence-end-double-space: t
fill-column: 70
coding: utf-8
End: