Problem
On case-insensitive Windows filesystems, authoritative Conda paths such as C:\Users\user\Miniconda3 can be discovered alongside PET's lowercase well-known guess C:\Users\user\miniconda3. Both address the same installation, but get_environments() preserves the caller's install-prefix spelling and final deduplication is case-sensitive, so PET reports every environment twice.
norm_case() does not eliminate this scenario: GetLongPathNameW can restore the final component's spelling while preserving the caller-provided casing of parent components. A direct mixed-case filesystem probe reproduces that behavior on current Windows.
Reported originally in microsoft/vscode-python-environments#1703.
Scope
- Preserve the actual on-disk spelling of a discovered Conda install root without resolving symlinks or junctions.
- Ensure a child environment under an install's
envs directory is represented through the corrected install-root discovery rather than retaining a differently cased caller prefix.
- Deduplicate authoritative and well-known casing aliases before environment metadata is loaded/reported.
- Keep non-Windows path semantics unchanged.
- Avoid additional interpreter/process spawning and demonstrate no discovery-performance regression.
Acceptance criteria
- A Windows install physically named
Miniconda3 is reported once when discovered as both Miniconda3 and miniconda3.
- Base and child prefixes use the on-disk
Miniconda3 spelling.
- Junction identity is preserved.
- Windows regression tests cover base and child environments with casing aliases.
- Targeted tests, full Rust tests, format, clippy, coverage, and performance gates pass.
Fixes microsoft/vscode-python-environments#1703.
Problem
On case-insensitive Windows filesystems, authoritative Conda paths such as
C:\Users\user\Miniconda3can be discovered alongside PET's lowercase well-known guessC:\Users\user\miniconda3. Both address the same installation, butget_environments()preserves the caller's install-prefix spelling and final deduplication is case-sensitive, so PET reports every environment twice.norm_case()does not eliminate this scenario:GetLongPathNameWcan restore the final component's spelling while preserving the caller-provided casing of parent components. A direct mixed-case filesystem probe reproduces that behavior on current Windows.Reported originally in microsoft/vscode-python-environments#1703.
Scope
envsdirectory is represented through the corrected install-root discovery rather than retaining a differently cased caller prefix.Acceptance criteria
Miniconda3is reported once when discovered as bothMiniconda3andminiconda3.Miniconda3spelling.Fixes microsoft/vscode-python-environments#1703.