Registry / workflow / kfp-pipeline-spec

kfp-pipeline-spec

JSON →
library2.17.0pypypi✓ verified 24d ago

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.0
INSTALL
IMPORT
SIG · KFP-PIPELINE-SPEC
K
kfp-pipeline-spec
workflowpythonv2.17.0
Install
2.1s avg
Import
Disk
18MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v2.16.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 19.6MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 2.1s · import 0.000s · 20MB
18MB installed
● package 18MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

PipelineSpec
from kfp.pipeline_spec import PipelineSpec
from kfp.pipeline_spec.pipeline_spec_pb2 import PipelineSpec

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.

import kfp_pipeline_spec.pipeline_spec_pb2 as pb from google.protobuf import json_format # Create a minimal KFP PipelineSpec object directly using the protobuf definitions pipeline_spec = pb.PipelineSpec( pipeline_info=pb.PipelineInfo(name="my-direct-pipeline"), root=pb.PipelineTaskSpec( executor_label="my-executor", inputs=pb.TaskInputsSpec(), outputs=pb.TaskOutputsSpec(), ), components={ "my-executor": pb.ComponentSpec( executor_label="my-executor", input_definitions=pb.ComponentInputsSpec(), output_definitions=pb.ComponentOutputsSpec(), implementation=pb.ComponentSpec.ContainerImplementation( container=pb.ContainerSpec( image="python:3.9-slim", command=["python", "-c", "print('Hello from kfp-pipeline-spec!')"] ) ) ) } ) # Serialize the PipelineSpec to JSON (as it would be in a compiled YAML file) json_output = json_format.MessageToJson(pipeline_spec, indent=2) print(json_output) # To verify it's a valid spec object assert isinstance(pipeline_spec, pb.PipelineSpec) print(f"Pipeline name: {pipeline_spec.pipeline_info.name}")
Debug
Known issues
breakingThe pipeline specification format underwent significant changes between Kubeflow Pipelines v1 and v2. `kfp-pipeline-spec` is designed for KFP v2 and is not compatible with pipeline definitions or compilers from KFP v1.
fix
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.
affects: <2.0.0
gotcha`kfp-pipeline-spec` is primarily a definitions library for the KFP v2 pipeline schema. Most pipeline authors will interact with this schema indirectly through the `kfp` SDK's `kfp.dsl` and `kfp.compiler` modules, rather than directly constructing protobuf objects from `kfp_pipeline_spec`.
fix
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.
affects: >=2.0.0
gotchaThe KFP ecosystem consists of several related Python packages (`kfp`, `kfp-pipeline-spec`, `kfp-server-api`, `kfp-kubernetes`). It's a common mistake to confuse which package provides specific classes or functionalities. For example, the `Compiler` is in `kfp`, while `PipelineSpec` definition is in `kfp-pipeline-spec`.
fix
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.
affects: >=2.0.0
Upgrade
Version history
2.17.0latest on PyPI · released Jul 9, 2026
Audit
Dependencies
protobufrequiredUsed for defining and serializing the pipeline specification messages.
Agent activity
28 hits · last 30 days
node
24
Amazon
1
OpenAI (training)
1
Resources
kfp-pipeline-spec — pip install kfp-pipeline-spec · libregistry