Dagweave catalog

Run a Python script

python-scriptv1.0.0updated 2026-10-181 version

Run a Python script you paste in, in a working directory of your choice, after installing any pip packages you list.

Install v1.0.0

Installs the template into your Argo namespace. The URL is pinned to this version.

kubectl apply -n argo -f https://catalog.dagweave.com/api/v1/items/python-script/1.0.0/template.yaml

Or with the Argo CLI:

argo template create -n argo https://catalog.dagweave.com/api/v1/items/python-script/1.0.0/template.yaml

Facts

Category
CI/CD
Tags
ci-cd python
Entrypoint
run
Template SHA-256
4e6cf90a78df7755afd0dc773babc6b95a305e58be1baa1646806cc5e6504f4e
Source
python-script at catalog commit 67458f7
API
item document, latest template.yaml

Images and provenance

Every image is pinned by digest, so a rebuilt tag can never change what this version runs.

RepositoryTagDigest
cgr.dev/chainguard/pythonlatest-devsha256:8a5780972067cfba4592b10e786a889807ed876c1100f89410fd0ed4e398992c

Parameters

NameDescriptionDefault
script required The Python source to run.
Example print("hello")
none
pip-packages Space-separated pip requirements to install first, pinned to a version. Leave blank to use only the standard library.
Example requests==2.34.0
empty
work-dir Directory to run the script in, such as the checked-out repo root. .

WorkflowTemplate

Download template.yaml

apiVersion: argoproj.io/v1alpha1
kind: WorkflowTemplate
metadata:
  name: python-script
  labels:
    dagweave.io/catalog-item: python-script
  annotations:
    dagweave.io/catalog-version: "1.0.0"
    dagweave.io/catalog-category: "CI/CD"
spec:
  entrypoint: run
  templates:
    - name: run
      inputs:
        parameters:
          - name: script
          - name: work-dir
            default: "."
          - name: pip-packages
            default: ""
      retryStrategy:
        limit: "2"
        retryPolicy: OnError
        backoff:
          duration: 10s
          factor: "2"
          maxDuration: 2m
      container:
        # cgr.dev/chainguard/python:latest-dev
        image: cgr.dev/chainguard/python@sha256:8a5780972067cfba4592b10e786a889807ed876c1100f89410fd0ed4e398992c
        command: [sh, -c]
        args:
          - |
            set -eu
            export HOME=/tmp PIP_NO_CACHE_DIR=1 PIP_DISABLE_PIP_VERSION_CHECK=1 PIP_ROOT_USER_ACTION=ignore
            if [ -n "${PIP_PACKAGES}" ]; then
              pip install --quiet --target /tmp/site-packages ${PIP_PACKAGES}
              export PYTHONPATH=/tmp/site-packages
            fi
            printf '%s\n' "${SCRIPT}" > /tmp/script.py
            cd "${WORK_DIR}"
            python /tmp/script.py
        env:
          - name: SCRIPT
            value: "{{inputs.parameters.script}}"
          - name: WORK_DIR
            value: "{{inputs.parameters.work-dir}}"
          - name: PIP_PACKAGES
            value: "{{inputs.parameters.pip-packages}}"
        resources:
          requests:
            cpu: 100m
            memory: 128Mi
          limits:
            memory: 1Gi
        securityContext:
          runAsUser: 0

Version history

Read from the item's changelog. Each version has its own JSON document; the pinned catalogue vendors the manifest of the latest one, so that is the version that installs.

  1. 1.0.0 latest 2026-10-18

    Initial release.

    kubectl apply -n argo -f https://catalog.dagweave.com/api/v1/items/python-script/1.0.0/template.yaml
    argo template create -n argo https://catalog.dagweave.com/api/v1/items/python-script/1.0.0/template.yaml

    version document, template.yaml

Run it once

After installing, from the command line.

argo submit -n argo --from workflowtemplate/python-script \
  -p script='print("hello")'

Workflow that references it

A Workflow with the required parameters filled from the examples.

apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
  generateName: python-script-
spec:
  workflowTemplateRef:
    name: python-script
  arguments:
    parameters:
      - name: script
        value: "print(\"hello\")"

As a step of a larger workflow

steps:
  - - name: python-script
      templateRef:
        name: python-script
        template: run