-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Broken dependency evaluation in pip 24.3.1. Pip will not recognize installed prerelease versions #13089
Comments
Doesn’t the |
|
Hang on - your requirement is spdbtools<1.0,>=0.7.1, but you have 0.7.1a20241118121953. According to the version specification:
So your alpha release does not satisfy the constraint >=0.7.1. Pip is behaving according to spec here. |
Yeah, it's a part of the spec that I see a lot of people confused by, but You must specify |
Yes. I looked very closely at those in the past. It's according to the specification. And specification is good. But still it does not make it easy for the workflow described by @maarre.
Yes, but this is a bit problematic becasue By adding And it does make it very tricky when you have a workflow of releasing two packages at the same time and want to make rc candidates of package A that might become final candidate and you want it to depend on the new version of the package B - that you also want to release as an rc candidate at the same time. Say: you releae We have this very problem very often in Airflow - when it often happens that at the same we want to relese a new common package with new feature (say And this is problematic because you effectively have to modify your dependencies in either git repo or relased packages between the RC and final version. That's not good workflow - for security and relase process especially - modifying code between rc and final version is problematic especially if you already started to develop new version and you release from Our solution in airflow (really a workaround) that we found working for us is to dynamically modify the rc packages with rc dependencies for all our rc packages. In the example above when we generate THis way in our pyproject.toml/hatch_build.py we keep the final dependency ( It's a workable solution and works good for us in Airflow - so maybe you can adapt it as well @maarre - however it requires dynamic generation of requirements and quite some automation of your release process. Another, better solution that maybe we might see in the future is to be able to specify selectively which packages should be treated differently, say if we could specify which packages could be treated differently with pre-releases we could use somethign like Another option is what |
There's a workaround to get per package prerelease, create a constraints file
Then you can add |
This is only half of a solution. You'd still need to modify dynamically your RC package requirement. In the example above, I want So the only solution I see now is to dynamically modify rc1 packages to modify their dependencies Again - I want to avoid to have to bump The flag that could solve it will have to dp two things:
|
As I read this it appears to me what you're asking for is a "light" override of the requirements. It's an interesting idea, but I don't see if getting any kind of traction with pip maintainers unless it became a standard. As maintainers have strongly expressed not wanting to help user install "broken" requirements. There has been discussion of override interfaces before, e.g. #8076 (comment) where I proposed an exactly equivalent interface to uv's |
Yes. but with a twist. I do not want (and I agree with maintainers here) to allow for broken dependencies. That would be very bad. What I would see as a possible solution is to handle specific case where you want to treat pre-release candidates version comparision differently for the packages that have not yet been released (only pre-released). Simply recognising the fact that there is a use case where |
That's a spec change, so the discussion must happen on the packaging forum, as it happens there is a discussion that is going on right now that has devolved into including that very question: https://discuss.python.org/t/proposal-intersect-and-disjoint-operations-for-python-version-specifiers/71888/20 I'm hoping though that discussion gets moved to it's own dedicated thread, I'll post back here if it does. |
It will, and I intend to propose a clarified version of the spec. However, I will say right now that changing the fact that |
You are wrong. The ordering just defines which one to choose. No suffix is more worth than any prerelease. |
https://packaging.python.org/en/latest/specifications/version-specifiers/#handling-of-pre-releases
|
@potiuk you almost nailed it. Very well described. See my previous post. |
I am not, sorry. Pip follows the standards, and this is what the standard says tools must do. The section of the standard you quoted is not relevant here, as that only covers situations where the ordering rules mean that a pre-release would match the specifier. It's the ordering rules which state that alpha releases come before final releases, and they leave no room for ambiguity on that matter.
You may be correct in saying this, but if so, then the spec is wrong, not pip. I'd support someone asking for a change to the spec, and if such a change was approved, pip would be changed to behave as required by the new spec, but the point is that the spec must be changed first.
Yes, but the solution proposed by @potiuk would require pip to support a flag that explicitly caused us to violate the spec. We won't do that. To be absolutely clear - if you want version 0.7.1a20241118121953 to satisfy a version specifier of |
That's very fair expectation. I will take a look at the discussion that @notatallshaw pointed us to (thanks - it's next to impossible for us who have 100s of others things to follow all the discussions in packaging) and see if I can propose something (as a follow up as @pfmoore suggested) |
It should also be noted, it is Packaging which implements the behavior here, pip mostly inherits from it. Another reason why discussing the spec here is not that useful. For changing this behavior you describe, which all implementations of versions specifiers follow (packaging, poetry-core, and uv), there would need to be a consensus reached on discuss (and a PEP of it was agreed a change to the spec) and then packaging would need to be updated and then pip would need to vendor that version of packaging. See a recent example where I updated packaging where it was agreed it didn't follow the spec (so no discuss discussion was required): pypa/packaging#788 / pypa/packaging#794. This behavior will be vendored into the next version of pip, but no pip specific logic is updated. |
I don't care if it is you or packaging owning the bug. This is from the spec which I linked in my previous post. This is a bug.
|
As much as I would like to have similar behaviour, I am afraid you are wrong @maarre and @pfmoore and @notatallshaw are right. The chapter you quoted is irrelevant. If the package has Whether it's you, me or anyone else, it does not matter, but someone has to do it. And it's clear that So if you really want it to happen writing it is a bug does not move a needle. Doing something about it, discussing it in packaging forum might. So the ball is on your (and maybe my) side if I decide to spend my - also volunteer and unpaide by anyone - time for it. Also if you wish to get it done, and have no time for it yourself, one other viable option is to pay for someone's time. I for one take Github Sponsorship, so If you would like to support me in that - I am all for taking sponsorship to lead such an effort. Are you willing to do so? |
I'm intimately familiar with that section of the spec, thank you. "Accept" here means "consider" (as opposed to excluding them without consideration, which is what the first sentence says). Nothing in that section, though, says that pre-releases should be viewed as satisfying a condition that the ordering relationship says they don't satisfy. In fact, the spec is explicit in saying (here):
By this rule, While I understand your frustration - as I've said, I can see valid arguments for changing the spec - neither your tone nor your refusal to listen to people trying to explain to you the correct process if you want a change in this are are helping make your case. You've been given the information on how to progress this, if you want to. What you do next is up to you, but continuing to demand that someone else fix this for you will get you nowhere. |
Pip maintainers (I am not one) don't agree it's a bug, and I am telling you even if they did they couldn't do anything about it, it would require Packaging maintainers to agree it's a bug and accept a PR. I am telling you this to give you somewhere that might make progress, if you decide it's worth spending time and resources on. Remember, this is open source software built by volunteers. Neither Pip nor Packaging are maintained by some big corporation with dedicated support teams. We're all users here, contributing as we can. Pip relies on Packaging to follow the spec. It doesn't implement the spec itself. Therefore, there's nothing more to be done here. |
Description
I want to be able to test multiple prerelease versions together without having to shoehorn installations.
I really don't want to put prerelease versions in my pyproject.toml.
Current version of pip will only allow prerelease dependencies using --no-deps flag.
Expected behavior
If there is an alpha, beta or release candidate installed i want pip to accept this installation when doing the dependency evaluation. The installations should succeed without having to use --no-deps switch.
pip version
24.3.1
Python version
3.11.2
OS
Windows, Linux
How to Reproduce
1 Create a package with an alpha version.´
2 Build the first package
3 Install the first package
4 Create another package with a dependency to the first package
5 The pyproject.toml file should reference the version of the first package without the alpha specifier.
6 Build the second package
7 Install the second package
Output
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: