Skip to main content

yaml2workflow

PyPi version Python 3.7 Github Actions

Clarifai workflows are powerful tools. Building them via the API is a sure way to automate this process, especially if you have many nodes and branches.

Taking inspiration from Kubernetes Helm Charts and AWS Cloud Formation templates, yaml2workflow is designed to make automating the creation and managing the definition of workflows easier and more transparent.

🙌 Define Workflows as YAML files

Much clearer and more human-readable definitions without distractors. Also, by storing the workflow definitions as a file, you can now use version control for your future automations! Winning.

# A single node workflow
workflow:
  id: test-wf-1
  nodes:
    - id: detector
      model:
          model_id: face-detection
          model_version_id: 45fb9a671625463fa646c3523a3087d5

🙌 Export Workflows as YAML files

[New!] Export your workflows into YAML files as well. Simply pass in the workflow object from a GetWorkflow response. See export_example.py for how to do that.

from yaml2workflow.exporter.workflow import Exporter

with Exporter(response.workflow) as e:
  e.parse()
  e.export("export_example.yml")

🚀 Installation

Simply enter

pip install yaml2workflow

💪 Usage

  1. Create a YAML file to define your workflow. Gather the model IDs and model version IDs from Clarifai. See parse_example.yml for a full, filled in template.
  2. Import the library and use it directly in your code as follows:
from yaml2workflow.parser.workflow import parse

workflows = parse('parse_example.yml', stub=stub, metadata=metadata)

post_workflows_response = stub.PostWorkflows(
    service_pb2.PostWorkflowsRequest(
        workflows=workflows
    ),
    metadata=metadata
)

See parse_example.py for the full example.

🎉 Done! You've now unlocked more human-readble and more maintable workflows.

Metadata

Release files for yaml2workflow 0.2.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for yaml2workflow 0.2.4
File Size Uploaded
yaml2workflow-0.2.4.tar.gz 9.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for yaml2workflow 0.2.4
File Interpreter ABI Platform
yaml2workflow-0.2.4-py3-none-any.whl Python 3 none any Details

Total release size: 19.6 kB

Release files / yaml2workflow-0.2.4.tar.gz

Download URL yaml2workflow-0.2.4.tar.gz
Size 9.3 kB
Tags Source
SHA-256 checksum
How to use checksums
c5686627a897c0e8cb460ce2810bb2a27bc287eda2bffaad1077fe6fa2236937
BLAKE2b-256 checksum
How to use checksums
f47af0cad4f139ec407ce768eff3a7d370d7cef06a5a60ea417d6d7893e04c15
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.2

Release files / yaml2workflow-0.2.4-py3-none-any.whl

Download URL yaml2workflow-0.2.4-py3-none-any.whl
Size 10.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
01131c34e6ef43d696d055b4b8e9f812d1e2a4db481155b919c0fe0d302fa5a5
BLAKE2b-256 checksum
How to use checksums
541fee7e3b971b2a12382aa1d39a2ff1ccb92db1af9b58a2f5773cf32d394133
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.2

Release history Release notifications | RSS feed

This release

0.2.4 This release

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

1 release file

0.2

1 release file

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page