Skip to content

Imports

feu.imports

Contain functions to check if a package or module is available.

feu.imports.check_click

check_click() -> None

Check if the click package is installed.

Raises:

Type Description
RuntimeError

if the click package is not installed.

Example
>>> from feu.imports import check_click
>>> check_click()

feu.imports.check_git

check_git() -> None

Check if the git package is installed.

Raises:

Type Description
RuntimeError

if the git package is not installed.

Example
>>> from feu.imports import check_git
>>> check_git()

feu.imports.check_requests

check_requests() -> None

Check if the requests package is installed.

Raises:

Type Description
RuntimeError

if the requests package is not installed.

Example
>>> from feu.imports import check_requests
>>> check_requests()

feu.imports.check_urllib3

check_urllib3() -> None

Check if the urllib3 package is installed.

Raises:

Type Description
RuntimeError

if the urllib3 package is not installed.

Example
>>> from feu.imports import check_urllib3
>>> check_urllib3()

feu.imports.is_click_available cached

is_click_available() -> bool

Indicate if the click package is installed or not.

Returns:

Type Description
bool

True if click is available otherwise False.

Example
>>> from feu.imports import is_click_available
>>> is_click_available()

feu.imports.is_git_available cached

is_git_available() -> bool

Indicate if the git package is installed or not.

Returns:

Type Description
bool

True if git is available otherwise False.

Example
>>> from feu.imports import is_git_available
>>> is_git_available()

feu.imports.is_module_available cached

is_module_available(module: str) -> bool

Check if a module path is available.

Parameters:

Name Type Description Default
module str

The module to check.

required

Returns:

Type Description
bool

True if the module is available, otherwise False.

Example
>>> from feu import is_module_available
>>> is_module_available("os")
True
>>> is_module_available("os.path")
True
>>> is_module_available("missing.module")
False

feu.imports.is_package_available cached

is_package_available(package: str) -> bool

Check if a package is available.

Parameters:

Name Type Description Default
package str

The package name to check.

required

Returns:

Type Description
bool

True if the package is available, otherwise False.

Example
>>> from feu import is_package_available
>>> is_package_available("os")
True
>>> is_package_available("os.path")
True
>>> is_package_available("my_missing_package")
False

feu.imports.is_requests_available cached

is_requests_available() -> bool

Indicate if the requests package is installed or not.

Returns:

Type Description
bool

True if requests is available otherwise False.

Example
>>> from feu.imports import is_requests_available
>>> is_requests_available()

feu.imports.is_urllib3_available cached

is_urllib3_available() -> bool

Indicate if the urllib3 package is installed or not.

Returns:

Type Description
bool

True if urllib3 is available otherwise False.

Example
>>> from feu.imports import is_urllib3_available
>>> is_urllib3_available()

feu.imports.raise_error_click_missing

raise_error_click_missing() -> NoReturn

Raise a RuntimeError to indicate the click package is missing.

feu.imports.raise_error_git_missing

raise_error_git_missing() -> NoReturn

Raise a RuntimeError to indicate the git package is missing.

feu.imports.raise_error_requests_missing

raise_error_requests_missing() -> NoReturn

Raise a RuntimeError to indicate the requests package is missing.

feu.imports.raise_error_urllib3_missing

raise_error_urllib3_missing() -> NoReturn

Raise a RuntimeError to indicate the urllib3 package is missing.

feu.imports.raise_package_missing_error

raise_package_missing_error(
    package_name: str, install_cmd: str
) -> NoReturn

Raise a RuntimeError for a missing package.

Parameters:

Name Type Description Default
package_name str

The name of the missing package.

required
install_cmd str

The pip install command for the package.

required

Raises:

Type Description
RuntimeError

Always raised to indicate the package is missing.