-
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
base: main
Are you sure you want to change the base?
Changes from 20 commits
2d1658c
72ce282
5d4a4cf
3e317cb
9c2ddba
c8db8b0
06d13d4
f1d2c1f
8b247ed
8ba5db2
77efe40
55b7461
c0ddffb
b01e189
383cf53
c5a64c9
018cd9f
2d9ca1b
c57dca8
db5cf4c
69dbdb1
aed1167
5dcf7bf
ad4dbb1
8fc277c
b6f7586
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: "Setup Python Environment Tools" | ||
description: "Install and build microsoft/python-environment-tools" | ||
|
||
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' | ||
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 |
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 |
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/equirements.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 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -689,7 +689,7 @@ | |
"type": "string" | ||
}, | ||
"python.locator": { | ||
"default": "js", | ||
"default": "native", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right now, the rust locator is considered experimental and is opt-in only for upstream. I've swapped it for testing purposes, but we'll want to decide what we want as the default. I've played around with it locally, and it seems to be finding everything and is MUCH FASTER, eg, 1-3 seconds to find my 80+ envs. We should do a bit more robust testing before deciding though. |
||
"description": "%python.locator.description%", | ||
"enum": [ | ||
"js", | ||
|
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