kedro.framework.context.KedroContext¶
-
class
kedro.framework.context.KedroContext(package_name, project_path, config_loader, hook_manager, env=None, extra_params=None)[source]¶ KedroContextis the base class which holds the configuration and Kedro’s main functionality.Attributes
Read-only property referring to Kedro’s
DataCatalogfor this context.Property for the current Kedro environment.
Read-only property referring to Kedro’s parameters for this context.
Read-only property containing Kedro’s root project directory.
Methods
-
__init__(package_name, project_path, config_loader, hook_manager, env=None, extra_params=None)[source]¶ Create a context object by providing the root of a Kedro project and the environment configuration subfolders (see
kedro.config.ConfigLoader)- Raises
KedroContextError – If there is a mismatch between Kedro project version and package version.
- Parameters
package_name (
str) – Package name for the Kedro project the context is created for.project_path (
Union[Path,str]) – Project path to define the context for.hook_manager (
PluginManager) – ThePluginManagerto activate hooks, supplied by the session.env (
Optional[str]) – Optional argument for configuration default environment to be used for running the pipeline. If not specified, it defaults to “local”.extra_params (
Optional[Dict[str,Any]]) – Optional dictionary containing extra project parameters. If specified, will update (and therefore take precedence over) the parameters retrieved from the project configuration.
-
property
catalog¶ Read-only property referring to Kedro’s
DataCatalogfor this context.- Return type
DataCatalog- Returns
DataCatalog defined in catalog.yml.
- Raises
KedroContextError – Incorrect
DataCatalogregistered for the project.
-
property
env¶ Property for the current Kedro environment.
- Return type
Optional[str]- Returns
Name of the current Kedro environment.
-
property
params¶ 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.
-
property
project_path¶ Read-only property containing Kedro’s root project directory.
- Return type
Path- Returns
Project directory.
-