Loving your lazy_import package. Thanks for the work!
TL;DR could we have a scenario where package imports Class1 lazily but allows other direct imports of that Class1 not to be lazy? Maybe it's possible but I couldn't see how. Generally I like that the lazy_import has its effects globally, but at times I'd like that not to be the case.
The issue I'm having, that's currently limiting my use of it, is the fact that it prevents any use of subclassing, as far as I can tell. I understand why this is the case (the fact that we import a wrapper for the object rather than the actual object) but as far as I can see there are no workarounds for people that really need the subclass.
Consider the structure (in a large project):
package.subpackage1.Class1package.subpackage2.Class2
I would like to allow the user two routes to access the classes:
from package import Class1 (so within package I do lazy_import.lazy_class("subpackage1.Class1"))
but I'd also like to allow from package.subpackage1 import Class1 for a true import of the class allowing subclassing
Why?
Class1 and Class2 are the main classes in their subpackages (separated into different files to keep files manageable) so it's convenient to make them directly available from main_package.
They are also large so we don't always want to import them if the user won't use them
Occasional users do want to subclass though. If there's no way to do this after setting the lazy_import code then it's a deal-breaker
Loving your lazy_import package. Thanks for the work!
TL;DR could we have a scenario where
package
importsClass1
lazily but allows other direct imports of that Class1 not to be lazy? Maybe it's possible but I couldn't see how. Generally I like that the lazy_import has its effects globally, but at times I'd like that not to be the case.The issue I'm having, that's currently limiting my use of it, is the fact that it prevents any use of subclassing, as far as I can tell. I understand why this is the case (the fact that we import a wrapper for the object rather than the actual object) but as far as I can see there are no workarounds for people that really need the subclass.
Consider the structure (in a large project):
package.subpackage1.Class1
package.subpackage2.Class2
I would like to allow the user two routes to access the classes:
from package import Class1
(so withinpackage
I dolazy_import.lazy_class("subpackage1.Class1")
)from package.subpackage1 import Class1
for a true import of the class allowing subclassingWhy?
main_package
.