[issue17621] Create a lazy import loader mixin

2014-04-04 Thread Roundup Robot
Roundup Robot added the comment: New changeset 52b58618199c by Brett Cannon in branch 'default': Issue #17621: Introduce importlib.util.LazyLoader. http://hg.python.org/cpython/rev/52b58618199c -- nosy: +python-dev ___ Python tracker

[issue17621] Create a lazy import loader mixin

2014-04-04 Thread Brett Cannon
Brett Cannon added the comment: I went ahead and committed. I realized I could loosen the no create_module() requirement, but I think it could lead to more trouble than it's worth so I left it as-is for now. If people says it's an issue we can revisit it. -- resolution: - fixed

[issue17621] Create a lazy import loader mixin

2014-04-04 Thread Eric Snow
Eric Snow added the comment: Sweet! -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17621 ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue17621] Create a lazy import loader mixin

2014-03-27 Thread Brett Cannon
Brett Cannon added the comment: So as-is, this won't help with startup as we already make sure that no unnecessary modules are loaded during startup. But one way we do that is through local imports in key modules, e.g. os.get_exec_path(). So what we could consider is instead of doing a local

[issue17621] Create a lazy import loader mixin

2014-03-26 Thread Thomas Wouters
Changes by Thomas Wouters tho...@python.org: -- nosy: +twouters ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17621 ___ ___ Python-bugs-list

[issue17621] Create a lazy import loader mixin

2014-03-26 Thread Augie Fackler
Changes by Augie Fackler li...@durin42.com: -- nosy: +durin42 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17621 ___ ___ Python-bugs-list mailing

[issue17621] Create a lazy import loader mixin

2014-03-26 Thread Eric Snow
Eric Snow added the comment: I wonder if there would be any benefit to using this for some of the modules that get loaded during startup. I seem to remember there being a few for which lazy loading would have an effect. -- ___ Python tracker

[issue17621] Create a lazy import loader mixin

2014-03-26 Thread Eric Snow
Eric Snow added the comment: New review posted. Basically LGTM. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17621 ___ ___ Python-bugs-list

[issue17621] Create a lazy import loader mixin

2014-03-23 Thread Brett Cannon
Brett Cannon added the comment: Another update to trigger loading on attribute deletions as well as detecting when an import swapped the module in sys.modules, raising ValueError if detected since it won't have the affect that's expected (could be convinced to make that ImportError instead).

[issue17621] Create a lazy import loader mixin

2014-03-22 Thread Eric Snow
Eric Snow added the comment: Review posted. Thanks for working on this, Brett. -- nosy: +eric.snow ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17621 ___

[issue17621] Create a lazy import loader mixin

2014-03-22 Thread Jakub Wilk
Changes by Jakub Wilk jw...@jwilk.net: -- nosy: +jwilk ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17621 ___ ___ Python-bugs-list mailing list

[issue17621] Create a lazy import loader mixin

2014-03-22 Thread Brett Cannon
Brett Cannon added the comment: Here is a new patch that addresses Eric's comments and also fills in some holes that I realized I had while fixing things up. PTAL. -- Added file: http://bugs.python.org/file34575/lazy_loader.diff ___ Python tracker

[issue17621] Create a lazy import loader mixin

2014-03-22 Thread Brett Cannon
Changes by Brett Cannon br...@python.org: Removed file: http://bugs.python.org/file34575/lazy_loader.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17621 ___

[issue17621] Create a lazy import loader mixin

2014-03-22 Thread Brett Cannon
Changes by Brett Cannon br...@python.org: Added file: http://bugs.python.org/file34576/lazy_loader.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17621 ___

[issue17621] Create a lazy import loader mixin

2014-03-21 Thread Brett Cannon
Brett Cannon added the comment: New patch that includes docs and integrates the tests. If someone who understands import can look it over and give me an LGTM that would be appreciated. -- Added file: http://bugs.python.org/file34556/lazy_loader.diff

[issue17621] Create a lazy import loader mixin

2014-02-06 Thread Brett Cannon
Brett Cannon added the comment: Here is a patch which implements a lazy loader for loaders that define exec_module(). -- keywords: +patch Added file: http://bugs.python.org/file33947/lazy_loader.diff ___ Python tracker rep...@bugs.python.org

[issue17621] Create a lazy import loader mixin

2014-02-06 Thread Brett Cannon
Changes by Brett Cannon br...@python.org: -- dependencies: -Make isinstance() work with super type instances ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17621 ___

[issue17621] Create a lazy import loader mixin

2014-02-06 Thread Brett Cannon
Changes by Brett Cannon br...@python.org: -- stage: test needed - patch review ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17621 ___ ___

[issue17621] Create a lazy import loader mixin

2013-12-14 Thread Brett Cannon
Brett Cannon added the comment: Need to quickly test that this will work with PEP 451 works with the design in my head before we get farther into 3.4. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17621

[issue17621] Create a lazy import loader mixin

2013-12-14 Thread Brett Cannon
Brett Cannon added the comment: Attached is a script to verify that PEP 451 works as desired, so Python 3.5 doesn't have any technical blockers for doing a lazy loader for PEP 451 loaders. And with __spec__.loader_state it might be possible to work things out through a common API to work

[issue17621] Create a lazy import loader mixin

2013-11-08 Thread Brett Cannon
Brett Cannon added the comment: Shifting this to Python 3.5 to rework using the forthcoming PEP 451 APIs which have been designed to explicitly allow for a lazy loader. -- versions: +Python 3.5 -Python 3.4 ___ Python tracker rep...@bugs.python.org

[issue17621] Create a lazy import loader mixin

2013-11-01 Thread Brett Cannon
Brett Cannon added the comment: Won't work until PEP 451 code lands and lets us drop __package__/__loader__ checking/setting post-load. -- dependencies: +Implementation for PEP 451 (importlib.machinery.ModuleSpec) ___ Python tracker

[issue17621] Create a lazy import loader mixin

2013-06-24 Thread Brett Cannon
Brett Cannon added the comment: Import manages the lock, not loaders. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17621 ___ ___

[issue17621] Create a lazy import loader mixin

2013-06-24 Thread Richard Oudkerk
Richard Oudkerk added the comment: I was thinking about the line self.__dict__.update(state) overwriting new data with stale data. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17621

[issue17621] Create a lazy import loader mixin

2013-06-24 Thread Brett Cannon
Brett Cannon added the comment: It still falls under the purview of import to manage that lock. It's just the design of the API from PEP 302. Otherwise it's just like any other reload. -- ___ Python tracker rep...@bugs.python.org

[issue17621] Create a lazy import loader mixin

2013-06-22 Thread Arfrever Frehtes Taifersar Arahesis
Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com: -- nosy: +Arfrever ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17621 ___

[issue17621] Create a lazy import loader mixin

2013-06-22 Thread Richard Oudkerk
Richard Oudkerk added the comment: Apologies for being dense, but how would you actually use such a loader? Would you need to install something in sys.meta_path/sys.path_hooks? Would it make all imports lazy or only imports of specified modules? -- nosy: +sbt

[issue17621] Create a lazy import loader mixin

2013-06-22 Thread Brett Cannon
Brett Cannon added the comment: So the approaches I have been using make a loader lazy, so what you have to change in terms of sys.meta_path, sys.path_hooks, etc. would very from loader to loader. I have realized one tricky thing with all of this is that importlib itself inspects modules

[issue17621] Create a lazy import loader mixin

2013-06-22 Thread Brett Cannon
Changes by Brett Cannon br...@python.org: Added file: http://bugs.python.org/file30670/test_lazy_loader.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17621 ___

[issue17621] Create a lazy import loader mixin

2013-06-22 Thread Brett Cannon
Changes by Brett Cannon br...@python.org: Added file: http://bugs.python.org/file30671/lazy_mixin.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17621 ___

[issue17621] Create a lazy import loader mixin

2013-06-22 Thread Brett Cannon
Brett Cannon added the comment: I have attached the test suite and two versions: one using a mixin and one using a proxy. Neither solve the issue of import touching the module in any way to check __loader__ and __package__. The mixin version is also failing one test which could quite possibly

[issue17621] Create a lazy import loader mixin

2013-06-22 Thread Richard Oudkerk
Richard Oudkerk added the comment: Shouldn't the import lock be held to make it threadsafe? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17621 ___

[issue17621] Create a lazy import loader mixin

2013-06-21 Thread Brett Cannon
Brett Cannon added the comment: While seing if it was worth making isinstance work with super(), I came up with this at Antoine's suggestion of using a proxy instead of a mixin: class LazyProxy(importlib.abc.Loader): def __init__(self, loader): self.loader = loader def

[issue17621] Create a lazy import loader mixin

2013-06-21 Thread Brett Cannon
Brett Cannon added the comment: I think the first step for this bug, now that I have two possible approaches, is to write the unit tests. That way both approaches can equally be validated based on their merits of complexity, etc. while verifying the work properly. --

[issue17621] Create a lazy import loader mixin

2013-06-20 Thread Brett Cannon
Brett Cannon added the comment: One problem with the importers code is it doesn't properly clean up after the module if the load failed and it wasn't a reload. Should store an attribute on the module signaling whether it was a reload or not to know whether an exception raised during loading

[issue17621] Create a lazy import loader mixin

2013-04-02 Thread Brett Cannon
New submission from Brett Cannon: People keep asking and I keep promising to get a lazy loader into Python 3.4. This issue is for me to track what I have done towards meeting that promise. To start, I have something working at https://code.google.com/p/importers/, but I need to make sure that

[issue17621] Create a lazy import loader mixin

2013-04-02 Thread Barry A. Warsaw
Changes by Barry A. Warsaw ba...@python.org: -- nosy: +barry ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17621 ___ ___ Python-bugs-list mailing

[issue17621] Create a lazy import loader mixin

2013-04-02 Thread Eric V. Smith
Changes by Eric V. Smith e...@trueblade.com: -- nosy: +eric.smith ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17621 ___ ___ Python-bugs-list