Proposal for a lazy-loading finder
Brett Cannon <[email protected]> Sat, 08 Jul 2017 23:56:05 +0000
| Newsgroups | gmane.comp.python.import |
|---|---|
| Message-ID | <CAP1=2W7RG+U6Ns8--kwtzDKkgvzaLRXt-mnAamW=HbMaXqfEKg@mail.gmail.com> |
--===============2167914513708831760== Content-Type: multipart/alternative; boundary="001a11441b0c6ffdcc0553d718ee" --001a11441b0c6ffdcc0553d718ee Content-Type: text/plain; charset="UTF-8" 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 and let me know if I'm missing anything. I asked on Twitter if this would work for Mercurial and it turns out it closely mirrors what they already do: https://twitter.com/sid0/status/882775009051123712 (which is great since I didn't look at their code to avoid any GPL issues even though our relationship with the Mercurial devs is good enough to not have them sue us over code re-use :) . With independent verification that the approach works I'm fairly confident this can go into Python 3.7, but I still wanted to double-check with this mailing list to make sure the API design and approach seem sound. --001a11441b0c6ffdcc0553d718ee Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr">At PyCon US I found out that even though I tried to minimi= ze people using importlib.util.LazyLoader, a bunch of people are using beyo= nd the intended audience which was advanced Python users such as the Mercur= ial 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 a= nd 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 :) .<div><br></div><div>Please have a loo= k at=C2=A0<a href=3D"https://notebooks.azure.com/Brett/libraries/di2Btqj7zS= I/html/Lazy%20importing.ipynb">https://notebooks.azure.com/Brett/libraries/= di2Btqj7zSI/html/Lazy%20importing.ipynb</a>=C2=A0and let me know if I'm= missing anything. I asked on Twitter if this would work for Mercurial and = it turns out it closely mirrors what they already do: <a href=3D"https://tw= itter.com/sid0/status/882775009051123712">https://twitter.com/sid0/status/8= 82775009051123712</a>=C2=A0(which is great since I didn't look at their= code to avoid any GPL issues even though our relationship with the Mercuri= al devs is good enough to not have them sue us over code re-use :) . With i= ndependent verification that the approach works I'm fairly confident th= is can go into Python 3.7, but I still wanted to double-check with this mai= ling list to make sure the API design and approach seem sound.</div></div> --001a11441b0c6ffdcc0553d718ee-- --===============2167914513708831760== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Import-SIG mailing list [email protected] https://mail.python.org/mailman/listinfo/import-sig --===============2167914513708831760==--