Use an ephemeral environment for uv run --with invocations (#14447)

This PR creates separation between the `--with` environment and the
environment we actually run in, which in turn solves issues like
https://github.com/astral-sh/uv/issues/12889 whereby two invocations
share the same `--with` environment, causing them to collide by way of
sharing an overlay.

Closes https://github.com/astral-sh/uv/issues/7643.
This commit is contained in:
Charlie Marsh 2025-07-14 13:18:39 -04:00 committed by Zanie Blue
parent 9cf7821741
commit 6df7dab2df
7 changed files with 159 additions and 147 deletions

View file

@ -174,7 +174,7 @@ impl PythonEnvironment {
/// N.B. This function also works for system Python environments and users depend on this.
pub fn from_root(root: impl AsRef<Path>, cache: &Cache) -> Result<Self, Error> {
debug!(
"Checking for Python environment at `{}`",
"Checking for Python environment at: `{}`",
root.as_ref().user_display()
);
match root.as_ref().try_exists() {