generalimport icon indicating copy to clipboard operation
generalimport copied to clipboard

Handle all your optional dependencies with a single call!

Results 13 generalimport issues
Sort by recently updated
recently updated
newest added

A topic closely related to optional imports are lazy imports. When a package is optional, it commonly happens that even though it is installed, it is not used for some...

I think that might be the issue, flask is iterating module names internally with this code ``` for module in list(sys.modules.values()): name = getattr(module, "__file__", None) if name is None...

Since release 0.5.0, `MissingOptionalDependency` is no more an `Exception`, which breaks all usages such as: ``` try: import hello except MissingOptionalDependency as e: .... ``` as they now raise: `TypeError:...

Sometimes a failing test will raise our custom exception which will skip the test, which will hide the actual problem. Would be nice to be able to decorate something like...

Fixes https://github.com/ManderaGeneral/generalimport/issues/27 This PR adds an implementation of `__mro_entries__` to `FakeModule`. This method returns a "FakeBaseClass" class whose `__init__` (and `__new__`, for good measure) trigger a `MissingOptionalDependency` exception. In this...

Running the test suite on `master` shows two failing tests: ``` > python --version Python 3.10.6 > pytest generalimport/test/ ============================================== test session starts ============================================== platform linux -- Python 3.10.6, pytest-7.3.0,...

``` generalimport("hello") import hello print(hello.name) ``` Doesn't trigger the error now

Using it for `pkg_resources.working_set.by_key` Also need to update SO if a fix is found https://stackoverflow.com/questions/739993/how-do-i-get-a-list-of-locally-installed-python-modules/73958089#73958089

As discussed in https://github.com/ManderaGeneral/generalimport/issues/18, we can consider adding some linting and code formatting facilities to this project. I opened the issue here not to make noise on `generalpackager`, but feel...

## Problem So far `generalimport` does not allow users to create subclasses of missing dependencies. So this code: ```python generalimport("my_module") import my_module class SubClass(my_module.BaseClass): def __init__(self): ... ``` fails with:...