-
Notifications
You must be signed in to change notification settings - Fork 18
Implement run-time Python interpreter searching #284
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
chrisnovakovic
merged 14 commits into
please-build:master
from
chrisnovakovic:runtime-interpreters
Dec 3, 2025
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
f09db3b
Implement run-time Python interpreter searching
chrisnovakovic d6dfcf8
Put `defines` on a single line
chrisnovakovic 9b2381a
More sensible var name for preamble file
chrisnovakovic 40ff77c
Always free `exe_path`
chrisnovakovic 74f023a
`_dir_realpath` var names
chrisnovakovic 15741e7
Simplify length comparisons
chrisnovakovic d5f21d7
Use `err_t` and `const` more
chrisnovakovic 1b0c04f
Return an error if `get_plz_bin_path` badly fails
chrisnovakovic fa3203c
Remove `readlink`-based logic for getting .pex path on Linux
chrisnovakovic f8b19e7
Simplify `path.c` further
chrisnovakovic de89e0b
Document `_XOPEN_SOURCE` requirement
chrisnovakovic f039131
Remove unnecessary slice initialiser
chrisnovakovic 3490d25
More sensible `wrapped` null check
chrisnovakovic a7262eb
`!__PEXERROR_H__`
chrisnovakovic File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,6 +28,8 @@ jobs: | |
| runs-on: ${{ (inputs.platform == 'freebsd_amd64' || inputs.platform == 'linux_amd64') && 'ubuntu-24.04' || (inputs.platform == 'linux_arm64' && 'ubuntu-24.04-arm' || (inputs.platform == 'darwin_amd64' && 'macos-15-intel' || (inputs.platform == 'darwin_arm64' && 'macos-15' || 'unknown'))) }} | ||
| steps: | ||
| - name: Install Python in CI environment | ||
| # actions/setup-python doesn't support FreeBSD - instead, interpreters for the supported Python versions are | ||
| # pre-installed in the FreeBSD runner image. | ||
| if: ${{ inputs.platform != 'freebsd_amd64' }} | ||
| id: python | ||
| uses: actions/setup-python@v6 | ||
|
|
@@ -36,14 +38,11 @@ jobs: | |
| update-environment: false | ||
| - name: Check out code | ||
| uses: actions/checkout@v5 | ||
| - name: Configure plugin's default Python interpreter | ||
| run: | | ||
| _python_path="${{ inputs.platform == 'freebsd_amd64' && format('python{0}', inputs.python) || steps.python.outputs.python-path }}" | ||
| echo "PLZ_ARGS=-o plugin.python.defaultinterpreter:$_python_path" >> $GITHUB_ENV | ||
| - name: Configure plugin to use please_pex tool built from source | ||
| if: inputs.please_pex_from_repo | ||
| run: | | ||
| echo "PLZ_ARGS=${PLZ_ARGS:+$PLZ_ARGS }-o plugin.python.pextool://tools/please_pex" >> $GITHUB_ENV | ||
| # PexTool can't be set to //tools/please_pex for e2e tests because it can't be built inside the e2e test | ||
| # environment - skip the e2e tests if we're using //tools/please_pex as the pex tool. | ||
| run: echo "PLZ_ARGS=${PLZ_ARGS:+$PLZ_ARGS }-o plugin.python.pextool://tools/please_pex -e plz_e2e_test" >> $GITHUB_ENV | ||
| - name: Run tests (in nested runner) | ||
| if: ${{ inputs.platform == 'freebsd_amd64' }} | ||
| uses: cross-platform-actions/[email protected] | ||
|
|
@@ -55,11 +54,22 @@ jobs: | |
| shell: bash | ||
| environment_variables: PLZ_ARGS | ||
| shutdown_vm: true | ||
| run: ./pleasew test --keep_going --log_file plz-out/log/test.log ${{ inputs.test_targets }} | ||
| run: | | ||
| _external_interpreter="python${{ inputs.python }}" | ||
| _in_repo_interpreter="//third_party/cc/cpython:cpython_${{ inputs.python }}|python" | ||
toastwaffle marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| echo "*** Running tests using external Python interpreter: $_external_interpreter" | ||
| ./pleasew -o "plugin.python.defaultinterpreter:$_external_interpreter" test --rerun --keep_going --log_file plz-out/log/test-external_interpreter.log ${{ inputs.test_targets }} | ||
| echo "*** Running tests using in-repo Python interpreter: $_in_repo_interpreter" | ||
| ./pleasew -o "plugin.python.defaultinterpreter:$_in_repo_interpreter" test --rerun --keep_going --log_file plz-out/log/test-in_repo_interpreter.log ${{ inputs.test_targets }} | ||
| - name: Run tests (on host) | ||
| if: ${{ inputs.platform != 'freebsd_amd64' }} | ||
| run: | | ||
| ./pleasew test --keep_going --log_file plz-out/log/test.log ${{ inputs.test_targets }} | ||
| _external_interpreter="${{ steps.python.outputs.python-path }}" | ||
| _in_repo_interpreter="//third_party/cc/cpython:cpython_${{ inputs.python }}|python" | ||
| echo "*** Running tests using external Python interpreter: $_external_interpreter" | ||
| ./pleasew -o "plugin.python.defaultinterpreter:$_external_interpreter" test --rerun --keep_going --log_file plz-out/log/test-external_interpreter.log ${{ inputs.test_targets }} | ||
| echo "*** Running tests using in-repo Python interpreter: $_in_repo_interpreter" | ||
| ./pleasew -o "plugin.python.defaultinterpreter:$_in_repo_interpreter" test --rerun --keep_going --log_file plz-out/log/test-in_repo_interpreter.log ${{ inputs.test_targets }} | ||
| - name: Archive logs | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
|
|
||
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The proof that all of this works is in the "in-repo please_pex tool" test matrix passing - the others will fail because they use the build defs from this PR but the older stable version of please_pex, which is missing features added by this PR. The GHA workflow is now structured in such a way that only the "in-repo please_pex tool" test matrix needs to pass in order for a new version of please_pex to be released, so after I've tagged a new please_pex version and updated
//tools:please_pexto download it, the other test matrices will also start passing again.