Skip to content

Commit

Permalink
fix: always overwrite when pixi adding the dependency (#1935)
Browse files Browse the repository at this point in the history
Before:
```
pixi add numpy
pixi add pandas==2.0.1
# fails because of numpy <2 requirement
pixi add numpy panda==2.0.1
# Still fails but it should just resolve the two packages together
```
After this PR
```
pixi add numpy
pixi add pandas==2.0.1
# fails because of numpy <2 requirement
pixi add numpy panda==2.0.1
# Works as numpy is readded to the project without constraints and the solve is rerun for it.
```
  • Loading branch information
ruben-arts authored Aug 30, 2024
1 parent 83715da commit 3f5f965
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/cli/add.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ pub async fn execute(args: Args) -> miette::Result<()> {
spec_type,
&dependency_config.platform,
&dependency_config.feature_name(),
DependencyOverwriteBehavior::OverwriteIfExplicit,
DependencyOverwriteBehavior::Overwrite,
&channel_config,
)?;
if added {
Expand All @@ -136,7 +136,7 @@ pub async fn execute(args: Args) -> miette::Result<()> {
&dependency_config.platform,
&dependency_config.feature_name(),
Some(args.editable),
DependencyOverwriteBehavior::OverwriteIfExplicit,
DependencyOverwriteBehavior::Overwrite,
)?;
if added {
if spec.version_or_url.is_none() {
Expand Down
2 changes: 1 addition & 1 deletion tests/install_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ async fn minimal_lockfile_update_pypi() {
assert!(lock.contains_pep508_requirement(
consts::DEFAULT_ENVIRONMENT_NAME,
Platform::current(),
pep508_rs::Requirement::from_str("click==7.1.2").unwrap()
pep508_rs::Requirement::from_str("click>7.1.2").unwrap()
));
}

Expand Down

0 comments on commit 3f5f965

Please sign in to comment.