[Python-Dev] pkgutil, pkg_resource and Python 3.0 name space packages

M.-A. Lemburg mal at egenix.com
Mon Jan 7 17:30:45 CET 2008


On 2008-01-07 17:24, Barry Warsaw wrote:
> On Jan 7, 2008, at 10:12 AM, Guido van Rossum wrote:
> 
>> On Jan 7, 2008 6:32 AM, Barry Warsaw <barry at python.org> wrote:
>>> On Jan 7, 2008, at 9:01 AM, M.-A. Lemburg wrote:
>>>> We could easily resolve that issue, if we add a per-user site-packages
>>>> dir to sys.path in site.py (this is already done for Macs).
>>>
>>> +1.  I've advocated that for years.
> 
>> I'm not sure what this buys given that you can do this using
>> PYTHONPATH anyway, but because of that I also can't be against it. +0
>> from me. Patches for 2.6 gratefully accepted.
> 
> I think it's PEP-worthy too, just so that the semantics get nailed
> down.  Here's a strawman proto-quasi-pre-PEP.
> 
> Python automatically adds ~/.python/site-packages to sys.path; this is
> added /before/ the system site-packages file.  An open question is
> whether it needs to go at the front of the list.  It should definitely
> be searched before the system site-packages.
> 
> Python treats ~/.python/site-packages the same as the system
> site-packages, w.r.t. .pth files, etc.
> 
> Open question: should we add yet another environment variable to control
> this?  It's pretty typical for apps to expose such a thing so that the
> base directory (e.g. ~/.python) can be moved.

I'd suggest to make the "~/.python" part configurable by an
env var, e.g. PYTHONRESOURCES.

Perhaps we could use that directory for other Python-related
resources as well, e.g. an optional sys.path lookup cache (pickled
dictionary of known package/module file locations to reduces Python
startup time).

> I think that's all that's needed.  It would make playing with
> easy_install/setuptools nicer to have this.

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, Jan 07 2008)
>>> Python/Zope Consulting and Support ...        http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________

:::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! ::::


   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
    D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
           Registered at Amtsgericht Duesseldorf: HRB 46611


More information about the Python-Dev mailing list