classification
Title: Prefix search is filesystem-centric
Type: enhancement Stage: test needed
Components: Interpreter Core Versions: Python 3.3
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: brett.cannon, carljm, eric.araujo, eric.snow, holdenweb, ncoghlan, terry.reedy
Priority: low Keywords:

Created on 2005-02-04 22:16 by holdenweb, last changed 2012-02-27 18:55 by eric.snow.

Messages (5)
msg60644 - (view) Author: Steve Holden (holdenweb) * (Python committer) Date: 2005-02-04 22:16
With the introduction of zipimport I experimented to
determine how much of the standard library could be
provided in zip format.

I discovered that I could entirely remove the standard
library, replacing it with /lib/python24.zip, with the
following caveats (this is under Cygwin, where /usr/lib
appears to be a loopback mount of /lib: paths will
differ on other platforms):

1. The /lib/python2.4/lib-dynload directory had to be
copied to the /lib directory to make zlib available to
zipimport;

2. The interpreter now produced three error messages:
"Could not find platform independent libraries <prefix>"
"Could not find platform dependent libraries <exec_prefix>"
"Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]"

With the move towards esoteric import mechanisms it
seems that the searches for os.py in the filesystem
might no longer be an appropriate way to start
executing the interpreter.

Should some import hook API be available to determine
whether standard libraries are available without
actually importing anything?
msg113379 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2010-08-09 04:30
Is this request still relevant for 3.2?
msg113406 - (view) Author: Steve Holden (holdenweb) * (Python committer) Date: 2010-08-09 11:37
Personally I think it's just as relevant as it always was, particularly with the introduction of importlib, but Brett will have a more informed opinion. I won't be surprised if this issue is closed as wontfix.
msg154337 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2012-02-26 12:26
Yeah, I'm pretty sure the bootstrap mechanism needs to be able to get hold of os.py directly so it can be injected into the importlib._bootstrap namespace.

However, it may be worth figuring out and documenting the bare minimum that has to exist on the filesystem in order for importlib to get going.

It's even possible that Brett freezes enough into the interpreter binary that the required set has shrunk to zero.
msg154370 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2012-02-26 16:59
Importlib actually requires no files from disk; everything that is required for importlib are built-in modules or are constants in importlib itself (e.g. os.sep). So technically this should be doable since my bootstrap work freezes importlib itself.
History
Date User Action Args
2012-02-27 18:55:06eric.snowsetnosy: + eric.snow
2012-02-26 16:59:17brett.cannonsetmessages: + msg154370
2012-02-26 12:26:35ncoghlansetnosy: + ncoghlan
messages: + msg154337
2012-02-25 07:18:42eric.araujosetnosy: + carljm, eric.araujo

versions: - Python 3.2
2012-02-24 11:05:52ezio.melottisetversions: + Python 3.3
2010-08-09 11:37:35holdenwebsetmessages: + msg113406
2010-08-09 04:30:55terry.reedysetnosy: + terry.reedy

messages: + msg113379
versions: + Python 3.2, - Python 3.1, Python 2.7
2009-02-15 22:33:44ajaksu2setnosy: + brett.cannon
stage: test needed
type: enhancement
versions: + Python 3.1, Python 2.7
2005-02-04 22:16:00holdenwebcreate