Main functions¶
feu ¶
Root package of feu
.
feu.compare_version ¶
compare_version(
package: str, op: Callable, version: str
) -> bool
Compare a package version to a given version.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
package
|
str
|
Specifies the package to check. |
required |
op
|
Callable
|
Specifies the comparison operator. |
required |
version
|
str
|
Specifies the version to compare with. |
required |
Returns:
Type | Description |
---|---|
bool
|
The comparison status. |
Example usage:
>>> import operator
>>> from feu import compare_version
>>> compare_version("pytest", op=operator.ge, version="7.3.0")
True
feu.get_package_version ¶
get_package_version(package: str) -> Version | None
Get the package version.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
package
|
str
|
Specifies the package name. |
required |
Returns:
Type | Description |
---|---|
Version | None
|
The package version. |
Example usage:
>>> from feu import get_package_version
>>> get_package_version("pytest")
<Version('...')>
feu.install_package ¶
install_package(package: str, version: str) -> None
Install a package and associated packages.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
package
|
str
|
The package name e.g. |
required |
version
|
str
|
The target version to install. |
required |
Example usage:
>>> from feu import install_package
>>> install_package("pandas", "2.2.2") # doctest: +SKIP
feu.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 |
Example usage:
>>> from feu import is_module_available
>>> is_module_available("os")
True
>>> is_module_available("os.path")
True
>>> is_module_available("missing.module")
False
feu.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
|
|
Example usage:
>>> from feu import is_package_available
>>> is_package_available("os")
True
>>> is_package_available("os.path")
True
>>> is_package_available("my_missing_package")
False