Skip to content

Commit

Permalink
Update project::update_environment to respect reinstall options (#4502
Browse files Browse the repository at this point in the history
)

While working on #4492 I noticed
that `--reinstall-package` was not actually respected by
`update_environment`, it exited early due to satisfied requirements.

Before

```

❯ cargo run -q -- tool install black -v --reinstall-package tomli
...
DEBUG All requirements satisfied: black | click>=8.0.0 | mypy-extensions>=0.4.3 | packaging>=22.0 | pathspec>=0.9.0 | platformdirs>=2 | tomli>=1.1.0 ; python_version < '3.11' | typing-extensions>=4.0.1 ; python_version < '3.11'
```

After

```
❯ cargo run -q -- tool install black -v --reinstall-package tomli
...
Uninstalled 1 package in 0.99ms
Installed 1 package in 4ms
 - tomli==2.0.1
 + tomli==2.0.1
```
  • Loading branch information
zanieb committed Jun 25, 2024
1 parent 08bf6fb commit e242cdf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion crates/uv/src/commands/project/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ pub(crate) async fn update_environment(

// Check if the current environment satisfies the requirements
let site_packages = SitePackages::from_environment(&venv)?;
if spec.source_trees.is_empty() {
if spec.source_trees.is_empty() && reinstall.is_none() {
match site_packages.satisfies(&spec.requirements, &spec.constraints)? {
// If the requirements are already satisfied, we're done.
SatisfiesResult::Fresh {
Expand Down

0 comments on commit e242cdf

Please sign in to comment.