Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pixi add and pixi upgrade uses wrong pinning strategy in some cases #2574

Closed
2 tasks done
seowalex opened this issue Nov 27, 2024 · 3 comments · Fixed by #2580
Closed
2 tasks done

pixi add and pixi upgrade uses wrong pinning strategy in some cases #2574

seowalex opened this issue Nov 27, 2024 · 3 comments · Fixed by #2580
Labels
🐞 bug Something isn't working 👋 good first issue Good for newcomers

Comments

@seowalex
Copy link
Contributor

Checks

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pixi, using pixi --version.

Reproducible example

pixi init
pixi add pyodbc python sqlalchemy

Output:

Added pyodbc >=5.2.0,<6
Added python >=3.12.7, <3.13
Added sqlalchemy>=2.0.36,<2.1

Issue description

When adding/upgrading packages, encountering any packages in NON_SEMVER_PACKAGES causes the rest of the packages to use the minor pinning strategy.

I believe this was introduced in #2310 as the pinning_strategy is set for future iterations of the loop when any packages in NON_SEMVER_PACKAGES are encountered. Notably, this only happens when the pinning strategy is unset, so one mitigation is to set pinning-strategy: "semver" in the Pixi configuration file (although this has the side-effect of forcing NON_SEMVER_PACKAGES to be pinned to their major version).

Expected behavior

Expected output:

Added pyodbc >=5.2.0,<6
Added python >=3.12.7, <3.13
Added sqlalchemy>=2.0.36,<3
@seowalex
Copy link
Contributor Author

On a side note, trying to debug this has made me realise pixi add/pixi upgrade does not sort dependencies alphabetically, which I think it should?

@ruben-arts
Copy link
Contributor

Thanks for the report, nice find. Definitely a bug.

On a side note, trying to debug this has made me realise pixi add/pixi upgrade does not sort dependencies alphabetically, which I think it should?

We touch the file as little as we can, users often sort them in their own order with some comments. e.g.:

[dependencies]
# Needed for feature x
python  = "1.2.3"
matplotlib = "2.3.4"

# Used in xyz
pytorch = "*"

@seowalex
Copy link
Contributor Author

Got it, that makes sense. The fix seems simple enough, I've proposed it at #2580.

ruben-arts pushed a commit that referenced this issue Nov 28, 2024
…2580)

Fixes #2574.

I added a test as well, but I'm not sure if it follows the project's
standards.
jjjermiah pushed a commit to jjjermiah/pixi that referenced this issue Nov 30, 2024
…refix-dev#2580)

Fixes prefix-dev#2574.

I added a test as well, but I'm not sure if it follows the project's
standards.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working 👋 good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants