Always treat conda environments named base and root as base environments (#15682)

Extends https://github.com/astral-sh/uv/pull/15679

I'm not sure if we want to do this. It is probably _generally_ true, but
I think I'd rather remove the special casing entirely? I think the main
case for this is that it could help prevent regressions from #15679 and
we can remove it in a breaking release?
This commit is contained in:
Zanie Blue
2025-09-17 12:32:14 -05:00
committed by GitHub
parent 759eab837a
commit fa53a62f0b
2 changed files with 93 additions and 37 deletions
+7 -4
View File
@@ -104,12 +104,15 @@ impl CondaEnvironmentKind {
return Self::Child;
}
// These are the expected names for the base environment; we may want to remove this
// restriction in the future as it's not strictly necessary.
if current_env != "base" && current_env != "root" {
return Self::Child;
// If the environment name is "base" or "root", treat it as a base environment
//
// These are the expected names for the base environment; and is retained for backwards
// compatibility, but in a future breaking release we should remove this special-casing.
if current_env == "base" || current_env == "root" {
return Self::Base;
}
// For other environment names, use the path-based logic
let Some(name) = path.file_name() else {
return Self::Child;
};