Skip to content

Commit

Permalink
python: use Python Environment Tools for interpreter discovery (#5897)
Browse files Browse the repository at this point in the history
<!-- Thank you for submitting a pull request.
If this is your first pull request you can find information about
contributing here:
  * https://github.com/posit-dev/positron/blob/main/CONTRIBUTING.md

We recommend synchronizing your branch with the latest changes in the
main branch by either pulling or rebasing.
-->

<!--
  Describe briefly what problem this pull request resolves, or what
  new feature it introduces. Include screenshots of any new or altered
  UI. Link to any GitHub issues but avoid "magic" keywords that will
  automatically close the issue. If there are any details about your
  approach that are unintuitive or you want to draw attention to, please
  describe them here.
-->


### Release Notes

<!--
Optionally, replace `N/A` with text to be included in the next release
notes.
The `N/A` bullets are ignored. If you refer to one or more Positron
issues,
these issues are used to collect information about the feature or
bugfix, such
as the relevant language pack as determined by Github labels of type
`lang: `.
  The note will automatically be tagged with the language.

These notes are typically filled by the Positron team. If you are an
external
  contributor, you may ignore this section.
-->

#### New Features

- Install and compile Python Environment Tools, a Rust-based interpreter
discovery system #5886

#### Bug Fixes

- N/A


### QA Notes

<!--
  Add additional information for QA on how to validate the change,
  paying special attention to the level of risk, adjacent areas that
  could be affected by the change, and any important contextual
  information not present in the linked issues.
-->

Should be able to locate interpreters/start up Python runtimes with
setting `"python.locator": "native"`

---

TODO

- [x] re-enable native locator tests
- [x] add steps into build CI
  • Loading branch information
isabelizimm authored Jan 31, 2025
1 parent fc15137 commit 21a4d6b
Show file tree
Hide file tree
Showing 10 changed files with 454 additions and 14 deletions.
14 changes: 9 additions & 5 deletions .github/workflows/positron-python-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ on:

defaults:
run:
working-directory: 'extensions/positron-python'
working-directory: 'extensions/positron-python'

env:
NODE_VERSION: '20.12.1'
Expand Down Expand Up @@ -216,7 +216,8 @@ jobs:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python: ['3.x']
test-suite: [ts-unit, venv, single-workspace, debugger, functional, smoke]
test-suite:
[ts-unit, venv, single-workspace, debugger, functional, smoke]
# TODO: Add integration tests on windows and ubuntu. This requires updating
# src/test/positron/testElectron.ts to support installing Positron on these platforms.
exclude:
Expand Down Expand Up @@ -257,7 +258,9 @@ jobs:
cache: 'pip'

- name: Install Node dependencies
run: npm ci --fetch-timeout 120000
run: |
git config credential.https://api.github.com.token ${{ secrets.POSITRON_GITHUB_PAT }}
npm ci --fetch-timeout 120000
- name: Run `gulp prePublishNonBundle`
run: npm run prePublish
Expand Down Expand Up @@ -405,6 +408,7 @@ jobs:

- name: Run smoke tests
env:
POSITRON_GITHUB_PAT: ${{ github.token }}
run: npx tsc && node ./out/test/smokeTest.js
POSITRON_GITHUB_PAT: ${{ secrets.POSITRON_GITHUB_PAT }}
run: |
npx tsc && node ./out/test/smokeTest.js
if: matrix.test-suite == 'smoke'
2 changes: 2 additions & 0 deletions extensions/positron-python/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ tags
# --- Start Positron ---
python_files/posit/positron/tests/images
python_files/posit/positron/_vendor/**
scripts/*.js
resources/pet/**
# --- End Positron ---
python-env-tools/**
# coverage files produced as test output
Expand Down
14 changes: 10 additions & 4 deletions extensions/positron-python/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,7 @@
"onExP",
"preview"
],
"scope": "machine",
"scope": "machine-overridable",
"type": "string"
},
"python.pipenvPath": {
Expand Down Expand Up @@ -1800,14 +1800,15 @@
}
},
"scripts": {
"package": "gulp clean && gulp prePublishBundle && vsce package -o ms-python-insiders.vsix",
"package": "gulp clean && gulp prePublishBundle && vsce package -o positron-python-insiders.vsix",
"prePublish": "gulp clean && gulp prePublishNonBundle",
"compile": "tsc -watch -p ./",
"compileApi": "node ./node_modules/typescript/lib/tsc.js -b ./pythonExtensionApi/tsconfig.json",
"compiled": "deemon npm run compile",
"kill-compiled": "deemon --kill npm run compile",
"checkDependencies": "gulp checkDependencies",
"postinstall": "gulp installPythonLibs",
"install-pet": "ts-node scripts/install-pet.ts",
"postinstall": "gulp installPythonLibs && ts-node scripts/post-install.ts",
"test": "node ./out/test/standardTest.js && node ./out/test/multiRootTest.js",
"test:unittests": "mocha --config ./build/.mocha.unittests.json",
"test:unittests:cover": "nyc --no-clean --nycrc-path ./build/.nycrc mocha --config ./build/.mocha.unittests.json",
Expand Down Expand Up @@ -1950,5 +1951,10 @@
"webpack-require-from": "^1.8.6",
"worker-loader": "^3.0.8",
"yargs": "^15.3.1"
}
},
"positron": {
"externalDependencies": {
"pet": "v2024.16.0"
}
}
}
Loading

0 comments on commit 21a4d6b

Please sign in to comment.