Skip to content

Commit

Permalink
Do not remove uv itself on pip sync (#1649)
Browse files Browse the repository at this point in the history
## Summary

Added `uv` to the list of the preserved packages when building the
installer plan. In that case `uv` is not going to be removed when, for
example, using `python -m uv pip sync requirements.txt` when
requirements.txt does not contain `uv`, but `uv` is installed in that
venv.

Closes #1631 

## Test Plan

Got through the example attached to
#1631 and did see the uv deletion
in the output
```
$ python -m uv pip sync requirements.txt
Installed 1 package in 20ms
 + ruff==0.2.2
```
  • Loading branch information
flyaroundme authored Feb 18, 2024
1 parent fd1af47 commit c04f597
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion crates/uv-installer/src/plan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,10 @@ impl<'a> Planner<'a> {
let seed_packages = !venv.cfg().is_ok_and(|cfg| cfg.is_gourgeist());
for dist_info in site_packages {
if seed_packages
&& matches!(dist_info.name().as_ref(), "pip" | "setuptools" | "wheel")
&& matches!(
dist_info.name().as_ref(),
"pip" | "setuptools" | "wheel" | "uv"
)
{
debug!("Preserving seed package: {dist_info}");
continue;
Expand Down

0 comments on commit c04f597

Please sign in to comment.