Optional-imports

Latest version: v1.0.4

Safety actively analyzes 622882 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

1.0.4

Fixed issue with some imports. If absolute and relative import fails like with:

python
import dask.array as da


a line running:

python
return importlib.import_module("..array", "dask.array")


is triggered.

1.0.3

Fixed issue with relative imports. Version 1.0.2 could not do `Client = optional_import("dask", "distributed.Client")`. This is now possible.

1.0.2

[1.0.1] - 2021-06-25 - Installation on-the-fly and Class inhertiance.

All goals seemed to be fulfilled in this version.

Added:
- OOP with class inhertiance
- Docstring for function
- Two more arguments (`user_install` prompts the user for install, `auto_install` automatically installs missing packages).

Changed:
- Docstring now part of `_optional_import` function.

1.0.0

Release. Class inheritance did not work in that version.
Using statements like `from package.subpackage.subpackage.subpackage._hidden import _hiddenClass` did not work.
This was because only the getattr() method was used, but some objetcs are not accessible that way.
That's what the from X.Y.Z import Class syntax was for.

Links

Releases

Has known vulnerabilities

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.