Metadata-Version: 2.4
Name: kfp
Version: 2.18.0
Summary: Kubeflow Pipelines SDK
Home-page: https://github.com/kubeflow/pipelines
Author: The Kubeflow Authors
Project-URL: Documentation, https://kubeflow-pipelines.readthedocs.io/en/stable/
Project-URL: Bug Tracker, https://github.com/kubeflow/pipelines/issues
Project-URL: Source, https://github.com/kubeflow/pipelines/tree/master/sdk
Project-URL: Changelog, https://github.com/kubeflow/pipelines/blob/master/sdk/RELEASE.md
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Education
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Software Development
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.9.0
Description-Content-Type: text/markdown
Requires-Dist: click>=8.1.8
Requires-Dist: click-option-group==0.5.7
Requires-Dist: docstring-parser<1,>=0.7.3
Requires-Dist: google-api-core!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.0,<3.0.0dev,>=1.31.5
Requires-Dist: google-auth<3,>=1.6.1
Requires-Dist: google-cloud-storage<4,>=2.2.1
Requires-Dist: kfp-pipeline-spec<3,>=2.18.0
Requires-Dist: kfp-server-api<3,>=2.18.0
Requires-Dist: kubernetes<31,>=8.0.0
Requires-Dist: protobuf<7.0,>=6.31.1
Requires-Dist: PyYAML<7,>=5.3
Requires-Dist: requests==2.32.5; python_version < "3.10"
Requires-Dist: requests==2.33.0; python_version >= "3.10"
Requires-Dist: requests-toolbelt<2,>=0.8.0
Requires-Dist: tabulate<1,>=0.8.6
Requires-Dist: urllib3==2.6.3; python_version < "3.10"
Requires-Dist: urllib3==2.8.0; python_version >= "3.10"
Requires-Dist: oauthlib<5,>=4.0.0
Requires-Dist: certifi>=2026.10.19
Provides-Extra: all
Requires-Dist: docker; extra == "all"
Requires-Dist: kfp-kubernetes==2.18.0; extra == "all"
Requires-Dist: nbclient<1,>=0.10; extra == "all"
Requires-Dist: ipykernel<7,>=6; extra == "all"
Requires-Dist: jupyter_client<9,>=7; extra == "all"
Provides-Extra: kubernetes
Requires-Dist: kfp-kubernetes==2.18.0; extra == "kubernetes"
Provides-Extra: notebooks
Requires-Dist: nbclient<1,>=0.10; extra == "notebooks"
Requires-Dist: ipykernel<7,>=6; extra == "notebooks"
Requires-Dist: jupyter_client<9,>=7; extra == "notebooks"
Dynamic: author
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: project-url
Dynamic: provides-extra
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary


Kubeflow Pipelines is a platform for building and deploying portable, scalable machine learning workflows based on Docker containers within the [Kubeflow](https://www.kubeflow.org/) project.

Use Kubeflow Pipelines to compose a multi-step workflow ([pipeline](https://www.kubeflow.org/docs/components/pipelines/concepts/pipeline/)) as a [graph](https://www.kubeflow.org/docs/components/pipelines/concepts/graph/) of containerized [tasks](https://www.kubeflow.org/docs/components/pipelines/concepts/step/) using Python code and/or YAML. Then, [run](https://www.kubeflow.org/docs/components/pipelines/concepts/run/) your pipeline with specified pipeline arguments, rerun your pipeline with new arguments or data, [schedule](https://www.kubeflow.org/docs/components/pipelines/concepts/run-trigger/) your pipeline to run on a recurring basis, organize your runs into [experiments](https://www.kubeflow.org/docs/components/pipelines/concepts/experiment/), save machine learning artifacts to compliant [artifact registries](https://www.kubeflow.org/docs/components/pipelines/concepts/metadata/), and visualize it all through the [Kubeflow Dashboard](https://www.kubeflow.org/docs/components/central-dash/overview/).

## Installation

To install `kfp`, run:

```sh
pip install kfp
```

## Preview pipelines locally

`kfp visualize` reads Python (`.py`) or compiled KFP v2 specifications
(`.yaml`, `.yml`, `.json`), without a cluster or server credentials:

```sh
# Offline, interactive React Flow HTML (defaults to pipeline.html).
kfp visualize pipeline.py

# Select a function when a Python file defines multiple pipelines.
kfp visualize pipeline.py --function training -o training.html

# Mermaid diagrams in Markdown; the output extension selects the format.
kfp visualize pipeline.yaml -o pipeline.md
# Equivalent: kfp visualize pipeline.yaml --format markdown

# Regenerate HTML on saved changes, without starting a server.
kfp visualize pipeline.py -w

# Regenerate Markdown for an editor or third-party Mermaid viewer.
kfp visualize pipeline.py --format markdown -w

# Compile once per change and update both pipeline.html and pipeline.md.
kfp visualize pipeline.py --format both -w
# Choose another output stem: report.html and report.md.
kfp visualize pipeline.py --format both -o report -w

# Serve a live preview and automatically open it in the default browser.
kfp visualize pipeline.py --format both -w -s

# Serve and open a snapshot without watching for edits.
kfp visualize pipeline.py -s

# Serve without launching a browser (useful on remote/headless machines).
kfp visualize pipeline.py -w -s --no-open
# Short form: kfp visualize pipeline.py -w -s -n
```

`--format` accepts `html`, `both`, or `markdown`, defaulting to HTML. When
`--format` is omitted, an explicit `.html` or `.md` output path selects the
format. With `both`, `-o report`, `-o report.html`, and `-o report.md` all produce
`report.html` and `report.md`. Both artifacts are rendered and staged before
either destination is replaced. Each replacement is atomic, but the pair is
not a filesystem transaction.

HTML exports include JavaScript, styles, data, and third-party licenses: they
work offline, including in HTML previewers that permit JavaScript. They contain
the same graph canvas, task/artifact cards, inline DAG expansion, controls, and
node inspector as the KFP pipeline UI. Markdown exports contain one Mermaid
task-dependency diagram per DAG and need a Mermaid-aware renderer. Both show
static dependencies, including parameter/artifact inputs and explicit ordering;
loops are not unrolled, and no runtime execution status is shown. Legacy Argo
Workflow YAML and standalone component specs are not supported. Compiler multi-document YAML and Kubernetes `PipelineVersion`
manifests are supported. JSON files use JSON parsing to preserve Unicode and
numeric constants.

HTML validates reusable DAG definitions once and keeps the spec compact.
Markdown expands instance paths, with a limit of 10,000 DAGs, tasks, and
dependency edges in total; use HTML for pipelines that exceed this limit.
Missing/empty task display names and incomplete task-output or final-status
producer references are rejected before replacing an export. All formats require
a `deploymentSpec` field so their validated state can also be served by the shared
KFP graph/inspector; an explicit empty object is supported. Removing the field
or a producer name during an edit preserves the previous exports and preview.

`-w` is a short alias for `--watch`. Watching only updates files; it never
starts a server unless `--serve` / `-s` is also supplied. Watch mode observes
**saved files**, not unsaved editor buffers. Python inputs are recompiled in a
fresh process after changes to `.py` files beneath the
input's directory (excluding hidden directories, `venv`, `node_modules`, and
`__pycache__`). Imports outside that directory and non-Python configuration files
are not watched. YAML/JSON inputs watch only the input file. Compilation has a
60-second timeout. Compilation, rendering, or staging failures preserve the
last successful exports and print the error; the live HTML viewer also displays
it and recovers on the next valid change. Third-party HTML/Markdown viewers
control their own reload behavior.

`--serve` / `-s` serves an HTML preview with any export format and opens the
preview once in the default browser after the server starts. The launch attempt
runs in the background, so a browser command that waits for its window to close
does not block updates. Stopping the CLI does not wait for or close the browser.
By itself it serves a snapshot; combine it with `--watch` / `-w` for live updates. Pass `--no-open` /
`-n` to keep serving without launching a browser. The URL is always printed, and
if automatic launch fails, serving continues with a warning so you can open it
manually. Plain exports and watch-only commands never launch a browser.

The server binds only to
`127.0.0.1` on an automatically selected port and serves only the viewer and its
graph data, not the workspace. Keep it private: the graph includes component
specifications. A separately opened `.html` file is an offline snapshot, not a
live connection. Remote environments require port forwarding to reach the
printed URL; retain its `127.0.0.1:<port>` Host and token path. Stop with Ctrl+C.

**Only compile trusted Python:** importing a pipeline executes its module-level
code, including arbitrary side effects. The visualizer does not itself submit
runs. Exported task/component specifications can contain source code or literal
credentials; review them before sharing.

## Getting started

The following is an example of a simple pipeline that uses the `kfp` v2 syntax:

```python
from kfp import dsl
import kfp


@dsl.component
def add(a: float, b: float) -> float:
    '''Calculates sum of two arguments'''
    return a + b


@dsl.pipeline(
    name='Addition pipeline',
    description='An example pipeline that performs addition calculations.')
def add_pipeline(
    a: float = 1.0,
    b: float = 7.0,
):
    first_add_task = add(a=a, b=4.0)
    second_add_task = add(a=first_add_task.output, b=b)


client = kfp.Client(host='<my-host-url>')
client.create_run_from_pipeline_func(
    add_pipeline, arguments={
        'a': 7.0,
        'b': 8.0
    })

```
