Brett Cannon <br...@python.org> added the comment:

The other problem is zipimport is written in C and no one wants to deal with 
that headache if possible. ;) We actually tweaked the importlib.resources API 
specifically to avoid having to muck with zipimport's C code as it would have 
required major surgery otherwise. Thomas has also been saying he was planning 
to upstream the improvements he has made to zipimport internally at Google 
which also demotivates touching the code knowing that changes are planned.

As for Steve's comment, the tricky bit is zipfile has a bunch of dependencies, 
so it's not so simple to just freeze that one module  and wrap it with 
importlib to be able to load the stdlib from a zip file (which zipimport 
supports). Basically zip-reading code needs to be written that can be 
bootstrapped (C or Python), and then use that in importlib to be able to import 
the stdlib from a zip file.

I have also been toying with the idea of a zippath module that would take 
pathlib's API and apply it to zip files acting like a self-contained file 
system, but I have never bothered as zipfile's API is messy. The "all the time 
in the world" project would be making all of this come together in a release of 
Python by building off of each other: new code to read zip files written in 
freezable Python, use importlib to replace zipimport, and provide a pathlib API 
to work with zip files (which would probably be partially built for use by 
importlib).

If I drop my idea of putting a package on PyPI to do lazy importing I could 
look at tackling this for 3.8.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue30891>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to