{"library":"kfp","code":"import kfp\nfrom kfp import dsl\nimport os\n\n# Define a lightweight Python component\n@dsl.component\ndef add(a: float, b: float) -> float:\n    '''Calculates sum of two arguments'''\n    return a + b\n\n# Define a pipeline using the component\n@dsl.pipeline(\n    name='Addition pipeline',\n    description='An example pipeline that performs addition calculations.'\n)\ndef add_pipeline(\n    a: float = 1.0,\n    b: float = 7.0,\n):\n    first_add_task = add(a=a, b=4.0)\n    second_add_task = add(a=first_add_task.output, b=b)\n\n# --- Running the pipeline (requires KFP backend) ---\n# In a real environment, you'd configure the KFP client to connect to your KFP instance.\n# For local testing without a KFP backend, you can use `kfp.local.init`.\n\n# Example of compiling a pipeline (no KFP backend needed for this step)\n# compiler = kfp.compiler.Compiler()\n# compiler.compile(pipeline_func=add_pipeline, package_path='add_pipeline.yaml')\n\n# Example of running a pipeline against a KFP endpoint\n# client = kfp.Client(host=os.environ.get('KFP_HOST', 'http://localhost:8080'))\n# run = client.create_run_from_pipeline_func(\n#     add_pipeline,\n#     arguments={'a': 7.0, 'b': 8.0}\n# )\n# print(f\"Pipeline run initiated: {run.url}\")\n\nprint(\"Pipeline 'add_pipeline' defined successfully. To run, compile and submit to a KFP backend.\")","lang":"python","description":"This quickstart defines a simple Python function as a KFP component using `@dsl.component` and then orchestrates it into a pipeline using `@dsl.pipeline`. It demonstrates the basic structure for authoring KFP v2 pipelines. To actually execute the pipeline, it needs to be compiled and submitted to a running Kubeflow Pipelines backend.","tag":null,"tag_description":null,"last_tested":"2026-04-24","results":[{"runtime":"python:3.10-alpine","exit_code":1},{"runtime":"python:3.10-slim","exit_code":1},{"runtime":"python:3.11-alpine","exit_code":1},{"runtime":"python:3.11-slim","exit_code":1},{"runtime":"python:3.12-alpine","exit_code":1},{"runtime":"python:3.12-slim","exit_code":1},{"runtime":"python:3.13-alpine","exit_code":1},{"runtime":"python:3.13-slim","exit_code":1},{"runtime":"python:3.9-alpine","exit_code":1},{"runtime":"python:3.9-slim","exit_code":1}]}