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

Eric Snow ericsnowcurrently at gmail.com
Mon Jul 10 15:40:40 EDT 2017


On Sat, Jul 8, 2017 at 5:56 PM, Brett Cannon <brett at python.org> wrote:
> [snip]
> 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.
> [snip]
>
> Please have a look at
> https://notebooks.azure.com/Brett/libraries/di2Btqj7zSI/html/Lazy%20importing.ipynb
> and let me know if I'm missing anything.

LGTM.  It's good that the class mirrors FileFinder.

The only things I'd possibly suggest are:

 * name the class LazyLoadingFileFinder
 * make activate_lazy_loading() be a classmethod on PathFinder

Both make it clear that they only relate to path-entry finders.

I have some other concerns but they aren't problems with your
proposal. :)  Mostly, I still want to see a better high-level
interface to the import machinery (i.e. "ImportSystem").  Having to
poke things directly into the import state (e.g. sys.path_hooks) isn't
ideal.  However, I don't think my concerns are critical for this
proposal so I won't elaborate here. :)

-eric


More information about the Import-SIG mailing list