msticpy.common.utility.package module
Packaging utility functions.
- msticpy.common.utility.package.check_and_install_missing_packages(required_packages, force_notebook=False, user=False, upgrade=False)
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=(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, attrib, call=False)
Import attribute from module on demand.
- Parameters:
module (str)
attrib (str)
call (bool)
- msticpy.common.utility.package.init_dir(static_attribs, dynamic_imports)
Return list of available attributes.
- Parameters:
static_attribs (list[str])
dynamic_imports (dict[str, str])
- msticpy.common.utility.package.init_getattr(module_name, dynamic_imports, attrib)
Import and return dynamic attribute.
- Parameters:
module_name (str)
dynamic_imports (dict[str, str])
attrib (str)
- msticpy.common.utility.package.mp_ua_header()
Return headers dict for MSTICPy User Agent.
- Return type:
dict[str, str]
- msticpy.common.utility.package.resolve_pkg_path(part_path)
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, paths=None)
Search paths for file pattern.
- Parameters:
pattern (str)
paths (list[str | Path])
- Return type:
str | None
- msticpy.common.utility.package.search_module(pattern)
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)
Display matching modules as list or HTML table.
- Parameters:
pattern (str) – Substring or regular expression
- Return type:
None
- msticpy.common.utility.package.set_unit_testing(on=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()
Return True if in unit testing.
- Returns:
True if in unit testing
- Return type:
bool