{"id":2089,"library":"kfp-pipeline-spec","title":"Kubeflow Pipelines Pipeline Specification","description":"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.","status":"active","version":"2.16.0","language":"python","source_language":"en","source_url":"https://github.com/kubeflow/pipelines","tags":["kubeflow","mlops","pipeline","sdk","protobuf","machine learning"],"install":[{"cmd":"pip install kfp-pipeline-spec==2.16.0","lang":"bash","label":"Install specific version"}],"dependencies":[{"reason":"Used for defining and serializing the pipeline specification messages.","package":"protobuf","optional":false}],"imports":[{"wrong":"from kfp.pipeline_spec.pipeline_spec_pb2 import PipelineSpec","symbol":"PipelineSpec","correct":"from kfp.pipeline_spec import PipelineSpec"}],"quickstart":{"code":"import kfp_pipeline_spec.pipeline_spec_pb2 as pb\nfrom google.protobuf import json_format\n\n# Create a minimal KFP PipelineSpec object directly using the protobuf definitions\npipeline_spec = pb.PipelineSpec(\n    pipeline_info=pb.PipelineInfo(name=\"my-direct-pipeline\"),\n    root=pb.PipelineTaskSpec(\n        executor_label=\"my-executor\",\n        inputs=pb.TaskInputsSpec(),\n        outputs=pb.TaskOutputsSpec(),\n    ),\n    components={\n        \"my-executor\": pb.ComponentSpec(\n            executor_label=\"my-executor\",\n            input_definitions=pb.ComponentInputsSpec(),\n            output_definitions=pb.ComponentOutputsSpec(),\n            implementation=pb.ComponentSpec.ContainerImplementation(\n                container=pb.ContainerSpec(\n                    image=\"python:3.9-slim\",\n                    command=[\"python\", \"-c\", \"print('Hello from kfp-pipeline-spec!')\"]\n                )\n            )\n        )\n    }\n)\n\n# Serialize the PipelineSpec to JSON (as it would be in a compiled YAML file)\njson_output = json_format.MessageToJson(pipeline_spec, indent=2)\nprint(json_output)\n\n# To verify it's a valid spec object\nassert isinstance(pipeline_spec, pb.PipelineSpec)\nprint(f\"Pipeline name: {pipeline_spec.pipeline_info.name}\")","lang":"python","description":"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."},"warnings":[{"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.","message":"The 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.","severity":"breaking","affected_versions":"<2.0.0"},{"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.","message":"`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`.","severity":"gotcha","affected_versions":">=2.0.0"},{"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.","message":"The 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`.","severity":"gotcha","affected_versions":">=2.0.0"}],"env_vars":null,"search_vec":"'2.16.0':66 'activ':52 'backend':48 'canon':11 'compil':40 'compon':28 'core':27 'current':63 'data':12 'defin':9 'definit':39 'execut':44 'frequent':56 'kfp':6,20,31,42,47,61 'kfp-pipeline-spec':5 'kubeflow':1,18,67 'learn':73 'librari':50 'machin':72 'main':60 'maintain':53 'messag':16 'mlop':68 'pipelin':2,3,7,19,22,38,69 'protobuf':15,71 'provid':33 'releas':55 'schema':36 'sdk':32,62,70 'spec':8 'specif':4,23 'structur':13 'synchronis':57 'under':35 'v2':21 'version':65","created_at":"2026-04-09T18:43:03.290955+00:00","updated_at":"2026-04-16T16:02:47.111707+00:00","problems":{"verify_error":"Traceback (most recent call last):\n  File \"<string>\", line 1, in <module>\nImportError: cannot import name 'PipelineSpec' from 'kfp.pipeline_spec' (/tmp/tmp3y518g6_/venv/lib/python3.12/site-packages/kfp/pipeline_spec/__init__.py)"},"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"2.17.0","cli_name":"","cli_version":null,"type":"library","homepage":"https://www.kubeflow.org/docs/components/pipelines/","github":"https://github.com/kubeflow/pipelines","docs":null,"changelog":null,"pypi":"https://pypi.org/project/kfp-pipeline-spec/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["workflow","data","serialization","devops","ai-ml"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-07-03","last_verified":"2026-08-28","next_check":"2026-07-10","install_tag":null}}