AGENT SKILL

hooks-and-extensions

Extend Kedro with hooks plugins custom CLI commands custom datasets custom runners notebooks serving and deployment integration points.

License 许可
Apache-2.0
最近更新
2026-09-03
Stars
★ 351
Forks
27

01 前言 Front Matter

name
hooks-and-extensions
license
Apache 2.0
metadata
{ "disco-role": "operating" }
description
Extend Kedro with hooks plugins custom CLI commands custom datasets custom runners notebooks serving and deployment integration points.
disable-model-invocation
true

02 资源文件 4

03 SKILL.md 正文

Hooks And Extensions

Use this sub-skill when a task asks how to extend Kedro rather than only use a standard project: project hooks, installable plugins, custom Click commands, custom datasets, custom runner surfaces, IPython/Jupyter line magics, minimal HTTP serving, or deployment-platform integration patterns.

Route Here

  • Add project hooks with from kedro.framework.hooks import hook_impl, register instances in settings.py as HOOKS = (...), or disable installed plugin hooks with DISABLE_HOOKS_FOR_PLUGINS.
  • Build or debug installable plugins that expose kedro.hooks, kedro.cli_hooks, kedro.global_commands, kedro.project_commands, kedro.init, kedro.line_magic, or starter entry points.
  • Override or add project CLI commands through src/<package_name>/cli.py, or expose reusable Click command groups from a plugin.
  • Implement an AbstractDataset or AbstractVersionedDataset subclass, especially when the task is about the extension contract rather than basic catalog.yml syntax.
  • Design custom runner classes, integration runners, or HTTP/serving wrappers while routing detailed run semantics to runners and execution.
  • Extend notebook/IPython workflows with %reload_kedro, %load_node, or kedro.line_magic plugin entry points.
  • Adapt Kedro projects for Airflow, Databricks, Dask, MLflow, Pandera, Great Expectations, Spark, or minimal FastAPI serving.

Route Elsewhere

Current Facts

  • Kedro target version is 1.4.0; import and distribution name are kedro; Python requirement is >=3.10.
  • Hook implementations import hook_impl from kedro.framework.hooks; CLI hook implementations import cli_hook_impl from kedro.framework.cli.hooks.
  • Project hooks are registered as instances in settings.py under HOOKS; installed plugin hooks are discovered from the kedro.hooks entry point group.
  • DISABLE_HOOKS_FOR_PLUGINS = ("<plugin-distribution-name>",) prevents auto-registered hooks for selected plugin distributions.
  • Hook implementation arguments must not have default values; Pluggy may otherwise pass the defaults instead of Kedro's runtime values.
  • ParallelRunner in Kedro 1.4.0 warns that node and dataset hooks are not executed in worker processes; choose SequentialRunner or ThreadRunner when those hooks are essential.
  • CLI plugin entry point groups include kedro.global_commands, kedro.project_commands, kedro.init, kedro.line_magic, kedro.hooks, and kedro.cli_hooks.
  • Project command resolution order is built-in commands, then plugin commands, then project cli.py; later sources can override earlier commands.

Reference Map

  • Read references/hooks-and-plugins.md for hook specs, hook signatures, registration, plugin entry point groups, CLI hooks, command precedence, and plugin debugging.
  • Read references/custom-datasets-and-cli.md for AbstractDataset contracts, versioned datasets, project cli.py overrides, reusable plugin commands, custom runner extension surfaces, and validation checks.
  • Read references/deployment-and-integrations.md for notebooks/IPython, line magics, HTTP serving extension, deployment-platform patterns, and optional dependency/security notes.
  • Read references/troubleshooting.md when hooks are not firing, plugin entry points do not load, custom commands conflict, datasets fail to instantiate, optional extras are missing, or serving/deployment integration fails.

Fast Patterns

  1. For a project hook, create src/<package_name>/hooks.py, decorate methods with @hook_impl, omit unused parameters, do not use defaults, then register instances in src/<package_name>/settings.py as HOOKS = (ProjectHooks(),).
  2. For hook ordering, treat order as non-guaranteed; project hooks follow last-in-first-out registration and plugin hooks are auto-registered first, but prefer @hook_impl(tryfirst=True) or @hook_impl(trylast=True) only when order is essential.
  3. For plugin hooks, expose an object instance through [project.entry-points."kedro.hooks"]; for CLI lifecycle hooks, expose an instance through [project.entry-points."kedro.cli_hooks"].
  4. For custom CLI, use project src/<package_name>/cli.py for project-specific overrides and plugin kedro.global_commands or kedro.project_commands for reusable commands.
  5. For custom datasets, subclass kedro.io.AbstractDataset or AbstractVersionedDataset, implement load, save, and _describe, and configure by fully qualified class path in catalog.yml.
  6. For serving or deployment, first decide whether you need a Kedro-native extension point, an orchestrator plugin, or a thin wrapper around KedroServiceSession; warn before network, cloud, credential, or public-server operations.

Safety Notes

  • Set KEDRO_DISABLE_TELEMETRY=1 or DO_NOT_TRACK=1 for CLI probes or automated examples when telemetry must be disabled.
  • Avoid printing credential dictionaries, runtime params with secrets, personal access tokens, or full platform paths from hooks and server endpoints.
  • kedro server start --reload is development-only; the built-in server does not include authentication, authorization, request queuing, or per-request session isolation.
  • Deployment commands for Airflow, Databricks, cloud platforms, Docker, or plugin CLIs may create files, contact networks, upload artifacts, or use credentials; ask before executing them.

04 同仓库更多 Skills

VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-triton-opt

Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-solve

END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-skill

PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-pattern-fusion

Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-orchestrate

Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-feedback

Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).

★ 351