[Python-checkins] r79370 - in peps/trunk: Makefile pep-3147.txt

barry.warsaw python-checkins at python.org
Wed Mar 24 13:32:09 CET 2010


Author: barry.warsaw
Date: Wed Mar 24 13:32:09 2010
New Revision: 79370

Log:
Make the current proposed solution explicit.
Use Python 2.6 to create the PEPs.



Modified:
   peps/trunk/Makefile
   peps/trunk/pep-3147.txt

Modified: peps/trunk/Makefile
==============================================================================
--- peps/trunk/Makefile	(original)
+++ peps/trunk/Makefile	Wed Mar 24 13:32:09 2010
@@ -5,7 +5,7 @@
 
 PEP2HTML=pep2html.py
 
-PYTHON=python2.5
+PYTHON=python2.6
 
 .SUFFIXES: .txt .html
 

Modified: peps/trunk/pep-3147.txt
==============================================================================
--- peps/trunk/pep-3147.txt	(original)
+++ peps/trunk/pep-3147.txt	Wed Mar 24 13:32:09 2010
@@ -108,6 +108,32 @@
 This scheme has the added benefit of reducing the clutter in a Python
 package directory.
 
+When a Python source file is imported for the first time, a
+`__pycache__` directory will be created in the package directory, if
+one does not already exist.  The pyc file for the imported source will
+be written to the `__pycache__` directory, using the magic-tag
+formatted name.  If either the creation of the `__pycache__` directory
+or the pyc file inside that fails, the import will still succeed, just
+as it does in a pre-PEP-3147 world.
+
+If the py source file is missing, the pyc file inside `__pycache__`
+will be ignored.  This eliminates the problem of accidental stale pyc
+file imports.
+
+For backward compatibility, Python will still support pyc-only
+distributions, however it will only do so when the pyc file lives in
+the directory where the py file *would* have been, i.e. not in the
+`__pycache__` directory.  pyc file outside of `__pycache__` will only
+be imported if the py source file is missing.
+
+Tools such as `py_compile` [15]_ and `compileall` [16]_ will be
+extended to create PEP 3147 formatted layouts automatically, but will
+have an option to create pyc-only distribution layouts.
+
+
+Examples
+---------
+
 What would this look like in practice?
 
 Let's say we have a Python package named `alpha` which contains a


More information about the Python-checkins mailing list