Skip to content

fix: isolate recipe runner Python dependency - #347

Open
erikoliver wants to merge 1 commit into
eugr:mainfrom
erikoliver:fix/isolate-recipe-runner-python
Open

erikoliver wants to merge 1 commit into
eugr:mainfrom
erikoliver:fix/isolate-recipe-runner-python

Conversation

@erikoliver

Copy link
Copy Markdown

Summary

  • install PyYAML in a cached virtual environment when it is unavailable from the selected Python
  • avoid modifying Homebrew and other externally managed Python installations (PEP 668)
  • key the cached environment by Python major/minor version
  • validate the cached environment against the selected base interpreter and recreate stale or mismatched environments
  • quote Python executable paths consistently

Problem

run-recipe.sh currently falls back to python -m pip install pyyaml. Modern Homebrew and system Python installations may reject that write because the interpreter is externally managed under PEP 668, preventing the recipe runner from starting.

Behavior

When PyYAML is already importable, behavior is unchanged. Otherwise, the wrapper creates or reuses an interpreter-specific environment under:

$XDG_CACHE_HOME/spark-vllm-docker/run-recipe-venv-py<major>.<minor>

When XDG_CACHE_HOME is unset, it uses $HOME/.cache. Before reuse, the wrapper verifies that the environment was created from the currently selected Python executable. A stale, broken, or mismatched environment is recreated with venv --clear.

Testing

  • bash -n run-recipe.sh
  • git diff --check origin/main...HEAD
  • first run on Python 3.14.6 without PyYAML installed globally: created the isolated environment, installed PyYAML 6.0.3, and completed ./run-recipe.sh --list
  • second run: reused the cached environment and completed ./run-recipe.sh --list
  • rebased cleanly onto current origin/main

@erikoliver
erikoliver marked this pull request as ready for review August 14, 2026 21:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant