Writing Skills
writing-skills
效率与协作技能,来自 obra/superpowers,查看原文获取完整用途和操作说明。
compiler-and-cli【部署与运维】Compile Kubeflow Pipelines Python DSL pipelines or components to PipelineSpec YAML or Kubernetes manifests using the public Compiler API and CLI.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Use this sub-skill when the user already has a KFP Python pipeline/component and needs to compile it, diagnose compilation, or understand the compile-related CLI surface.
@dsl.pipeline, @dsl.component, or @dsl.container_component objects to PipelineSpec YAML with kfp.compiler.Compiler().compile.kfp dsl compile; explain the legacy dsl-compile alias.--function when a file has more than one pipeline/component.pipeline_parameters / --pipeline-parameters, toggle type checking, and request Kubernetes native Pipeline/PipelineVersion manifests.kfp component build help, prerequisites, generated files, and Docker side effects at a high level.pipeline-authoring.client-and-registry.kubernetes-platform.repo-development.Confirm the input is an existing .py file or an in-process decorated pipeline/component object. If the user needs code written first, route to pipeline-authoring.
For a file compile, prefer the bundled wrapper because it uses only the installed KFP package and validates JSON before invoking the public CLI/API:
python skills/disco/kubeflow-pipelines/sub-skills/compiler-and-cli/scripts/compile_pipeline_file.py \
--py path/to/pipeline.py \
--output pipeline.yaml \
--function pipeline_func \
--pipeline-parameters '{"text":"Hello KFP!"}'
Equivalent direct CLI:
kfp dsl compile --py path/to/pipeline.py --output pipeline.yaml \
--function pipeline_func --pipeline-parameters '{"text":"Hello KFP!"}'
Equivalent in-process API:
from kfp import compiler
compiler.Compiler().compile(
pipeline_func=my_pipeline,
package_path="pipeline.yaml",
pipeline_parameters={"text": "Hello KFP!"},
type_check=True,
)
For Kubernetes native manifests, include the format flag. Naming and namespace flags are ignored by the CLI unless this flag is present:
kfp dsl compile --py path/to/pipeline.py --output pipeline-version.yaml \
--function pipeline_func \
--kubernetes-manifest-format \
--pipeline-name my-pipeline \
--pipeline-display-name "My Pipeline" \
--pipeline-version-name my-pipeline-v1 \
--pipeline-version-display-name "My Pipeline v1" \
--namespace kubeflow \
--include-pipeline-manifest
Compiler().compile when the pipeline/component object is already imported in Python.--pipeline-parameters must be a JSON object whose keys match pipeline/component inputs. Invalid JSON fails before compile; unknown inputs fail during PipelineSpec override.--disable-type-check / type_check=False only when the user explicitly accepts weaker compile-time interface checks.pipelineInfo, root, components, deploymentSpec). Kubernetes manifest format writes Kubernetes PipelineVersion and, with --include-pipeline-manifest, also Pipeline documents.dsl-compile is still installed as a deprecated console script; prefer kfp dsl compile in new commands.kfp component build can generate component metadata, Dockerfile, requirements, config, and optionally build/push images. Treat it as mutating and Docker-dependent; do not run it unless the user asks and prerequisites are present..yaml/.yml for supported YAML compilation.pipelineInfo plus root; platform-specific configs may appear as an additional YAML document.kind: PipelineVersion; if --include-pipeline-manifest was used, also expect kind: Pipeline.client-and-registry.references/api-reference.md — Compiler.compile, KubernetesManifestOptions, output behavior, API examples.references/cli-reference.md — kfp dsl compile, dsl-compile, manifest flags, kfp component build surface.references/troubleshooting.md — entry-point selection, JSON, type checks, manifest flag confusion, deprecated alias, Docker build prerequisites.