YardmasterYardmaster Docs

Python runs

A Python run executes a script with python3. The script is the run's command. It suits a task that is more comfortable in Python than a shell: calling an API, reconciling state, or shaping data.

What runs

The script is written to a temporary file and run with python3, so multi-line scripts work unchanged. The working directory is the project checkout when the run sources a project. A dry run runs python3 -m py_compile, which checks syntax without executing the script.

How values reach the script

Example

import json, os, urllib.request
vars = json.loads(os.environ.get("YARDMASTER_VARS", "{}"))
token = os.environ["YARDMASTER_TOKEN"]
req = urllib.request.Request(
    f"https://api.example.com/deploy/{vars['service']}",
    headers={"Authorization": f"Bearer {token}"}, method="POST")
print(urllib.request.urlopen(req).status)

See also Bash runs, Terraform runs, Go runs, and the tutorials.