-
Notifications
You must be signed in to change notification settings - Fork 92
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
python: use Python Environment Tools for interpreter discovery #5897
Draft
isabelizimm
wants to merge
26
commits into
main
Choose a base branch
from
pet-python
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
2d1658c
install PET in CI
isabelizimm 72ce282
install nox into ci
isabelizimm 5d4a4cf
take into account different wd for ts tests
isabelizimm 3e317cb
specify which noxfile
isabelizimm 9c2ddba
use actions for smoke tests to build vsix
isabelizimm c8db8b0
correct path name
isabelizimm 06d13d4
cd into positron-python every time(?)
isabelizimm f1d2c1f
format yml
isabelizimm 8b247ed
place pet in project dir
isabelizimm 8ba5db2
do not clone with special-working-dir
isabelizimm 77efe40
debug where vsix is
isabelizimm 55b7461
rm tmate session
isabelizimm c0ddffb
move to ext dir
isabelizimm b01e189
try quotes perhaps
isabelizimm 383cf53
try to move file again
isabelizimm c5a64c9
using working-directory arg
isabelizimm 018cd9f
no working dir for upload
isabelizimm 2d9ca1b
use cp instead of mv
isabelizimm c57dca8
upload vsix for smoke tests
isabelizimm db5cf4c
update paths for smoke tests
isabelizimm 69dbdb1
include version in interpreter name
isabelizimm aed1167
add pet specific tests
isabelizimm 5dcf7bf
include PROJECT_DIR for cargo tests
isabelizimm ad4dbb1
scripts to download and unzip python-env-tools
isabelizimm 8fc277c
script to build pet
isabelizimm b6f7586
copyright headers
isabelizimm 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 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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: "Setup Python Environment Tools" | ||
description: "Install and build microsoft/python-environment-tools" | ||
|
||
env: | ||
PET_BRANCH: "release/latest" | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Checkout Python Environment Tools | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: 'microsoft/python-environment-tools' | ||
path: 'extensions/positron-python/python-env-tools' | ||
branch: ${{ env.PET_BRANCH }} | ||
sparse-checkout: | | ||
crates | ||
Cargo.toml | ||
Cargo.lock | ||
sparse-checkout-cone-mode: false | ||
|
||
- name: Rust Tool Chain setup | ||
uses: dtolnay/rust-toolchain@stable | ||
|
||
- name: Build Native Binaries | ||
run: nox --noxfile extensions/positron-python/noxfile.py --session native_build | ||
shell: bash |
This file contains 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
This file contains 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 |
---|---|---|
@@ -0,0 +1,104 @@ | ||
name: 'Build VSIX' | ||
description: "Build the extension's VSIX" | ||
|
||
inputs: | ||
node_version: | ||
description: 'Version of Node to install' | ||
required: true | ||
vsix_name: | ||
description: 'Name to give the final VSIX' | ||
required: true | ||
artifact_name: | ||
description: 'Name to give the artifact containing the VSIX' | ||
required: true | ||
cargo_target: | ||
description: 'Cargo build target for the native build' | ||
required: true | ||
vsix_target: | ||
description: 'vsix build target for the native build' | ||
required: true | ||
|
||
runs: | ||
using: 'composite' | ||
steps: | ||
- name: Install Node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ inputs.node_version }} | ||
cache: 'npm' | ||
|
||
- name: Rust Tool Chain setup | ||
uses: dtolnay/rust-toolchain@stable | ||
|
||
# Jedi LS depends on dataclasses which is not in the stdlib in Python 3.7. | ||
- name: Use Python 3.8 for JediLSP | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.8 | ||
cache: 'pip' | ||
cache-dependency-path: | | ||
extensions/positron-python/requirements.txt | ||
extensions/positron-python/python_files/jedilsp_requirements/requirements.txt | ||
|
||
- name: Upgrade Pip | ||
run: python -m pip install -U pip | ||
shell: bash | ||
|
||
# For faster/better builds of sdists. | ||
- name: Install build pre-requisite | ||
run: python -m pip install wheel nox | ||
shell: bash | ||
|
||
- name: Install Python Extension dependencies (jedi, etc.) | ||
run: nox --noxfile extensions/positron-python/noxfile.py --session install_python_libs | ||
shell: bash | ||
|
||
- name: Add Rustup target | ||
run: rustup target add ${{ inputs.cargo_target }} | ||
shell: bash | ||
|
||
- name: Build Native Binaries | ||
run: nox --noxfile extensions/positron-python/noxfile.py --session native_build | ||
shell: bash | ||
env: | ||
CARGO_TARGET: ${{ inputs.cargo_target }} | ||
|
||
- name: Run npm ci | ||
run: | | ||
cd extensions/positron-python | ||
npm ci --prefer-offline | ||
shell: bash | ||
|
||
- name: Update optional extension dependencies | ||
run: | | ||
cd extensions/positron-python | ||
npm run addExtensionPackDependencies | ||
shell: bash | ||
|
||
- name: Build Webpack | ||
run: | | ||
cd extensions/positron-python | ||
npx gulp clean | ||
npx gulp prePublishBundle | ||
shell: bash | ||
|
||
- name: Build VSIX | ||
run: | | ||
cd extensions/positron-python | ||
npx vsce package --target ${{ inputs.vsix_target }} --out positron-python-dev.vsix --pre-release | ||
shell: bash | ||
|
||
- name: Rename VSIX | ||
working-directory: extensions/positron-python | ||
# Move to a temp name in case the specified name happens to match the default name. | ||
run: | | ||
cp positron-python-dev.vsix positron-python-dev-temp.vsix && mv positron-python-dev-temp.vsix ${{ inputs.vsix_name }} | ||
shell: bash | ||
|
||
- name: Upload VSIX | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ inputs.artifact_name }} | ||
path: extensions/positron-python/${{ inputs.vsix_name }} | ||
if-no-files-found: error | ||
retention-days: 2 |
This file contains 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 |
---|---|---|
@@ -0,0 +1,70 @@ | ||
name: 'Smoke tests' | ||
description: 'Run smoke tests' | ||
|
||
inputs: | ||
node_version: | ||
description: 'Version of Node to install' | ||
required: true | ||
artifact_name: | ||
description: 'Name of the artifact containing the VSIX' | ||
required: true | ||
|
||
runs: | ||
using: 'composite' | ||
steps: | ||
- name: Update working directory | ||
run: cd extensions/positron-python | ||
shell: bash | ||
|
||
- name: Install Node | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: ${{ inputs.node_version }} | ||
cache: 'npm' | ||
|
||
- name: Install Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.x' | ||
cache: 'pip' | ||
cache-dependency-path: | | ||
extensions/positron-python/build/test-requirements.txt | ||
extensions/positron-python/requirements.txt | ||
|
||
- name: Install dependencies (npm ci) | ||
run: npm ci --prefer-offline | ||
shell: bash | ||
|
||
- name: Install Python requirements | ||
uses: brettcannon/pip-secure-install@v1 | ||
with: | ||
options: '-t extensions/positron-python/python_files/lib/python --implementation py' | ||
|
||
- name: pip install system test requirements | ||
run: | | ||
python -m pip install --upgrade -r extensions/positron-python/build/test-requirements.txt | ||
shell: bash | ||
|
||
# Bits from the VSIX are reused by smokeTest.ts to speed things up. | ||
- name: Download VSIX | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: ${{ inputs.artifact_name }} | ||
|
||
- name: Prepare for smoke tests | ||
run: npx tsc -p ./ | ||
shell: bash | ||
|
||
- name: Set CI_PYTHON_PATH and CI_DISABLE_AUTO_SELECTION | ||
run: | | ||
echo "CI_PYTHON_PATH=python" >> $GITHUB_ENV | ||
echo "CI_DISABLE_AUTO_SELECTION=1" >> $GITHUB_ENV | ||
shell: bash | ||
|
||
- name: Run smoke tests | ||
env: | ||
DISPLAY: 10 | ||
INSTALL_JUPYTER_EXTENSION: true | ||
uses: GabrielBB/[email protected] | ||
with: | ||
run: node --no-force-async-hooks-checks ./extensions/positron-python/out/test/smokeTest.js |
This file contains 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
This file contains 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.
is there a way to add a working directory for files in
.github/actions/
? It doesn't look like the way we set it in the Python CI works in this directory.positron/.github/workflows/positron-python-ci.yml
Lines 18 to 20 in 14bff09