msticpy.common.utility.package module
Packaging utility functions.
- msticpy.common.utility.package.check_and_install_missing_packages(required_packages: List[str], force_notebook: bool = False, user: bool = False, upgrade: bool = False) bool
Check and install missing packages from provided list of packages.
- Parameters:
required_packages (List[str]) – List of packages to check and install in a current environment Note you can add package version constraints by appending them to the package name, e.g. pandas>=1.01
force_notebook (bool, optional) – Boolean value to force notebook version of progress bar, by default False (autodetect)
user (bool, optional) – Boolean value to toggle user flag while installing pip packages, by default False
upgrade (bool, option) – If true supply –upgrade flag to pip to install the latest version (applies to all package in required_packages)
- Returns:
True if successful, else False
- Return type:
bool
- msticpy.common.utility.package.check_py_version(min_ver: Tuple = (3, 6))
Check that the current python version is not less than min_ver.
- Parameters:
min_ver (Tuple, optional) – Minimum required version, by default (3,6)
- msticpy.common.utility.package.delayed_import(module: str, attrib: str, call: bool = False)
Import attribute from module on demand.
- msticpy.common.utility.package.init_dir(static_attribs: List[str], dynamic_imports: Dict[str, str])
Return list of available attributes.
- msticpy.common.utility.package.init_getattr(module_name: str, dynamic_imports: Dict[str, str], attrib: str)
Import and return dynamic attribute.
- msticpy.common.utility.package.mp_ua_header() Dict[str, str]
Return headers dict for MSTICPy User Agent.
- msticpy.common.utility.package.resolve_pkg_path(part_path: str)
Resolve a path relative to the package.
- Parameters:
part_path (str) – Absolute or relative path to resolve.
- msticpy.common.utility.package.search_for_file(pattern: str, paths: List[str | Path] | None = None) str | None
Search paths for file pattern.
- msticpy.common.utility.package.search_module(pattern: str) Dict[str, str]
Return MSTICPy modules that match pattern.
- Parameters:
pattern (str) – Substring or regular expression
- Returns:
Dict of module name and help URI of matching modules
- Return type:
Dict[str, str]
- msticpy.common.utility.package.search_name(pattern: str) None
Display matching modules as list or HTML table.
- Parameters:
pattern (str) – Substring or regular expression
- msticpy.common.utility.package.set_unit_testing(on: bool = True)
Set flag env var to indicated that code is being unit-tested.
- Parameters:
on (bool, optional) – Turn unit testing flag on or off, by default True
- msticpy.common.utility.package.unit_testing() bool
Return True if in unit testing.
- Returns:
True if in unit testing
- Return type:
bool