-
Notifications
You must be signed in to change notification settings - Fork 36
Fix/windows uv path detection #249
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix/windows uv path detection #249
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes the UV installation method detection on Windows by normalizing path separators before pattern matching. The issue occurred because Windows uses backslashes (\) in paths while the detection logic only looked for forward slashes (/).
Key Changes:
- Normalized path separators in
detect_installation_method()to handle both Unix and Windows paths - Added comprehensive test coverage for Windows path detection scenarios
- Updated the prompt file to reflect cross-platform path detection requirements
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| pdd/auto_update.py | Normalized path separators in detect_installation_method() and improved docstrings/type hints throughout |
| tests/test_auto_update.py | Added Windows path detection test (duplicated function definition) |
| pdd/prompts/auto_update_python.prompt | Updated requirements to specify cross-platform path separator support |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| def test_detect_uv_installation_windows(): | ||
| """Test detection of UV installation on Windows with backslash paths.""" | ||
| # Test Windows UV tool paths with backslashes | ||
| assert detect_installation_method( | ||
| r"C:\Users\pmbri\AppData\Roaming\uv\tools\pdd-cli\Scripts\python.exe" | ||
| ) == "uv" | ||
| assert detect_installation_method( | ||
| r"C:\Users\user\.local\share\uv\tools\pdd-cli\Scripts\python.exe" | ||
| ) == "uv" | ||
| assert detect_installation_method( | ||
| r"D:\uv\tools\pdd-cli\bin\python.exe" | ||
| ) == "uv" | ||
| # Test with forward slashes on Windows (some tools normalize paths) | ||
| assert detect_installation_method( | ||
| "C:/Users/user/AppData/Roaming/uv/tools/pdd-cli/Scripts/python.exe" | ||
| ) == "uv" | ||
|
|
||
|
|
||
| def test_get_upgrade_command(): |
Copilot
AI
Jan 6, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function test_detect_uv_installation_windows() is defined twice in this file (lines 210-226 and lines 248-259). This will cause the first definition to be silently overwritten by the second, and only one set of test cases will actually execute. Remove the duplicate definition at lines 248-259.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The suggested change have been made
tests/test_auto_update.py
Outdated
| assert isinstance(pip_shell, bool) | ||
| assert isinstance(pip_shell, bool) | ||
|
|
||
| #test for Windows paths with backslashes |
Copilot
AI
Jan 6, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comments should start with a capital letter and have a space after the #. Change to # Test for Windows paths with backslashes.
| #test for Windows paths with backslashes | |
| # Test for Windows paths with backslashes |
|
5b0c732 to
24f232d
Compare
Add test case for Windows paths with backslashes in UV installation detection to demonstrate the bug where Windows users encounter "No module named pip" error during auto-update.
a39a9a9 to
6ef3c6c
Compare
Test Results UpdateHi! I've completed all requested validations for this PR. Here are the results: 1. Regression Tests
2. Bug Detection ValidationVerified that Before fix (without path normalization):
After fix (with path normalization):
This confirms the test reproduces the original bug and validates the fix works as intended. 3. Warnings FixedIssue: pytest warning Fix: Installed dev dependencies ( Result: All warnings resolved 4. Test Coveragepdd/auto_update.py 81 lines 13 missed 84% coverage Critical finding:
Coverage Summary:
Additional Improvements
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you need to remove this prompt change here and put it in pdd_cap
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Already done. The prompt change is now in pdd_cap.
Normalize path separators to handle both Unix (/) and Windows (\) paths when detecting UV installation method. This fixes the "No module named pip" error that Windows users encounter during auto-update. The fix adds path normalization in detect_installation_method() by converting backslashes to forward slashes before checking for UV path markers, ensuring cross-platform compatibility.
Fixed issue where two identical test functions existed in the same file. The duplicate function (lines 248-259) was overriding the more complete version (lines 210-226), which included additional test cases.
6ef3c6c to
550a738
Compare
Description
Fixes Windows path detection in UV installation method detection, resolving the "No module named pip" error for Windows users.
Fixes #149
Changes Made
Code Changes
detect_installation_method()Test Changes
test_detect_uv_installation_windows()Prompt Changes
pdd updateTesting
Test Results
======================== 12 passed, 1 warning in 0.02s =========================
About the pytest warning:
This warning (Unknown config option: asyncio_default_fixture_loop_scope) is a pre-existing issue in the project's pytest configuration, not introduced by this PR.
Evidence:
The warning exists in both branches. The only difference is one additional test for Windows path detection. All tests pass successfully and the warning does not affect functionality.
All auto_update tests pass including:
Testing Environment
Limitations
Windows environment verification needed: Tested on macOS using unit tests that simulate Windows paths. Real Windows + UV environment testing would be valuable.
Dev Unit Checklist
pdd updateRegression Testing
Screenshots/Logs
N/A - Logic fix verified through unit tests
Related Issues
Fixes #149
Additional Notes
This fix follows PDD principles: