fix: add --extra-pip-packages to build_git_pr_image (shell-safe quoting) - #7
Open
mvanhorn wants to merge 1 commit into
Open
fix: add --extra-pip-packages to build_git_pr_image (shell-safe quoting)#7mvanhorn wants to merge 1 commit into
mvanhorn wants to merge 1 commit into
Conversation
…fe quoting Adds an opt-in --extra-pip-packages flag so task images can install missing runtime deps (e.g. MarkupPy for tablib) without editing the script. Each package token is split and shlex-quoted before being embedded in the shell-form RUN line, so version specifiers like 'requests>=2' are not interpreted as shell redirection. Closes pgasawa#4 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds an
--extra-pip-packagesoption tobuild_git_pr_image.pyso task instances that need additional runtime dependencies (the motivating case in #4 isMarkupPyfortablib, missing in pre-PR-554 instances) can be installed into the generated image without editing the script. The packages are appended as aRUN pip install ...layer after the base install command.Why this matters
#4: instances built before PR-554 are missing
MarkupPy, sotablibimport fails and every such instance grades as failed regardless of the candidate solution. A configurable extra-packages flag lets the image builder add the missing dependency at build time.Shell-safety detail
Pip requirement specifiers commonly contain
<and>(requests>=2,urllib3<2). Because the package list is interpolated into a shell-formRUNline, those characters would be interpreted by the shell as redirection, silently installing the wrong requirement or failing the build. Each token is therefore split withshlex.splitand re-quoted withshlex.quotebefore it is embedded, so specifiers survive intact while plain names are unchanged.Testing
pytest tests/test_codebase_adaptation_generic_runtime.py— 18 passedrequests>=2 urllib3<2) are quoted rather than embedded raw.Closes #4
AI was used for assistance.