PyWorkflowKit
Reliable workflows without running a workflow platform.
PyWorkflowKit is an embedded, resilient Python workflow engine for defining, validating, planning, executing, persisting, inspecting, and evidencing generic dependency graphs of trusted Python workloads without requiring a scheduler, server daemon, worker cluster, or heavy orchestration platform.
Status: PyWorkflowKit 2.1.1 is the current stable release line. It preserves the 2.1 runtime contracts while incorporating the post-2.1.0 release-engineering remediation. Public publication is accepted only after exact-tag qualification and trusted-publishing gates pass.
Goals
- Zero Heavy Infrastructure: Run resilient multi-step DAGs inside existing applications, serverless functions, notebooks, or CLI scripts without Redis, RabbitMQ, Celery, or Airflow.
- Deterministic & Auditable: Topologically planned execution with immutable manifests, execution event journals, and dependency lineage.
- Fail-Safe & Selective Resume: Safe failure isolation, non-blocking retry policies, and granular resumption of failed runs from portable checkpoints.
- Plug-and-Play Extensibility: Modular executors (Inline, Subprocess, Thread, Async, Process), metadata stores (Memory, SQLite, PostgreSQL), and telemetry bridges.
- Native Distributed Tracing: 3-level span hierarchy (Workflow → Task → Attempt) with W3C
TRACEPARENTpropagation to external subprocesses.
Canonical V2 Architecture
PyWorkflowKit keeps domain intention strictly separated from physical execution engines and metadata storage:
WorkflowDefinition (TaskDefinition, >> operator)
↓
ExecutionPlan (topological DAG validation)
↓
WorkflowRuntime
↓
Explicit Executor (Inline, Subprocess, Thread, Async, Process)
↓
MetadataStore (InMemory, SQLite, PostgreSQL)
↓
WorkflowResult, Manifest & Telemetry Spans
The package root intentionally exposes a narrow, frozen V2 surface:
ExecutionPlan;PyWorkflowKitError;RetryPolicy,TimeoutPolicy;TaskDefinition,WorkflowDefinition;TaskAttempt,TaskAttemptId;TaskRun,TaskRunId;WorkflowRun,WorkflowRunId;WorkflowResult,WorkflowRuntime;__version__.
Advanced capabilities remain available from their dedicated namespaces, notably
pyworkflowkit.executors, pyworkflowkit.persistence, pyworkflowkit.authoring,
and pyworkflowkit.runtime.
Installation
PyWorkflowKit requires Python 3.11 or newer.
# Core package
pip install pyworkflowkit
# Optional PostgreSQL persistence
pip install "pyworkflowkit[postgres]"
# Optional OpenTelemetry tracing bridge
pip install "pyworkflowkit[otel]"
# Complete development environment
pip install "pyworkflowkit[dev,security]"
Quickstart
1. Functional DAG Authoring with the >> Operator
from pyworkflowkit import TaskDefinition, WorkflowDefinition, WorkflowRuntime
from pyworkflowkit.executors import InlineExecutor, TaskExecutionContext
from pyworkflowkit.persistence import InMemoryMetadataStore
def extract_data() -> dict[str, int]:
return {"raw_count": 100}
def transform_data(context: TaskExecutionContext) -> dict[str, int]:
payload = context.dependency_outputs["extract"]
assert isinstance(payload, dict)
return {"processed_count": int(payload["raw_count"]) * 2}
def load_data(context: TaskExecutionContext) -> str:
payload = context.dependency_outputs["transform"]
assert isinstance(payload, dict)
return f"Loaded {payload['processed_count']} records"
# Define tasks
extract = TaskDefinition(key="extract", workload=extract_data)
transform = TaskDefinition(key="transform", workload=transform_data)
load = TaskDefinition(key="load", workload=load_data)
# Author DAG dependencies using the ergonomic shift operator
extract >> transform >> load
# Build workflow definition
workflow = WorkflowDefinition(
name="etl_pipeline",
tasks=(extract, transform, load),
)
# Execute via embedded runtime
runtime = WorkflowRuntime(
metadata=InMemoryMetadataStore(),
executor=InlineExecutor(),
)
result = runtime.run(workflow)
print(f"Workflow status: {result.status.value}")
2. External Subprocess Workloads & W3C Trace Propagation
from pyworkflowkit import TaskDefinition, WorkflowDefinition, WorkflowRuntime
from pyworkflowkit.executors.subprocess import SubprocessCommand, SubprocessExecutor
from pyworkflowkit.persistence import SQLiteMetadataStore
# Define an external shell-free command
backup_task = TaskDefinition(
key="db_backup",
workload=SubprocessCommand(argv=("pg_dump", "-Fc", "production_db")),
)
workflow = WorkflowDefinition(name="maintenance", tasks=(backup_task,))
# Automatically propagates W3C TRACEPARENT / TRACESTATE to the subprocess
runtime = WorkflowRuntime(
metadata=SQLiteMetadataStore(path="runtime.db"),
executor=SubprocessExecutor(max_workers=2),
)
result = runtime.run(workflow)
Command Line Interface (pwk)
PyWorkflowKit includes a developer-friendly CLI accessible via pwk, pyworkflowkit, or pyworkflow:
# Verify environment and system health
pwk doctor
# Statically validate workflow syntax and cycle-free DAG topology
pwk validate examples.getting_started_workflow:demo --json
# Preview topological execution plan and concurrency groups
pwk plan examples.getting_started_workflow:demo --json
# Execute workflow directly from terminal with dry-run or live mode
pwk run examples.getting_started_workflow:demo --dry-run
pwk run examples.getting_started_workflow:demo --store sqlite:///.pwk.db
# Inspect execution run evidence, manifests, and task events
pwk inspect <workflow-run-id> --store sqlite:///.pwk.db --json
# Prune historical completed workflow runs
pwk store prune --older-than 30d --status SUCCEEDED --store sqlite:///.pwk.db
Learning Journey & Documentation
Explore the complete learning paths:
- Zero-to-Hero Guides: Index available at
docs/guides/README.md. - First-Use Getting Started: Canonical guide at
docs/guides/getting-started.md. - Executable Examples: Full suite indexed at
examples/README.md(start withexamples/00_hello_world.py). - Interactive Notebooks: Jupyter tutorials indexed at
notebooks/README.md.
Recommended curriculum:
- 01 — Installation and First Workflow
- 04 — Dependencies and DAG
- 08 — Failures and Retries
- 15 — CLI Zero to Hero
- 19 — Plugins and Ecosystem
- 99 — Complete Reference Application
License
Distributed under the terms of the Apache License 2.0.
Metadata
Release files for pyworkflowkit 2.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyworkflowkit-2.1.1.tar.gz | 259.0 kB | With provenance | Details for pyworkflowkit-2.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyworkflowkit-2.1.1-py3-none-any.whl | Python 3 | none | any | Details for pyworkflowkit-2.1.1-py3-none-any.whl |
Total release size: 619.2 kB
Release files / pyworkflowkit-2.1.1.tar.gz
| Download URL | pyworkflowkit-2.1.1.tar.gz |
|---|---|
| Size | 259.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b94401d1cd7fbb0803a21f00b920413d8925098084370f93f426e2f3548b5ca1
|
|
BLAKE2b-256 checksum How to use checksums |
a8e8c47081efd5c06b79f8c2628dd1690137325bd2805fca83f5edb1a5322039
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 4, 2026.
Transparency logRelease files / pyworkflowkit-2.1.1-py3-none-any.whl
| Download URL | pyworkflowkit-2.1.1-py3-none-any.whl |
|---|---|
| Size | 360.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3764d2962c6b22a8fc7fcb79641bfdfaaa0f9d7990a956f2a0e00986edacedac
|
|
BLAKE2b-256 checksum How to use checksums |
7bc5170ababedaae3365f609c452772f107b98eecc212a63108fe67de02d371a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 4, 2026.
Transparency logSecurity for pyworkflowkit 2.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for pyworkflowkit-2.1.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 4, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.