Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 44 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand All @@ -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 17+ 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
Expand Down