{
  "name": "python-script",
  "title": "Run a Python script",
  "category": "CI/CD",
  "tags": [
    "ci-cd",
    "python"
  ],
  "version": "1.0.0",
  "date": "2026-10-18",
  "notes": "Initial release.",
  "latest": true,
  "installable": true,
  "url": "https://catalog.dagweave.com/api/v1/items/python-script/1.0.0.json",
  "templateUrl": "https://catalog.dagweave.com/api/v1/items/python-script/1.0.0/template.yaml",
  "entrypoint": "run",
  "parameters": [
    {
      "name": "script",
      "title": "Script",
      "description": "The Python source to run.",
      "type": "string",
      "required": true,
      "example": "print(\"hello\")"
    },
    {
      "name": "pip-packages",
      "title": "Pip packages",
      "description": "Space-separated pip requirements to install first, pinned to a version. Leave blank to use only the standard library.",
      "type": "string",
      "required": false,
      "default": "",
      "example": "requests==2.34.0"
    },
    {
      "name": "work-dir",
      "title": "Work dir",
      "description": "Directory to run the script in, such as the checked-out repo root.",
      "type": "string",
      "required": false,
      "default": "."
    }
  ],
  "images": [
    {
      "ref": "cgr.dev/chainguard/python@sha256:8a5780972067cfba4592b10e786a889807ed876c1100f89410fd0ed4e398992c",
      "repository": "cgr.dev/chainguard/python",
      "tag": "latest-dev",
      "digest": "sha256:8a5780972067cfba4592b10e786a889807ed876c1100f89410fd0ed4e398992c"
    }
  ],
  "install": {
    "kubectl": "kubectl apply -n argo -f https://catalog.dagweave.com/api/v1/items/python-script/1.0.0/template.yaml",
    "argo": "argo template create -n argo https://catalog.dagweave.com/api/v1/items/python-script/1.0.0/template.yaml"
  },
  "template": "apiVersion: argoproj.io/v1alpha1\nkind: WorkflowTemplate\nmetadata:\n  name: python-script\n  labels:\n    dagweave.io/catalog-item: python-script\n  annotations:\n    dagweave.io/catalog-version: \"1.0.0\"\n    dagweave.io/catalog-category: \"CI/CD\"\nspec:\n  entrypoint: run\n  templates:\n    - name: run\n      inputs:\n        parameters:\n          - name: script\n          - name: work-dir\n            default: \".\"\n          - name: pip-packages\n            default: \"\"\n      retryStrategy:\n        limit: \"2\"\n        retryPolicy: OnError\n        backoff:\n          duration: 10s\n          factor: \"2\"\n          maxDuration: 2m\n      container:\n        # cgr.dev/chainguard/python:latest-dev\n        image: cgr.dev/chainguard/python@sha256:8a5780972067cfba4592b10e786a889807ed876c1100f89410fd0ed4e398992c\n        command: [sh, -c]\n        args:\n          - |\n            set -eu\n            export HOME=/tmp PIP_NO_CACHE_DIR=1 PIP_DISABLE_PIP_VERSION_CHECK=1 PIP_ROOT_USER_ACTION=ignore\n            if [ -n \"${PIP_PACKAGES}\" ]; then\n              pip install --quiet --target /tmp/site-packages ${PIP_PACKAGES}\n              export PYTHONPATH=/tmp/site-packages\n            fi\n            printf '%s\\n' \"${SCRIPT}\" \u003e /tmp/script.py\n            cd \"${WORK_DIR}\"\n            python /tmp/script.py\n        env:\n          - name: SCRIPT\n            value: \"{{inputs.parameters.script}}\"\n          - name: WORK_DIR\n            value: \"{{inputs.parameters.work-dir}}\"\n          - name: PIP_PACKAGES\n            value: \"{{inputs.parameters.pip-packages}}\"\n        resources:\n          requests:\n            cpu: 100m\n            memory: 128Mi\n          limits:\n            memory: 1Gi\n        securityContext:\n          runAsUser: 0\n",
  "templateSha256": "4e6cf90a78df7755afd0dc773babc6b95a305e58be1baa1646806cc5e6504f4e",
  "source": "https://github.com/dagweave/catalog/tree/67458f74dbbf913b03177f3cefc69424be85eb1d/catalog/python-script",
  "catalogSha": "67458f74dbbf913b03177f3cefc69424be85eb1d"
}
