Skip to content

Commit d9fc8f7

Browse files
authored
Add WinPython support and testing (#330)
Fixes #96 Introduce support for detecting WinPython environments. ## Changes - Add new \pet-winpython\ crate for WinPython environment detection - Add \WinPython\ to \PythonEnvironmentKind\ and \LocatorKind\ enums - Integrate WinPython locator into the locator chain - Update JSONRPC documentation ## Detection Strategy WinPython environments are identified by: 1. Marker files: \.winpython\ or \winpython.ini\ in parent directories 2. Directory naming pattern: \WPy64-*\, \WPy32-*\, or \WPy-*\ 3. Python folder naming: \python-X.Y.Z.amd64\ or \python-X.Y.Z\ ## Testing Added 14 tests covering directory/folder name patterns, version extraction, marker file detection, and locator trait verification.
1 parent 6e3266d commit d9fc8f7

File tree

9 files changed

+625
-9
lines changed

9 files changed

+625
-9
lines changed

Cargo.lock

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

crates/pet-core/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ pub enum LocatorKind {
5656
Venv,
5757
VirtualEnv,
5858
VirtualEnvWrapper,
59+
WinPython,
5960
WindowsRegistry,
6061
WindowsStore,
6162
}

crates/pet-core/src/python_environment.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ pub enum PythonEnvironmentKind {
2828
Venv,
2929
VirtualEnv,
3030
VirtualEnvWrapper,
31+
WinPython,
3132
WindowsStore,
3233
WindowsRegistry,
3334
}

crates/pet-winpython/Cargo.toml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
[package]
2+
name = "pet-winpython"
3+
version = "0.1.0"
4+
edition = "2021"
5+
license = "MIT"
6+
7+
[dependencies]
8+
pet-core = { path = "../pet-core" }
9+
pet-fs = { path = "../pet-fs" }
10+
pet-python-utils = { path = "../pet-python-utils" }
11+
pet-virtualenv = { path = "../pet-virtualenv" }
12+
log = "0.4.21"
13+
lazy_static = "1.4.0"
14+
regex = "1.10.4"
15+
16+
[dev-dependencies]
17+
tempfile = "3.10"

crates/pet-winpython/README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# WinPython Locator
2+
3+
This crate provides support for detecting [WinPython](https://winpython.github.io/) environments.
4+
5+
## Detection Strategy
6+
7+
WinPython environments are identified by looking for:
8+
9+
1. **Marker files**: `.winpython` or `winpython.ini` file in parent directories
10+
2. **Directory naming pattern**: Parent directory matching patterns like `WPy64-*`, `WPy32-*`, or `WPy-*`
11+
3. **Python folder naming**: The Python installation folder typically follows the pattern `python-X.Y.Z.amd64` or `python-X.Y.Z`
12+
13+
## Typical WinPython Directory Structure
14+
15+
```
16+
WPy64-31300/ # Top-level WinPython directory
17+
├── .winpython # Marker file (may also be winpython.ini)
18+
├── python-3.13.0.amd64/ # Python installation
19+
│ ├── python.exe
20+
│ ├── pythonw.exe
21+
│ ├── Scripts/
22+
│ └── Lib/
23+
├── scripts/ # WinPython-specific scripts
24+
│ ├── env.bat
25+
│ └── WinPython Command Prompt.exe
26+
├── settings/ # Settings directory
27+
└── notebooks/ # Optional Jupyter notebooks
28+
```
29+
30+
## Platform Support
31+
32+
This locator only works on Windows, as WinPython is a Windows-only distribution.

0 commit comments

Comments
 (0)