Every data team eventually owns a folder of scripts that used to work. One reads a CSV from someone’s desktop, another writes a pickle to a path that no longer exists, and the only record of what ran is a Slack thread. The code is unmanaged: no session object knows which run produced which artifact, no catalog names datasets once and resolves them everywhere, and no seam lets a team attach logging or validation without editing a function’s middle.
Kedro attacks that problem with a small runtime. Its version is pinned in kedro/__init__.py, and dependencies are few: click, dynaconf, omegaconf, pluggy, plus attrs utilities. There is no scheduler daemon and no hidden database; the framework is mostly Python objects wired at run time.
This tour reads the real main tree of kedro-org/kedro at the 1.8.0 source line, following what happens when a developer types kedro run: bootstrap, session creation, config loading, catalog construction, runner selection, and hook dispatch. Paths and line numbers were checked against the checkout.
Overview of Kedro's runtime: a Click CLI bootstraps project settings, a session loads a context, the context builds a catalog from OmegaConf config, and a runner walks the node DAG while pluggy hooks observe each step.
Reading the overview from left to right:
- KedroSession.run, L276 accepts twelve filtering arguments, from tags and node names to namespaces and load versions, before a single node executes.
- run-once guard, L337 raises
KedroSessionErrorif_run_calledis already true, enforcing a one-to-one mapping between session objects and runs. - AbstractRunner.run, L60 warms up every dataset name in the DAG, rejects unsatisfied inputs with
ValueError, then times a single_runcall. - DataCatalog.get, L717 resolves a name pattern, materializes a deferred dataset, and returns it, so lookups are also construction points.
- _LazyDataset.materialize, L152 is the small method that turns stored constructor config into a live dataset object on first use.
- OmegaConfigLoader, L69 merges YAML and JSON trees from
baseand environment folders through OmegaConf, with two explicit merge strategies. - configure_project, L724 imports the project’s settings module, stores
PACKAGE_NAME, and refreshes the lazy logging proxy. - after_node_run, L80 is one of the pluggy specifications that let plugins wrap node execution without touching framework code.
The overview splits into six clusters: project wiring, session lifecycle, configuration, the catalog, execution engines, and the hook/CLI edge. The detail view opens each cluster.
Detail view: the session persists run metadata in a dict-backed store, the context owns the config loader and catalog, the catalog separates materialized from lazy datasets, and tasks bind nodes to catalog inputs and outputs.
One Session, One Run
KedroSession is defined at line 79 of kedro/framework/session/session.py and inherits from AbstractSession, which only requires load_context and close. The constructor at line 102 resolves the project path, assigns a timestamp-based session id, initializes a BaseSessionStore, and creates a pluggy PluginManager.
The key state is a single boolean. _run_called starts false at line 117. Inside run, after resolving named entries and filtering the combined DAG, the method checks the flag at line 337 and raises a KedroSessionError (one run per session). The flag flips at line 442, but only after runner.run(...) returns successfully; an exception leaves it false, so a failed attempt can be retried while a successful one cannot.
Two consequences follow. Long-lived services cannot reuse one session to trigger work repeatedly; they create a fresh one per trigger. And because the guard precedes catalog construction, a rejected second call performs no IO. The session is a run record, not a service container.
The runner is chosen at line 386 with runner = runner or SequentialRunner(), and a class instead of an instance is rejected with an error message about a missing pair of parentheses. Immediately after, lines 412 to 416 swap the catalog class: process-based execution gets SharedMemoryDataCatalog, while other runners use settings.DATA_CATALOG_CLASS. That conditional is why process and thread execution do not share a catalog implementation.
The session assembles a record_data dictionary for hooks: run id, project path, environment, version, tags, node selections, runtime params, and the runner class name. Hooks therefore receive the runner that actually runs, not the unset argument (the comment above line 384 says so).
The Catalog Builds Datasets Only When Asked
kedro/io/data_catalog.py is the largest file in this tour at 1613 lines, mostly to make dataset handling feel declarative. DataCatalog begins at line 184 and keeps two dictionaries from the start: _datasets for live objects and _lazy_datasets for deferred configuration, assigned at lines 290 and 291.
get at line 717 is the hinge. If a name is not registered, the method asks a CatalogConfigResolver for a matching pattern at line 753 and registers the result. If the name points at a lazy entry, the code pops it at line 757 and calls materialize() at line 759, replacing config with a real object. Later calls return the same instance.
This design keeps startup cheap. A project with hundreds of configured datasets pays parsing cost only for names touched during a run, not every entry in catalog.yml. The runner compensates with a warm-up loop at lines 92 to 96: it calls catalog.get for each dataset in the DAG and raises a ValueError listing unsatisfied inputs at line 100 if any remain unknown.
The catalog can also be built from configuration through from_config at line 778, which takes the catalog mapping, credentials, load versions, a save version, and a validation flag. Persistence is split into save at line 1172 and load at line 1223. Around these methods sit SharedMemoryDataCatalog at line 1487, CachedDataset, MemoryDataset, and SharedMemoryDataset, all implementing or wrapping AbstractDataset from kedro/io/core.py, which also defines Version and AbstractVersionedDataset.
If you have used Dask, the contrast is instructive: Dask builds a task graph from collections and computes it on a scheduler, while Kedro walks a pre-assembled graph of named nodes calling plain Python functions through this catalog. Kedro’s unit of reuse is the named dataset.
From YAML Trees to a Resolved Config Object
The configuration layer shows Kedro’s dependency choices most clearly. OmegaConfigLoader at line 69 of kedro/config/omegaconf_config.py (836 lines) recursively scans conf_source, loads YAML and JSON files, and merges them through OmegaConf. The base folder is processed first; environment folders layer on top.
Two enum values define merge behavior. MergeStrategies at line 58 contains SOFT and DESTRUCTIVE, and MERGING_IMPLEMENTATIONS at line 63 maps each value to a private method, _soft_merge or _destructive_merge. Per-key strategies let a team deep-merge parameters while replacing catalog entries outright, avoiding the classic list-append surprise.
The loader also sets a security-minded default: line 195 calls OmegaConf.clear_resolver("oc.env"), removing the built-in environment resolver. Environment interpolation is opt-in through a custom resolver, not something a stray config file can invoke. Runtime parameters get a resolver of their own, with markers at lines 49 to 55 and registration near line 249, so ${runtime_params:dataset.type} can be audited; a flag blocks that resolver from choosing dataset classes when configuration is untrusted.
Deferred parsing is a subclass: LazyOmegaConfigLoader at line 42 of lazy_omegaconf_config.py extends the eager loader. On the consumer side, KedroContext in framework/context/context.py stores the loader, caches validated parameters at line 184, and builds the catalog in _get_catalog at line 264 by reading the catalog config key at line 279.
The concrete build facts are easy to state: version 1.8.0 from kedro/__init__.py, requires-python >=3.11 with classifiers through 3.15, dependencies on omegaconf>=2.1.1, dynaconf>=3.1.2,<4.0, pluggy>=1.0, and click>=8.2, and a console entry point mapping kedro to kedro.framework.cli:main.
Runners, Tasks, and the Hook Seam
AbstractRunner at line 39 of kedro/runner/runner.py owns the shared run protocol. Its run method at line 60 optionally filters nodes whose outputs already exist, warms up the catalog, validates inputs, and dispatches to an abstract _run at line 198. Concrete subclasses are small by comparison: SequentialRunner at line 19 of sequential_runner.py, ParallelRunner at line 39 of parallel_runner.py, and ThreadRunner at line 21 of thread_runner.py.
Execution granularity lives in kedro/runner/task.py. Task at line 44 binds one node to resolved inputs and a catalog, and execute at line 61 runs it. The sequential path at line 147 collects inputs by name at lines 156 to 158, calls the node, and writes outputs back. The parallel runner’s _get_executor at lines 124 to 129 builds a ProcessPoolExecutor from a multiprocessing context, while the thread runner’s version at lines 72 to 73 returns a ThreadPoolExecutor. A docstring note at lines 63 and 64 records the Windows constraint that workers are capped at min(61, max_workers), and line 122 computes the same minimum from the required process count.
Hooks are the extension seam. kedro/framework/hooks/specs.py is 313 lines and declares a dozen pluggy specifications, including after_catalog_created at line 23, before_node_run at line 53, after_node_run at line 80, and after_dataset_saved at line 288. manager.py creates the PluginManager with Kedro’s hook namespace at line 28 and registers plugins discovered through entry points at line 62. Because specs are ordinary functions returning None, hooks are synchronous: a plugin that blocks blocks the run, fine for logging and lineage but not for heavy validation.
The CLI sits on top. kedro/framework/cli/cli.py builds a LazyGroup at lines 88 to 102 whose lazy_subcommands dictionary maps names such as run, catalog, and jupyter to import paths, so startup only imports the command a user invoked. kedro run itself lives at line 254 of cli/project.py and carries options for runner selection at line 192 and async mode at line 193. Under the hood this is Click, a design that also explains the plugin precedence rule in the CLI docstring: a plugin command with the same name wins.
Honest Limits
The one-run-per-session invariant is the first limitation a service builder hits. KedroSession is cheap to construct but still a per-run object with stored ids, so anything long-lived needs an outer loop that creates and closes sessions; the framework does not provide one.
Process-based execution is constrained by pickling and shared memory. The session swaps in SharedMemoryDataCatalog for ParallelRunner at lines 412 to 416, so datasets must survive a process boundary or be mmap-friendly. On Windows the worker cap is 61.
Lazy datasets buy startup speed but not memory. Once materialize() runs, the object stays in _datasets for the session’s lifetime; there is no eviction policy. Pattern resolution is name-based and evaluated on access, so a broad pattern can silently accept a typo-adjacent name.
Configuration is powerful but not free. OmegaConf interpolation, custom resolvers, and per-key merge strategies remove YAML anchor hacks, yet the loader disables oc.env, so teams migrating from environment-heavy setups must wire a resolver themselves. Because hooks are synchronous, a slow hook shows up in run time.
Kedro chooses a session-scoped runtime, explicit catalog objects, and a thin pluggy seam. If you need a resident scheduler or distributed execution, Kedro expects you to hand the graph to something else; if you need reproducible local runs with named inputs and outputs, the source is small enough to read in an afternoon, and that readability is the real feature. Enjoyed this post? Never miss out on future posts by following us