Python runtime and authoring SDK for Gust DAGs, including parser and task invoker
Project description
gust_py
Python runtime/package for Gust DAG authoring, parsing, and task execution.
What This Project Provides
- A Python authoring API:
Dag@task(...)log(...)- runtime calls:
get_task_by_name_run(...),get_secret_by_name(...)
- A parser that converts Python DAG files into a stable JSON spec.
- A task invoker to execute one task from a DAG file.
- A run-completion invoker to execute a DAG callback (
run done).
Requirements
- Python
>=3.10 uv
Install
uv sync --dev
DAG Authoring API
from gust import Dag, task, get_task_by_name_run, get_secret_by_name, log
class MyDag(Dag):
def __init__(self):
super().__init__(schedule="daily", on_finished_callback="done_my_run")
@task(deps=("prepare",), save=True)
def hello(self, ctx):
run_id = ctx["run_id"]
prepare_run = get_task_by_name_run("prepare", run_id)
secret = get_secret_by_name("SUPER_SECRET")
log(f"prepare={prepare_run}, secret_loaded={bool(secret)}")
return {"ok": True}
def done_my_run(self, status, run):
log(f"run {run['run_id']} finished with status={status}", level="info")
Runtime Messaging Protocol
gust runtime messages use a framed protocol on stdio:
- 4-byte big-endian frame length
- UTF-8 JSON payload
Helpers:
send_frame(payload)writes one frame tostdout._read_frame()reads one frame fromstdin.
Call helpers emit messages and wait for a response:
get_task_by_name_run(name, run_id)emits:{"type": "call", "op": "get_task_by_name_run", "run_id": run_id, "name": name}
get_secret_by_name(name)emits:{"type": "call", "op": "get_secret_by_name", "name": name}
Logging helper emits:
log(msg, level="info"):{"type": "log", "level": level, "msg": msg}
CLI
The package exposes a gust CLI.
Parse DAGs
gust parse --file path/to/dag_file.py
Output is JSON (printed to stdout), one list entry per discovered DAG class.
Run a Task
gust task run \
--file path/to/dag_file.py \
--dag MyDag \
--task hello \
--ctx-json '{"run_id":"123"}'
Output is a framed JSON payload:
- Success:
{"type":"result","ok":true,"data":{"value": ...}}
- Error:
{"type":"result","ok":false,"error":{"message":"...","type":"...","details":"..."}}
Run Completion Callback
gust run done \
--file path/to/dag_file.py \
--dag MyDag \
--fn-name done_my_run \
--status ok \
--run-id 123
Behavior:
- On success: no payload output.
- On failure: process exits with code
1.
Development
Run tests:
uv run pytest -q
Run lint:
uv run ruff check .
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gust_py-0.1.0.tar.gz.
File metadata
- Download URL: gust_py-0.1.0.tar.gz
- Upload date:
- Size: 2.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
90823765cfb1e55d860e726f74f8ee32864928d625c2d52951d286da4ab9e45f
|
|
| MD5 |
fa363a974ae0181f6dc0ff6d82e08f3b
|
|
| BLAKE2b-256 |
1dcf0bc7f0cbf72d9d9cb41976f6d73a381553f32cc04354b0815a0c186f18d7
|
Provenance
The following attestation bundles were made for gust_py-0.1.0.tar.gz:
Publisher:
ci_publish.yml on marciok/gust_py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gust_py-0.1.0.tar.gz -
Subject digest:
90823765cfb1e55d860e726f74f8ee32864928d625c2d52951d286da4ab9e45f - Sigstore transparency entry: 1061119663
- Sigstore integration time:
-
Permalink:
marciok/gust_py@a938530570f1724c13a4dc22db52a8ba3080a321 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/marciok
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci_publish.yml@a938530570f1724c13a4dc22db52a8ba3080a321 -
Trigger Event:
release
-
Statement type:
File details
Details for the file gust_py-0.1.0-py3-none-any.whl.
File metadata
- Download URL: gust_py-0.1.0-py3-none-any.whl
- Upload date:
- Size: 2.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4470c020f51e2a753c37a185af55989898ced2d9d991e436bf5ba99773e1383c
|
|
| MD5 |
5800252019713530aefc91d16d2fa2bf
|
|
| BLAKE2b-256 |
3079e1d654a66d8201effc04cf417d87d8eee51660c57ecb4f9e935f9edc08e1
|
Provenance
The following attestation bundles were made for gust_py-0.1.0-py3-none-any.whl:
Publisher:
ci_publish.yml on marciok/gust_py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gust_py-0.1.0-py3-none-any.whl -
Subject digest:
4470c020f51e2a753c37a185af55989898ced2d9d991e436bf5ba99773e1383c - Sigstore transparency entry: 1061119700
- Sigstore integration time:
-
Permalink:
marciok/gust_py@a938530570f1724c13a4dc22db52a8ba3080a321 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/marciok
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci_publish.yml@a938530570f1724c13a4dc22db52a8ba3080a321 -
Trigger Event:
release
-
Statement type: