kedro.framework.context.KedroContext

class kedro.framework.context.KedroContext(project_path, config_loader, env, package_name, hook_manager, extra_params=None)[source]

KedroContext is the base class which holds the configuration and Kedro’s main functionality.

Create a context object by providing the root of a Kedro project and the environment configuration subfolders (see kedro.config.OmegaConfigLoader) :raises KedroContextError: If there is a mismatch between Kedro project version and package version.

Parameters:
  • project_path (str | Path) – Project path to define the context for.

  • config_loader (AbstractConfigLoader) – Kedro’s OmegaConfigLoader for loading the configuration files.

  • env (str | None) – Optional argument for configuration default environment to be used for running the pipeline. If not specified, it defaults to “local”.

  • package_name (str) – Package name for the Kedro project the context is created for.

  • hook_manager (PluginManager) – The PluginManager to activate hooks, supplied by the session.

  • extra_params – Optional dictionary containing extra project parameters. If specified, will update (and therefore take precedence over) the parameters retrieved from the project configuration.

Attributes

catalog

Read-only property referring to Kedro's DataCatalog for this context.

params

Read-only property referring to Kedro's parameters for this context.

project_path

config_loader

env

Methods

property catalog: DataCatalog

Read-only property referring to Kedro’s DataCatalog for this context.

Return type:

DataCatalog

Returns:

DataCatalog defined in catalog.yml.

Raises:

KedroContextError – Incorrect DataCatalog registered for the project.

config_loader: AbstractConfigLoader
env: str | None
property params: dict[str, Any]

Read-only property referring to Kedro’s parameters for this context.

Return type:

dict[str, Any]

Returns:

Parameters defined in parameters.yml with the addition of any

extra parameters passed at initialization.

project_path: Path