Skip to main content

dagron Python SDK

Author dagron workflows in Python and drive the whole dagron control plane — trigger runs, manage workflows and schedules, redrive dead letters, wire up GitOps — without writing REST calls by hand.

  • Zero dependencies. Standard library only (json + urllib).
  • Two layers: Dag (a validating spec builder) and Client (a typed wrapper over the authenticated dagron-api gateway).
  • Full coverage. v0.2 covers 100% of the current dagron-api HTTP surface — see ROADMAP.md for the coverage matrix and what's next.

Install

pip install -e .        # from sdks/python

Author a DAG

from dagron import Dag

dag = Dag("etl")
extract = dag.task("extract", image="alpine", command=["echo", "hi"])
dag.task("load", image="alpine", command=["true"], depends_on=[extract])

print(dag.to_json())    # valid dagron input (YAML is a JSON superset)

task() maps onto the engine's full TaskSpec — image, command, depends_on, plus input, max_attempts, retry_delay_secs, timeout_secs, env, resources, service_account, and workflow_ref (chain another saved workflow). to_spec()/to_json() validate the graph client-side (unique names, known deps, leaf-xor-chain, acyclic), mirroring the server so a bad DAG fails fast.

Drive the control plane

import os
from dagron import Client

api = Client("http://localhost:8080")
api.login("admin@example.com", os.environ["DAGRON_PASSWORD"])   # stores the token
# ...or skip login: Client("http://localhost:8080", token=os.environ["DAGRON_TOKEN"])

# Trigger an ad-hoc run and wait for it to finish.
run_id = api.submit_run(dag)
run = api.wait_for_run(run_id)
print(run["status"])                       # succeeded | failed | cancelled

# Save it as a reusable workflow and schedule it nightly.
wf = api.create_workflow(dag, description="nightly ETL")
api.create_schedule(wf["id"], "0 0 0 * * *")

# Observe.
for ev in api.stream_run(run_id):          # live Server-Sent Events
    print(ev["event"], ev["data"])

Every method maps one dagron-api endpoint to one call and returns the server's JSON. Non-2xx responses raise DagronError(status, message):

from dagron import DagronError

try:
    api.submit_run({"name": "x", "tasks": []})
except DagronError as e:
    print(e.status, e.message)             # e.g. 400 "DAG 'x' contains a cycle"

What Client covers

login · logout · me · create_user · submit_run · list_runs · get_run · get_run_graph · get_task_logs · cancel_run · rerun_run · resubmit_run · retry_task · approve_task · reject_task · stream_run · wait_for_run · list_workflows · get_workflow · create_workflow · update_workflow · delete_workflow · run_workflow · sync_workflow_to_git · list_schedules · create_schedule · update_schedule · delete_schedule · backfill_schedule · create_backfill · list_backfills · get_backfill · cancel_backfill · list_dead_letters · redrive_dead_letter · discard_dead_letter · list_git_repos · connect_git_repo · sync_git_repo · disconnect_git_repo · metrics · healthz

Test

python -m unittest          # from sdks/python

The suite validates the builder and runs Client against a threaded in-process fake gateway (real sockets), so request construction is exercised end-to-end.

Release

Publishing dagron-sdk to PyPI (the pip repository) is documented step-by-step in RELEASING.md — version bump, python -m build, a TestPyPI dry-run, the twine upload, tagging, and the move to OIDC Trusted Publishing.

Metadata

Release files for dagron-sdk 0.4.0

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

Source distribution (sdist)

Source distribution for dagron-sdk 0.4.0
File Size Uploaded Provenance Actions
dagron_sdk-0.4.0.tar.gz 14.9 kB With provenance Details for dagron_sdk-0.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dagron-sdk 0.4.0
File Interpreter ABI Platform Actions
dagron_sdk-0.4.0-py3-none-any.whl Python 3 none any Details for dagron_sdk-0.4.0-py3-none-any.whl

Total release size: 28.5 kB

Release files / dagron_sdk-0.4.0.tar.gz

Download URL dagron_sdk-0.4.0.tar.gz
Size 14.9 kB
Tags Source
SHA-256 checksum
How to use checksums
d8b97abbc21a4fba42f70eabf8363dea5a12c21450b01c7fc631968cf65ca0cf
BLAKE2b-256 checksum
How to use checksums
4ec098f76d0880bc7f4bd805b572b264a913aa96b040615fce03a3d322308fe5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Dec 1, 2026.

Transparency log

Release files / dagron_sdk-0.4.0-py3-none-any.whl

Download URL dagron_sdk-0.4.0-py3-none-any.whl
Size 13.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c6440d14ec143216aeea0fd1051354e9db96e388446e5e45528112a1e704c8c1
BLAKE2b-256 checksum
How to use checksums
9d1b81a4eaacd26878405ad318e8f6be1aed7f5086c4fbbb69b40ff7d52ede90
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Dec 1, 2026.

Transparency log

Security for dagron-sdk 0.4.0

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.

Select from 2 files

Attestation for dagron_sdk-0.4.0.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 Dec 1, 2026.

Transparency log

A 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.

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