Author brett.cannon
Recipients barry, brett.cannon, eric.snow, gvanrossum, lukasz.langa, ncoghlan, paul.moore, serhiy.storchaka, steve.dower, tim.golden, twouters, vstinner, zach.ware
Date 2018-04-03.16:56:19
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1522774579.58.0.467229070634.issue30891@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2018-04-03 16:56:19brett.cannonsetrecipients: + brett.cannon, gvanrossum, twouters, barry, paul.moore, ncoghlan, vstinner, tim.golden, lukasz.langa, eric.snow, zach.ware, serhiy.storchaka, steve.dower
2018-04-03 16:56:19brett.cannonsetmessageid: <1522774579.58.0.467229070634.issue30891@psf.upfronthosting.co.za>
2018-04-03 16:56:19brett.cannonlinkissue30891 messages
2018-04-03 16:56:19brett.cannoncreate