prefix-dev / pixi

Package management made easy
https://pixi.sh
BSD 3-Clause "New" or "Revised" License
3.24k stars 178 forks source link

`pixi add <dependency>` fails when the dependency already exists in the manifest and if it's the latest version #1401

Open vigneshmanick opened 5 months ago

vigneshmanick commented 5 months ago

Checks

Reproducible example

[tool.pixi.feature.test.dependencies]
pytest = ">=8.1.1,<8.2"
pytest-cov = ">=5.0.0,<5.1"
pytest-xdist = ">=3.5.0,<3.6"
pixi add -f test pytest
✔ Added pytest

will result in pytest changing to pytest = ">=8.2.0,<8.3" since the version in the manifest is lower than the current version and the command passes

but if now we try the same with pytest-cov will result in a failure since the version in the manifest is already the latest version

pixi add -f test pytest-cov
  × pytest-cov is already a dependency.

Issue description

Until the pixi update/upgrade command is available, i am trying to update the dependencies by just running the pixi add command. In doing so i have noticed that, when a dependency version is already the latest version then adding it again using pixi add will result in an error.

Expected behavior

There should be no error and the message should be that the version in the manifest is already the latest version. Also when the dependency is added that is already present the message should be Updated <dependency> from <vX> to <vY>

pixi add -f test pytest
✔ Updated pytest in feature: test  from  >=8.1.1,<8.2 to >=8.1.2,<8.2
pixi add -f test pytest-cov
  ✔ pytest-cov in feature: test is already the latest version. No changes have been made
ruben-arts commented 5 months ago

pixi update will arrive soon, so I propose to wait for that implementation before we change any of the current add behavior.

vigneshmanick commented 5 months ago

related to #1449

baszalmstra commented 2 months ago

pixi update is available!

If you run pixi add python twice in a row now (without any version specifiers) the second invocation won't error but pixi also won't update the bounds.