[Python-Dev] PEP 370 heads up

Christian Heimes lists at cheimes.de
Wed May 7 00:38:16 CEST 2008


Dear fellow Pythonistas!

Guido has accepted my user site directory PEP today.
http://python.org/dev/peps/pep-0370/

I'm about the merge the code. But first I like to let you know some
things and get your opinion.

The location of the user site-package directory stays as written in my
PEP. The master himself said "The location will be somewhere under
~/.local for Unix/Linux/OS X, and %APPDATA%/Python for Windows (per the
original proposal in the PEP)." Please do NOT take my check-in message
as an opportunity to start yet the third bike shed discussion. Thank you
very much! :)

The PEP adds two environment vars to adjust the location of the user
site directory to your liking or to disable the feature entirely. If you
are still not convinced you are better off by adding a single line to
your .profile file.

For now the unit tests are creating the user site directory tree. I'm
going to chance that in a few days unless everybody is fine with it.

The docs aren't finished yet. Unless somebody is faster than me (*wink*)
I'm going to work on the docs after I've finished the rework of the json
module. As Brett suggested I'm going to module its input and return
values after the pickle module before I merge it into the py3k branch.
It's currently mixing unicode and str in a way which is not compatible
with py3k.

I've added some additional code to the site module. It should become in
handy for scripters, debugging and unit tests:

$ ./python -m site
sys.path = [
    '/home/heimes/dev/python/trunk',
    '/usr/local/lib/python26.zip',
    '/home/heimes/dev/python/trunk/Lib',
    '/home/heimes/dev/python/trunk/Lib/plat-linux2',
    '/home/heimes/dev/python/trunk/Lib/lib-tk',
    '/home/heimes/dev/python/trunk/Modules',
    '/home/heimes/dev/python/trunk/build/lib.linux-i686-2.6-pydebug',
    '/home/heimes/.local/lib/python2.6/site-packages',
]
USER_BASE: '/home/heimes/.local' (exists)
USER_SITE: '/home/heimes/.local/lib/python2.6/site-packages' (exists)
ENABLE_USER_SITE: True


$ ./python -m site --help
/home/heimes/dev/python/trunk/Lib/site.py [--user-base] [--user-site]

Without arguments print some useful information
With arguments print the value of USER_BASE and/or USER_SITE separated
by ':'.

Exit codes with --user-base or --user-site:
  0 - user site directory is enabled
  1 - user site diretory is disabled by user
  2 - uses site directory is disabled by super user
      or for security reasons
 >2 - unknown error


$ ./python -m site --user-base --user-site
/home/heimes/.local:/home/heimes/.local/lib/python2.6/site-packages
$ echo $?
0

$ ./python -s -m site --user-base --user-site
/home/heimes/.local:/home/heimes/.local/lib/python2.6/site-packages
$ echo $?
1


Christian


More information about the Python-Dev mailing list