The pyedb.internal.checks library#
Summary#
Generate an installation message for missing dependencies. |
|
Check whether a Python dependency can be imported. |
|
Decorate a method as requiring specific graphics dependencies. |
Description#
Provides functions for performing common checks.
Module detail#
- checks.install_message(dependency: str | list[str], target: str, level: str = 'method') str#
Generate an installation message for missing dependencies.
Examples
>>> from pyedb.internal.checks import install_message >>> install_message("pyvista", "graphics")
- checks.check_dependency(dependency: str, target: str = 'all', warning: bool = False) bool#
Check whether a Python dependency can be imported.
- Parameters:
- dependency
str Dependency name or importable module path. Known aliases in
_DEPENDENCY_IMPORT_ALIASESare resolved to their import module automatically.- target
str,optional PyAEDT installation target to mention in the error message. Defaults to
"all".- warningbool,
optional If True, issue a warning instead of raising an error. Default is False.
- dependency
- Returns:
- bool
True if the dependency is available, False if unavailable and warning is True.
- Raises:
ImportErrorIf dependency is not available and warning is False.
Examples
>>> from pyedb.internal.checks import check_dependency >>> check_dependency("pyvista", target="graphics")
- checks.requires_dotnet_dependency(*dependencies: str) collections.abc.Callable[[_F], _F]#
Decorate a method as requiring specific graphics dependencies.
The main goal of this decorator is to isolate the logic around checking graphics dependencies and providing consistent error messages across methods that require such dependencies.
- Parameters:
- *dependencies
str Names of required dependencies (e.g., ‘pyvista’, ‘matplotlib’, ‘vtk’).
- *dependencies
- Returns:
callable()Decorated method.
- Raises:
ImportErrorIf any of the required dependencies are not available.
Examples
>>> from pyedb.internal.checks import requires_dotnet_dependency >>> decorator = requires_dotnet_dependency("ansys-pythonnet", "dotnet") >>> callable(decorator) True