kfp-pipeline-spec defines the canonical data structures and protobuf messages for Kubeflow Pipelines (KFP) v2 pipeline specifications. It is a core component of the KFP SDK, providing the underlying schema for pipeline definitions compiled by `kfp` and executed on the KFP backend. The library is actively maintained, with releases frequently synchronised with the main KFP SDK, currently at version 2.16.0.
pip install kfp-pipeline-spec==2.16.0Verified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to programmatically construct a barebones `PipelineSpec` object using the protobuf definitions from `kfp-pipeline-spec`. While most users generate this spec via the `kfp` SDK's compiler, this shows direct interaction with the underlying data model. It then serializes the spec to JSON, which is a common output format for compiled KFP pipelines.
Ensure your KFP SDK and backend are both on version 2.x or higher when using `kfp-pipeline-spec`. Old v1 pipelines need to be migrated or re-authored using KFP v2 SDK.
For authoring pipelines, use the high-level `kfp` SDK (e.g., `@dsl.pipeline`, `@dsl.component`). Directly manipulating `kfp_pipeline_spec` is typically reserved for advanced use cases like custom compilers, introspection, or validation tools.
Always refer to the official KFP documentation for correct import paths and module responsibilities. Generally, `kfp` is for pipeline authoring, `kfp-pipeline-spec` for schema definitions, and `kfp-server-api` for interacting with the KFP API server.