From dd53319513697bc7ac8bcd0d1562262c9b49a607 Mon Sep 17 00:00:00 2001 From: Merel Theisen Date: Tue, 19 Nov 2024 14:04:10 +0100 Subject: [PATCH 1/5] Update mermaid entrypoint diagrams with current state Signed-off-by: Merel Theisen --- docs/diagrams/installed-kedro-project.md | 12 ++++++------ docs/diagrams/kedro-no-project.md | 16 ++++++++-------- docs/diagrams/python-m-project.md | 12 +++++++----- 3 files changed, 21 insertions(+), 19 deletions(-) diff --git a/docs/diagrams/installed-kedro-project.md b/docs/diagrams/installed-kedro-project.md index 0d85d34a8d..1e527435db 100644 --- a/docs/diagrams/installed-kedro-project.md +++ b/docs/diagrams/installed-kedro-project.md @@ -1,13 +1,13 @@ ```mermaid sequenceDiagram - title "Installed Kedro project" + title Installed Kedro project - participant script as "third-party Python script" - participant curr_dir as "Directory with Kedro conf/ in it" - participant session as "KedroSession" + participant script as third-party Python script + participant curr_dir as Directory with Kedro conf/ in it + participant session as KedroSession script->>script: run third-party script script->>curr_dir: get path to the project config - script->>session: create a session with Kedro project name and project config dir - session->>run: run a pipeline and/or nodes + script->>session: create a session with Kedro project config dir + session->>session: run a pipeline and/or nodes ``` diff --git a/docs/diagrams/kedro-no-project.md b/docs/diagrams/kedro-no-project.md index 98aa74e482..450206d57a 100644 --- a/docs/diagrams/kedro-no-project.md +++ b/docs/diagrams/kedro-no-project.md @@ -1,14 +1,14 @@ ```mermaid sequenceDiagram - title "$ kedro\ndirectory without Kedro project" + title $ kedro in directory without Kedro project - participant kedro as "$ kedro" - participant entrypoint as "setup.py\nkedro = kedro.framework.cli:main" - participant init_plugins as "Kedro Plugins\nentry_point = kedro.init" - participant kedro_cli as "Kedro CLI\nglobal commands\ninfo, new, docs, starter" - participant global_plugins as "Kedro Plugins\nentry_point = kedro.global_commands" - participant pyproject.toml as "Current directory\npyproject.toml" - participant click as "Click" + participant kedro as $ kedro + participant entrypoint as pyproject.toml
kedro = "kedro.framework.cli:main" + participant init_plugins as Kedro Plugins
[project.entry-points."kedro.init"] + participant kedro_cli as Kedro CLI
global commands
info, new, docs, starter + participant global_plugins as Kedro Plugins
[project.entry-points."kedro.global_commands"] + participant pyproject.toml as Current directory
pyproject.toml + participant click as Click kedro->>entrypoint: Python calls this diff --git a/docs/diagrams/python-m-project.md b/docs/diagrams/python-m-project.md index 65c6bce2a5..cd49200a33 100644 --- a/docs/diagrams/python-m-project.md +++ b/docs/diagrams/python-m-project.md @@ -1,12 +1,14 @@ ```mermaid sequenceDiagram - title "$ \n$ python -m .run" + title python -m {project}.run - participant cli as "$ \n$ python -m " - participant entrypoint as "setup.py\n = .__main__" - participant session as "KedroSession" + participant cli as $
$ python -m + participant entrypoint as pyproject.toml
= .__main__:main + participant find_run as find_run_command() + participant session as KedroSession cli->>entrypoint: Python calls the entrypoint - entrypoint->>session: create session + entrypoint->>find_run: Find run command + find_run->>session: create session (for default run) session->>session: run ``` From 9efaf70dd78cd033adbb2781c1c124f42d352873 Mon Sep 17 00:00:00 2001 From: Merel Theisen Date: Tue, 19 Nov 2024 14:08:58 +0100 Subject: [PATCH 2/5] Update diagram kedro with project Signed-off-by: Merel Theisen --- docs/diagrams/kedro-with-project.md | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/docs/diagrams/kedro-with-project.md b/docs/diagrams/kedro-with-project.md index ff15c6e6c9..8d740d7c49 100644 --- a/docs/diagrams/kedro-with-project.md +++ b/docs/diagrams/kedro-with-project.md @@ -1,19 +1,20 @@ ```mermaid sequenceDiagram - title "$ kedro\ndirectory without Kedro project" + title $ kedro in directory with Kedro project - participant kedro as "$ kedro" - participant entrypoint as "setup.py\nkedro = kedro.framework.cli:main" - participant init_plugins as "Kedro Plugins\nentry_point = kedro.init" - participant kedro_cli as "Kedro CLI\nglobal commands\ninfo, new, docs, starter" - participant global_plugins as "Kedro Plugins\nentry_point = kedro.global_commands" - participant pyproject.toml as "Current directory\npyproject.toml" - participant project_plugins as "Kedro Plugins\nentry_point = kedro.project_commands" - participant kedro_project as "Current directory\nKedro Project: cli.py" + participant kedro as $ kedro + participant entrypoint as pyproject.toml
kedro = "kedro.framework.cli:main" + participant init_plugins as Kedro Plugins
[project.entry-points."kedro.init"] + participant kedro_cli as Kedro CLI
global commands
info, new, docs, starter + participant global_plugins as Kedro Plugins
[project.entry-points."kedro.global_commands"] + participant pyproject.toml as Current directory
pyproject.toml + participant project_plugins as Kedro Plugins
[project.entry-points."kedro.project_commands"] + participant kedro_project as "Current directory
Kedro Project: cli.py" participant click as "Click" kedro->>entrypoint: Python calls this - entrypoint->>init_plugins: load and run all installed + + entrypoint->>init_plugins: load and run all installed plugins entrypoint->>kedro_cli: collect built-in commands entrypoint->>global_plugins: load and collect global plugin commands entrypoint->>pyproject.toml: check current dir for a Kedro project From 3f713bc4a4cf5626993a2f26a88c8d7d74b0a246 Mon Sep 17 00:00:00 2001 From: Merel Theisen Date: Tue, 19 Nov 2024 14:22:12 +0100 Subject: [PATCH 3/5] Update diagram kedro run Signed-off-by: Merel Theisen --- docs/diagrams/kedro-run.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/docs/diagrams/kedro-run.md b/docs/diagrams/kedro-run.md index 78ac2ec185..de82f26420 100644 --- a/docs/diagrams/kedro-run.md +++ b/docs/diagrams/kedro-run.md @@ -1,25 +1,25 @@ ```mermaid sequenceDiagram - title "$ kedro run" + title $ kedro run - participant cli as "$ kedro run" - participant prelude as "See kedro-with-project.puml for details" - participant project_cli as "Project directory\ncli.py" - participant session as "KedroSession" - participant context as "KedroContext" - participant runner as "Runner" - participant hooks as "Hook manager" + participant cli as $ kedro run + participant prelude as See kedro-with-project.md for details + participant project_cli as Project directory
cli.py + participant session as KedroSession + participant context as KedroContext + participant runner as Runner + participant hooks as Hook manager cli->>prelude: prepare click commands as prelude to this prelude->>project_cli: run project_cli->>session: create KedroSession + session->>hooks: initialise hook manager session->>session: run session->>session: load KedroContext - session->>context: get the selected pipeline - context->>context: filter the pipeline based on command line arguments + session->>session: get the selected pipeline + session->>session: filter the pipeline based on command line arguments session->>context: get catalog with load version / save version session->>runner: create runner - session->>hooks: get hook manager hooks->>hooks: before_pipeline_run runner->>runner: run the filtered pipeline with the catalog hooks->>hooks: on_pipeline_error (if runner fails) From 54aa08d95c152bff4b35e2aeb74a1f8bad30829e Mon Sep 17 00:00:00 2001 From: Merel Theisen Date: Tue, 19 Nov 2024 14:37:33 +0100 Subject: [PATCH 4/5] Update diagram kedro-plugin Signed-off-by: Merel Theisen --- docs/diagrams/kedro-plugin.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/diagrams/kedro-plugin.md b/docs/diagrams/kedro-plugin.md index 186ed3467c..ffd212886f 100644 --- a/docs/diagrams/kedro-plugin.md +++ b/docs/diagrams/kedro-plugin.md @@ -1,16 +1,16 @@ ```mermaid sequenceDiagram - title "$ kedro plugin" + title $ kedro plugin - participant cli as "$ kedro plugin" - participant prelude as "See kedro-with-project.puml for details" - participant project_plugin as "Kedro Plugin\nentry_point = kedro.project_commands" - participant click as "Click context" - participant session as "KedroSession" + participant cli as $ kedro plugin + participant prelude as See kedro-with-project.md for details + participant project_plugins as Kedro Plugins
[project.entry-points."kedro.project_commands"] + participant session as KedroSession + participant kedro_cli as KedroCLI cli->>prelude: prepare click commands as prelude to this prelude->>project_plugin: execute plugin click command - project_plugin->>click: get ProjectMetadata from the click context + project_plugin->>kedro_cli: get ProjectMetadata from the KedroCLI command collection group project_plugin->>project_plugin: plugin code project_plugin->>session: need to create KedroSession for all runtime config and info ``` From f6287e4939103254fde74e52c120a9719832b2ba Mon Sep 17 00:00:00 2001 From: Merel Theisen Date: Tue, 19 Nov 2024 15:00:39 +0100 Subject: [PATCH 5/5] Update kedro-ipython diagram Signed-off-by: Merel Theisen --- docs/diagrams/kedro-ipython.md | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/docs/diagrams/kedro-ipython.md b/docs/diagrams/kedro-ipython.md index bf6145e5dd..30e835ce11 100644 --- a/docs/diagrams/kedro-ipython.md +++ b/docs/diagrams/kedro-ipython.md @@ -1,30 +1,26 @@ ```mermaid sequenceDiagram - title "$ kedro ipython" + title $ kedro ipython - participant cli as "$ kedro ipython" - participant env as "Environment variables" - participant ipython as "IPython" - participant entrypoint as "00-kedro-init.py\nreload_kedro" - participant hook_manager as "Hook manager" - participant project as "Kedro project directory" - participant session as "KedroSession" - participant context as "KedroContext" + participant cli as $ kedro ipython + participant env as Environment variables + participant ipython as IPython + participant entrypoint as ipython/__init__.py
reload_kedro + participant hook_manager as Hook manager + participant project as Kedro project directory + participant session as KedroSession + participant context as KedroContext cli->>cli: Check if IPython is importable - cli->>env: Set IPYTHONDIR to metadata.project_path / ".ipython" cli->>env: Set KEDRO_ENV to the chosen Kedro environment - cli->>cli: Print an info message cli->>ipython: Start ipython - ipython->>entrypoint: load startup script - entrypoint->>entrypoint: import Kedro - entrypoint->>hook_manager: clear the hook manager + ipython->>entrypoint: load ipython extension + entrypoint->>project: find Kedro project entrypoint->>project: bootstrap the project entrypoint->>entrypoint: remove imported project package modules entrypoint->>session: create a KedroSession - entrypoint->>session: activate the session entrypoint->>session: load KedroContext entrypoint->>context: get the data catalog - entrypoint->>entrypoint: expose session, context and catalog variables + entrypoint->>entrypoint: expose session, context, catalog and pipelines variables entrypoint->>entrypoint: register reload_kedro line magic ```