Skip to content

Add Python 3 to the image for scripts and tasks - #15

Merged
thecode merged 1 commit into
mainfrom
python-in-image
Nov 25, 2026
Merged

thecode merged 1 commit into
mainfrom
python-in-image

Conversation

@thecode

@thecode thecode commented Nov 25, 2026

Copy link
Copy Markdown
Owner

Problem

The image had bash, jq, perl and Bun, but no Python. Claude reaches for Python for anything beyond a one-liner (parsing JSON or logs, date arithmetic, sums over SMART or pool data), so that attempt failed and it had to retry with jq or awk. Task scripts with real logic were harder to write and to read than they need to be.

Change

  • Dockerfile: python3 from Debian's packages (3.11 on bookworm). The standard library only; no pip.
  • Base instructions: a short "Scripting" section. Python is available, there is no pip so nothing is to be installed, run Python in the container and feed it from the server (host … | python3 -c '…') instead of host python3, and a Python block inside a task's check.sh is fine because the owner approves it with the script.
  • README: Python listed among the image's tools; the shell tests' requirements are all in the image now.
  • Smoke test: Python reads JSON and imports a few standard modules, and pip is absent.

A python3 … command asks for approval like any other command that is not on the allow list. The image already had perl and Bun, so this adds no new kind of capability.

Size

The image grows from 658 MB to 692 MB.

Testing

Built and deployed on the dev server:

  • python3 runs in the container and parses output piped from a host command; pip and pip3 are absent.
  • The new section is in the generated CLAUDE.md.
  • tests/run.sh runs in the image as it is (it needed python3 installed by hand before): all 489 pass. The 129 bridge tests pass.

Claude reaches for Python for anything beyond a one-liner (parsing JSON or logs, date arithmetic, sums), and the attempt failed because the image had none. python3 from Debian is added: the standard library only, no pip. The base instructions say so and tell Claude to run Python in the container and feed it from the server. The shell tests, which need python3, now run in the image as it is.
@thecode thecode added the enhancement New feature or request label Nov 25, 2026
@thecode
thecode merged commit 334ec35 into main Nov 25, 2026
5 checks passed
@thecode
thecode deleted the python-in-image branch November 25, 2026 12:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant