Skip to content

Python (python-script@v1)

Run a small Python transform or glue step with action-owned Python and optional requirements.

  • Repository: dagucloud/python-script
  • Runtime owned by the action: astral-sh/uv@0.11.14 through action tools; default Python 3.13.9

Contributions are welcome. The repository is public, so improvements, bug reports, and pull requests can go to dagucloud/python-script.

Example

yaml
steps:
  - id: compute
    action: python-script@v1
    with:
      input:
        version: "2.3.4"
        services: ["api", "worker", "scheduler"]
      requirements:
        - packaging==25.0
      script: |
        from packaging.version import Version

        version = Version(input["version"])

        return {
            "major": version.major,
            "serviceCount": len(input["services"]),
        }

  - id: print
    run: echo "major version is ${compute.outputs.result.major}"
    depends: compute

script is a Python async function body. return publishes result, and await works directly. The action exposes input, params, and env.

The requirements field is optional. When present, each entry is passed to uv run --with, so pin dependencies for reproducible runs.

Outputs

FieldDescription
oktrue when the script completed successfully.
resultJSON-compatible value returned by the script.
stdoutText written to stdout with print() or other stdout writes.
stderrText written to stderr by the script process.
durationMsWrapper-measured duration in milliseconds.
pythonVersionPython version used by the script process.
errorError object when the script fails.

Released under the MIT License.