🐍Python Client

Interacting with your ZenML instance through the ZenML Client.

Pipelines, runs, stacks, and many other ZenML resources are stored and versioned in a database within your ZenML instance behind the scenes. The ZenML Python Client allows you to fetch, update, or even create any of these resources programmatically in Python.

In all other programming languages and environments, you can interact with ZenML resources through the REST API endpoints of your ZenML server instead. Checkout the /docs/ page of your server for an overview of all available endpoints.

Usage Example

The following example shows how to use the ZenML Client to fetch the last 10 pipeline runs that you ran yourself on the stack that you have currently set:

from zenml.client import Client

client = Client()

my_runs_on_current_stack = client.list_pipeline_runs(

stack_id=client.active_stack_model.id,  # on current stack

user_id=client.active_user.id,  # ran by you

sort_by="desc:start_time",  # last 10

size=10,

for pipeline_run in my_runs_on_current_stack:

print(pipeline_run.name)

List of Resources

These are the main ZenML resources that you can interact with via the ZenML Client:

Pipelines, Runs, Artifacts

Pipelines: The pipeline (versions) that were implicitly tracked when running ZenML pipelines.

Pipeline Runs: Information about all pipeline runs that were executed on your ZenML instance.

Step Runs: The steps of all pipeline runs. Mainly useful for directly fetching a specific step of a run by its ID.

Artifacts: Information about all artifacts that were written to your artifact stores as part of pipeline runs.

Schedules: Metadata about the schedules that you have used to schedule pipeline runs.

Builds: The pipeline-specific Docker images that were created when containerizing your pipeline.

Code Repositories: The git code repositories that you have connected with your ZenML instance. See here for more information.