Module python

Module python 

Source
Expand description

2026-09-26: Subprocess runner, Python preflight and venv provisioning. BFCL provisions its venv with these during load(); run is also used to call other tools.

A load() error becomes the run’s failed setup frame, so the failures of find_python, ensure_venv and pip_install name the missing piece and a fix.

Owner: bench (provisioning). Invariants:

  • A command that run sees exit unsuccessfully is an error carrying at most the last 12 lines of its stderr.

Structs§

Output
2026-09-26: Captured output of a command.

Functions§

ensure_venv
2026-09-26: Create venv with python if its interpreter is not already there, and return the interpreter.
find_python
2026-09-26: Locate a Python at least min_major.min_minor: python3, then python.
pip_install
2026-09-26: pip install -r <requirements> with the venv’s interpreter.
run
2026-09-26: Run a command to completion with stdin closed, capturing both streams. A failure carries the tail of stderr, since a bare exit code is not actionable.
venv_python
2026-09-26: The interpreter inside a venv, per platform layout.