Skip to content

Commit f8da764

Browse files
authored
Merge branch 'main' into users/merlinbot/1es-pt-auto-baselining-pr
2 parents 0856a06 + ebeb53f commit f8da764

File tree

28 files changed

+366
-77
lines changed

28 files changed

+366
-77
lines changed

.devcontainer/linux-homebrew/Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ RUN curl https://raw.githubusercontent.com/DonJayamanne/vscode-jupyter/container
1010
RUN echo "# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh." >> ~/.zshrc
1111
RUN echo "[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh" >> ~/.zshrc
1212

13-
# Install Pythone
13+
# Install Python
14+
# homebrew/brew:4.4.6 broke running `brew install` as root.
15+
# As a workaround, running `brew update` and ignoring errors coming from it fixes `brew install`.
16+
RUN brew update || true
1417
RUN brew install python@3.12 python@3.11
1518

1619
# Install Rust

.github/workflows/pr-check.yml

Lines changed: 38 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ on:
1313
- release*
1414
- release/*
1515
- release-*
16+
workflow_dispatch:
1617

1718
jobs:
1819
tests:
@@ -44,7 +45,7 @@ jobs:
4445
- name: Set Python to PATH
4546
uses: actions/setup-python@v5
4647
with:
47-
python-version: "3.x"
48+
python-version: "3.12"
4849

4950
- name: Homebrew Python
5051
if: startsWith( matrix.os, 'macos')
@@ -133,7 +134,7 @@ jobs:
133134
if: startsWith( matrix.os, 'ubuntu') || startsWith( matrix.os, 'macos')
134135
run: |
135136
pyenv install --list
136-
pyenv install 3.12.6 3.8.19
137+
pyenv install 3.13.0 3.12.8 3.8.20
137138
shell: bash
138139

139140
# pyenv-win install list has not updated for a while
@@ -166,6 +167,23 @@ jobs:
166167

167168
# endregion venv
168169

170+
# region Pixi
171+
- name: Install Pixi
172+
uses: prefix-dev/setup-pixi@v0.8.1
173+
with:
174+
run-install: false
175+
176+
- name: Create Pixi environments
177+
run: |
178+
pixi init
179+
pixi add python
180+
pixi add --feature dev python
181+
pixi project environment add --feature dev dev
182+
pixi install --environment dev
183+
shell: bash
184+
185+
# endregion Pixi
186+
169187
# Rust
170188
- name: Rust Tool Chain setup
171189
uses: dtolnay/rust-toolchain@stable
@@ -179,7 +197,7 @@ jobs:
179197

180198
- name: Find Environments
181199
if: matrix.run_cli == 'yes'
182-
run: cargo run --release --target ${{ matrix.target }}
200+
run: cargo run --release --target ${{ matrix.target }} -- find -v -l
183201
shell: bash
184202

185203
- name: Run Tests
@@ -230,7 +248,7 @@ jobs:
230248
if: startsWith( matrix.feature, 'ci-poetry')
231249
uses: actions/setup-python@v5
232250
with:
233-
python-version: "3.x"
251+
python-version: "3.12"
234252

235253
- name: Set Python 3.12 to PATH
236254
if: startsWith( matrix.feature, 'ci-poetry')
@@ -286,48 +304,48 @@ jobs:
286304
virtualenvs-path: ~/my-custom-path
287305
installer-parallel: true
288306

289-
- name: Petry exe
307+
- name: Poetry exe
290308
if: startsWith( matrix.feature, 'ci-poetry')
291309
run: which poetry
292310
shell: bash
293311

294-
- name: Petry config
312+
- name: Poetry config
295313
if: startsWith( matrix.feature, 'ci-poetry')
296314
run: poetry config --list
297315
shell: bash
298316

299-
- name: Petry setup
317+
- name: Poetry setup
300318
if: startsWith( matrix.feature, 'ci-poetry')
301319
# We want to have 2 envs for this poetry project 3.12 and 3.11.
302320
run: poetry init --name=pet-test --python=^3.11 -q -n
303321
shell: bash
304322

305-
- name: Petry virtual env setup 3.12
323+
- name: Poetry virtual env setup 3.12
306324
if: startsWith( matrix.feature, 'ci-poetry') && startsWith( matrix.os, 'ubuntu')
307325
run: poetry env use 3.12
308326
shell: bash
309327

310-
- name: Petry virtual env setup 3.12
328+
- name: Poetry virtual env setup 3.12
311329
if: startsWith( matrix.feature, 'ci-poetry') && startsWith( matrix.os, 'windows')
312330
run: poetry env use $PYTHON_3_12_PATH
313331
shell: bash
314332

315-
- name: Petry virtual env setup 3.11
333+
- name: Poetry virtual env setup 3.11
316334
if: startsWith( matrix.feature, 'ci-poetry') && startsWith( matrix.os, 'ubuntu')
317335
run: poetry env use 3.11
318336
shell: bash
319337

320-
- name: Petry virtual env setup 3.11
338+
- name: Poetry virtual env setup 3.11
321339
if: startsWith( matrix.feature, 'ci-poetry') && startsWith( matrix.os, 'windows')
322340
run: poetry env use $PYTHON_3_11_PATH
323341
shell: bash
324342

325-
- name: Petry list envs
343+
- name: Poetry list envs
326344
if: startsWith( matrix.feature, 'ci-poetry')
327345
run: poetry env list
328346
shell: bash
329347

330-
- name: Petry pyproject.toml
348+
- name: Poetry pyproject.toml
331349
if: startsWith( matrix.feature, 'ci-poetry')
332350
run: cat pyproject.toml
333351
shell: bash
@@ -351,7 +369,7 @@ jobs:
351369
shell: bash
352370

353371
- name: Find Environments
354-
run: cargo run --release --target ${{ matrix.target }}
372+
run: cargo run --release --target ${{ matrix.target }} -- find -v -l
355373
shell: bash
356374

357375
- name: Run Tests
@@ -394,7 +412,11 @@ jobs:
394412
# Homebrew
395413
- name: Homebrew Python
396414
if: startsWith( matrix.image, 'homebrew')
397-
run: brew install python@3.12 python@3.11
415+
run: |
416+
# homebrew/brew:4.4.6 broke running `brew install` as root.
417+
# As a workaround, running `brew update` and ignoring errors coming from it fixes `brew install`.
418+
brew update || true
419+
brew install python@3.12 python@3.11
398420
shell: bash
399421

400422
# Rust
@@ -409,7 +431,7 @@ jobs:
409431
shell: bash
410432

411433
- name: Find Environments
412-
run: cargo run --release --target ${{ matrix.target }}
434+
run: cargo run --release --target ${{ matrix.target }} -- find -v -l
413435
shell: bash
414436

415437
- name: Run Tests

Cargo.lock

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Python environment tools for Visual Studio Code
22

3-
Performant Python environment tooling and support, such as locating all global Python installs and virtual environments.
3+
Performant Python environment tooling and support, such as locating all global Python installs and virtual environments.
4+
5+
This project will be consumed by the [Python extension](https://marketplace.visualstudio.com/items?itemName=ms-python.python) directly. You can find the code to consume `pet` in the Python extension [source code](https://github.com/microsoft/vscode-python/blob/main/src/client/pythonEnvironments/base/locators/common/nativePythonFinder.ts). For more information on JSNORPC requests/notifications for this tool, please reference [/docs/JSONRPC.md](https://github.com/microsoft/python-environment-tools/blob/main/docs/JSONRPC.md).
46

57
## Environment Types Supported
68

azure-pipelines/pre-release.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
11
# Run on a schedule
2-
trigger: none
2+
trigger:
3+
branches:
4+
include:
5+
- main
36
pr: none
47

5-
schedules:
6-
- cron: "0 10 * * 1-5" # 10AM UTC (2AM PDT) MON-FRI (VS Code Pre-release builds at 9PM PDT)
7-
displayName: Nightly Pre-Release Schedule
8-
always: false # only run if there are source code changes
9-
branches:
10-
include:
11-
- main
12-
138
resources:
149
repositories:
1510
- repository: templates
@@ -26,6 +21,11 @@ extends:
2621
signing: true
2722
buildWasm: false
2823
apiScanSoftwareVersion: 2024 # major version of `pet` for internal reporting
24+
tsa:
25+
enabled: true
26+
config:
27+
areaPath: "Visual Studio Code Python Extensions"
28+
serviceTreeID: 6e6194bc-7baa-4486-86d0-9f5419626d46
2929

3030
buildPlatforms:
3131
- name: Linux

azure-pipelines/stable.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,13 @@ extends:
1717
binaryName: "pet"
1818
signing: true
1919
buildWasm: false
20+
apiScanPublishSymbols: true
2021
apiScanSoftwareVersion: 2024 # major version of `pet` for internal reporting
22+
tsa:
23+
enabled: true
24+
config:
25+
areaPath: "Visual Studio Code Python Extensions"
26+
serviceTreeID: 6e6194bc-7baa-4486-86d0-9f5419626d46
2127

2228
buildPlatforms:
2329
- name: Linux

crates/pet-conda/README.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,6 @@
3636
- Thus using the `history` file we can find the conda installation folder.
3737
This is useful in cases where conda environments are created using `-p` option.
3838

39-
## Known issues
40-
41-
- Note: pixi seems to use conda envs internall, hence its possible to falsely identify a pixi env as a conda env.
42-
- However pixi is not supported by this tool, hence thats not a concern.
43-
4439
## Miscellanous
4540

4641
- What if conda is installed in some custom locations that we have no idea about?

crates/pet-conda/src/conda_rc.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ fn get_conda_conda_rc_from_path(conda_rc: &PathBuf) -> Option<Condarc> {
216216
if env_dirs.is_empty() && files.is_empty() {
217217
None
218218
} else {
219+
trace!("conda_rc: {:?} with env_dirs {:?}", conda_rc, env_dirs);
219220
Some(Condarc { env_dirs, files })
220221
}
221222
}

crates/pet-conda/src/environment_locations.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ fn get_conda_environment_paths_from_conda_rc(env_vars: &EnvVariables) -> Vec<Pat
7575
let mut env_dirs = vec![];
7676
for rc_file_dir in get_conda_rc_search_paths(env_vars) {
7777
if !rc_file_dir.exists() {
78+
trace!(".condarc not found ({:?})", rc_file_dir);
7879
continue;
7980
}
8081

@@ -111,7 +112,7 @@ fn get_conda_environment_paths_from_conda_rc(env_vars: &EnvVariables) -> Vec<Pat
111112
);
112113
env_dirs.append(&mut conda_rc.env_dirs.clone());
113114
} else {
114-
trace!("No Conda environments in .condarc");
115+
trace!("No Conda environments in .condarc {:?}", env_dirs);
115116
}
116117
env_dirs
117118
}

crates/pet-conda/src/environments.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,8 @@ fn get_conda_dir_from_cmd(cmd_line: String) -> Option<PathBuf> {
186186
let conda_exe = resolve_symlink(&conda_exe).unwrap_or(conda_exe);
187187
if let Some(cmd_line) = conda_exe.parent() {
188188
if let Some(conda_dir) = cmd_line.file_name() {
189-
if conda_dir.to_ascii_lowercase() == "bin"
190-
|| conda_dir.to_ascii_lowercase() == "scripts"
189+
if conda_dir.to_string_lossy().to_lowercase() == "bin"
190+
|| conda_dir.to_string_lossy().to_lowercase() == "scripts"
191191
{
192192
if let Some(conda_dir) = cmd_line.parent() {
193193
// Ensure the casing of the paths are correct.

0 commit comments

Comments
 (0)