goalie.is_installed

goalie.is_installed(x: object) bool

Check whether a Python package is installed (importable).

Does not import the package; uses importlib.util.find_spec.

Parameters:

x (object) – Package name.

Returns:

True if the package is importable.

Return type:

bool

Examples

>>> is_installed("os")
True
>>> is_installed("nonexistent_pkg_xyz_abc")
False