# AUTOGENERATED! DO NOT EDIT! File to edit: ../../notebooks/utils/15_kedro.ipynb.

# %% auto 0
__all__ = ['load_context']

# %% ../../notebooks/utils/15_kedro.ipynb 0
from kedro.config import OmegaConfigLoader
from kedro.io import DataCatalog

from kedro.framework.session import KedroSession
from kedro.framework.startup import bootstrap_project
from kedro.ipython import _resolve_project_path

# %% ../../notebooks/utils/15_kedro.ipynb 5
def load_context(project_path: str, params_only: bool = False, catalog_only: bool = False):
    project_path = _resolve_project_path(project_path)
    metadata = bootstrap_project(project_path)
    # configure_project(metadata.package_name)

    session = KedroSession.create(
        metadata.package_name, project_path,
    )
    context = session.load_context()

    if params_only:
        return context.params
    if catalog_only:
        return context.catalog
    else:
        return context
