[Import-SIG] Proposal for a lazy-loading finder

Antoine Pitrou solipsis at pitrou.net
Sun Jul 9 06:03:41 EDT 2017


On Sat, 08 Jul 2017 23:56:05 +0000
Brett Cannon <brett at python.org> wrote:
> At PyCon US I found out that even though I tried to minimize people using
> importlib.util.LazyLoader, a bunch of people are using beyond the intended
> audience which was advanced Python users such as the Mercurial team.
> Knowing that people were somewhat ignoring the warnings about the dangers
> of using LazyLoader, I figured it was finally time to implement a
> lazy-loading finder to make sure people don't duplicate the same work and
> to make sure that it is implemented properly and can change as importlib
> itself does. (Plus I needed a coding break from workflow stuff while I was
> stuck in the US for a conference :) .
> 
> Please have a look at
> https://notebooks.azure.com/Brett/libraries/di2Btqj7zSI/html/Lazy%20importing.ipynb

Are LazyLoadingFinder() and activate_lazy_loading() as quoted there
really all that's needed?  Sounds good :-)

I would suggest allow people to fully customize the blacklist /
whitelist logic using a callable (because looking up by fullname is a
bit inflexible).

Regards

Antoine.




More information about the Import-SIG mailing list