From 99cbd290226a8f23d4d7f4e1f11a2d26f7316abf Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 3 Sep 2025 23:02:53 +0000 Subject: [PATCH 1/3] Initial plan From 77b5fa3789f53feb9d9efc820f73930a417dda67 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 3 Sep 2025 23:07:53 +0000 Subject: [PATCH 2/3] Update README with missing Pixi support, fix typo, add build instructions Co-authored-by: joshspicer <23246594+joshspicer@users.noreply.github.com> --- README.md | 45 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 64ca2e3e..a2a834dc 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Performant Python environment tooling and support, such as locating all global Python installs and virtual environments. -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). +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 JSONRPC requests/notifications for this tool, please reference [/docs/JSONRPC.md](https://github.com/microsoft/python-environment-tools/blob/main/docs/JSONRPC.md). ## Environment Types Supported @@ -15,6 +15,8 @@ This project will be consumed by the [Python extension](https://marketplace.visu - Miniconda - Miniforge - PipEnv +- Pixi +- Poetry - Homebrew - VirtualEnvWrapper - VirtualEnvWrapper-Win @@ -26,11 +28,52 @@ This project will be consumed by the [Python extension](https://marketplace.visu - Discovery of all global Python installs - Discovery of all Python virtual environments +- Fast performance using Rust with minimal I/O operations +- JSONRPC server interface for IDE integration +- Support for 15+ Python environment types across Windows, macOS, and Linux + +## Build and Usage + +### Building from Source + +```bash +# Clone the repository +git clone https://github.com/microsoft/python-environment-tools.git +cd python-environment-tools + +# Build the project +cargo build --release + +# Run tests +cargo test --all +``` + +### Usage + +```bash +# Start as a JSONRPC server (for IDE integration) +./target/release/pet server + +# Find all Python environments (CLI mode) +./target/release/pet find + +# Resolve details for a specific Python executable +./target/release/pet resolve /path/to/python +``` + +For detailed JSONRPC API documentation, see [/docs/JSONRPC.md](./docs/JSONRPC.md). ## Key Methodology Our approach prioritizes performance and efficiency by leveraging Rust. We minimize I/O operations by collecting all necessary environment information at once, which reduces repeated I/O and the need to spawn additional processes, significantly enhancing overall performance. +### Performance Principles + +- **Avoid spawning processes**: Extract information from files and filesystem when possible +- **Report immediately**: Use asynchronous discovery pattern to report environments as soon as they are found +- **Complete information**: Gather all environment details in one pass, avoiding incremental reporting +- **Minimal I/O**: Reduce filesystem operations through efficient batching and caching + ## Contributing This project welcomes contributions and suggestions. Most contributions require you to agree to a From 6cf91cfd465b58af81ad54dc978513c47db87c69 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 3 Sep 2025 23:09:17 +0000 Subject: [PATCH 3/3] Update environment type count to accurate 17+ types Co-authored-by: joshspicer <23246594+joshspicer@users.noreply.github.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a2a834dc..101bb9ee 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ This project will be consumed by the [Python extension](https://marketplace.visu - Discovery of all Python virtual environments - Fast performance using Rust with minimal I/O operations - JSONRPC server interface for IDE integration -- Support for 15+ Python environment types across Windows, macOS, and Linux +- Support for 17+ Python environment types across Windows, macOS, and Linux ## Build and Usage