Skip to content

Load

model_navigator.package.load

load(path, workspace=None)

Load package from provided path.

Parameters:

  • path (Union[str, Path]) –

    The location of package to load

  • workspace (Optional[Union[str, Path]], default: None ) –

    Workspace where packages will be extracted

Returns:

Source code in model_navigator/package/__init__.py
def load(
    path: Union[str, pathlib.Path],
    workspace: Optional[Union[str, pathlib.Path]] = None,
) -> Package:
    """Load package from provided path.

    Args:
        path: The location of package to load
        workspace: Workspace where packages will be extracted

    Returns:
        Package.
    """
    LOGGER.info(f"Loading package from {path} to {workspace}.")
    workspace = Workspace(workspace)
    workspace.initialize()

    loader = PackageLoader()
    package = loader.from_file(path=path, workspace=workspace)
    LOGGER.info(f"Package loaded and unpacked {workspace}.")

    return package