kedro.framework.context.load_context

kedro.framework.context.load_context(project_path, **kwargs)[source]

Loads the KedroContext object of a Kedro Project. This is the default way to load the KedroContext object for normal workflows such as CLI, Jupyter Notebook, Plugins, etc. It assumes the following project structure under the given project_path:

<project_path>
    |__ <src_dir>
    |__ .kedro.yml
    |__ kedro_cli.py
    |__ pyproject.toml

The name of the <scr_dir> is src by default. The .kedro.yml or pyproject.toml can be used for configuration. If .kedro.yml exists, it will be used otherwise, pyproject.toml will be treated as the configuration file (Kedro configuration should be under [tool.kedro] section).

Parameters:
  • project_path (Union[str, Path]) – Path to the Kedro project.
  • kwargs – Optional kwargs for ProjectContext class in run.py.
Return type:

KedroContext

Returns:

Instance of KedroContext class defined in Kedro project.

Raises:

KedroContextError – Neither ‘.kedro.yml’ nor pyproject.toml was found or [tool.kedro] section is missing in pyproject.toml, or loaded context has package conflict.