mnmelo / lazy_import

A module for lazy loading of Python modules
Other
86 stars 29 forks source link

Import Could not find a version #1

Closed spacebuoy closed 6 years ago

spacebuoy commented 6 years ago

This lazy import looks like the best match for our needs but returns an error when installing. Running on python 3.6.4 or 3.5.2.

pip install lazy_module Collecting lazy_module Could not find a version that satisfies the requirement lazy_module (from versions: ) No matching distribution found for lazy_module

mnmelo commented 6 years ago

Hi, and thanks for remarking the glaring oversight of forgetting to actually put the code on PyPi!! I'll get to this ASAP, because I'm also quite interested in your usage feedback.

mnmelo commented 6 years ago

There, fixed a couple more things and it is now on PyPi. Feedback appreciated!

mnmelo commented 6 years ago

Further note: besides not being on PyPi (it is now) the docs were outdated and directed you to install lazy_module, when the correct name is lazy_import. Updated a shiny new release to PyPi just to fix this doc mismatch...

spacebuoy commented 6 years ago

Not available yesterday but installed successfully today, I guess after PyPi made it available. Thanks for the quick response and fix. I'll let you know how it goes.

spacebuoy commented 6 years ago

I've tested lazy_module with numpy, numpy.core, secrets, secrets.base64 at command prompt and in class and child class in other module and passed dict in parent to child with numpy.core function calls in child. It works flawlessly and exactly per docs.

Using lazy_module with system imported modules like os e.g. has no effect. The module is always imported. This makes sense since they are already loaded, yes?

lazy_import docs are the most thorough and easy to fallow of all the lazy importers I've looked at.

mnmelo commented 6 years ago

Great that it's working out for you! I'm curious what bug #2 will be...

And indeed as you guessed, if the module is already imported then lazy_import.lazy_module will return the real module. I'll clarify this in the docs.