fix(winpython): narrow search paths and add discovery cache#456
Merged
karthiknadig merged 8 commits intomainfrom May 7, 2026
Merged
fix(winpython): narrow search paths and add discovery cache#456karthiknadig merged 8 commits intomainfrom
karthiknadig merged 8 commits intomainfrom
Conversation
Performance Report (Linux) ✅
Legend
|
Test Coverage Report (Linux)
Coverage decreased. Please add tests for new code. |
Performance Report (macOS)
Legend
|
Performance Report (Windows) ✅
Legend
|
Test Coverage Report (Windows)
Coverage increased! Great work! |
There was a problem hiding this comment.
Pull request overview
This PR addresses Windows refresh performance regressions by narrowing the WinPython locator’s default discovery scope and adding an opt-in override for custom install locations, reducing expensive filesystem scans in Windows Defender hot paths.
Changes:
- Restricts default WinPython discovery to
%USERPROFILE%\WinPython, removing drive-root / common-user-folder scanning. - Adds
WINPYTHON_HOME(supports multiple paths) and factors path policy into a purebuild_search_paths(...)helper for testability. - Introduces a WinPython discovery cache and refresh-state syncing, and adds regression tests + README documentation.
Show a summary per file
| File | Description |
|---|---|
crates/pet-winpython/src/lib.rs |
Implements narrowed search-path policy, adds WINPYTHON_HOME, introduces discovery caching + refresh-state syncing, and adds tests for the new behavior. |
crates/pet-winpython/README.md |
Documents the new default search path behavior and how to opt in via WINPYTHON_HOME. |
Copilot's findings
- Files reviewed: 2/2 changed files
- Comments generated: 4
…456) Refactor discover_environments to delegate to discover_environments_in(locator, paths) so tests can inject paths instead of mutating env vars. Add tests for parent-dir and direct-install discovery, dedup contract, missing paths, find report loop, and all sync_refresh_state_from scope variants. Skip the redundant read_dir scan when search path is itself a WinPython install.
karthiknadig
added a commit
that referenced
this pull request
May 7, 2026
44ab3ad to
3b40f84
Compare
roblourens
approved these changes
May 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #453.
The WinPython locator was scanning
C:\,D:\,E:\,Program Files,~/Downloads,~/Desktop, and~/Documentson every refresh — all Windows Defender hot-spots — to find a niche portable distribution. That inflated p90 refresh latency for every Windows user, regardless of whether WinPython was installed.Changes
%USERPROFILE%\WinPython.WINPYTHON_HOMEenv var (single path or;-separated list; each entry can be or contain a WinPython install).Arc<Mutex<Option<Arc<Vec<...>>>>>), mirroringWindowsStoreandWindowsRegistry, withSyncedDiscoveryStaterefresh persistence.build_search_paths(userprofile, winpython_home)as a pure helper so tests don't have to mutate process env.WINPYTHON_HOMEparsing on both Windows and Unix.WINPYTHON_HOMEand the new search-path policy.try_from()behavior on a real WinPython executable is unchanged — it still walks parent directories looking for marker files /WPy*directory names.