-
-
Notifications
You must be signed in to change notification settings - Fork 611
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
Pip-compile upgrades a package even it doesn't exist in a requrements.* #759
Comments
It's not clear if |
Hello @pawciobiel,
What's the difference between those commands? Why they should have different behavior? |
IMO it would be best for this to skip non-existing packages with a warning, rather than an error. That way I could safely loop through different FWIW, I'm using these Zsh functions to wrap # recompile *requirements.txt with upgraded versions of all or specified packages (upgrade)
pipu () { # [req...]
local reqs=($@)
for reqsin in *requirements.in(N); do
print -rP "%F{cyan}> upgrading ${reqsin:r}.txt <- $reqsin . . .%f"
if [[ $# -gt 0 ]]; then
pip-compile --no-header ${${@/*/-P}:^reqs} $reqsin 2>&1 | hpype
pipc $reqsin # can remove if https://github.com/jazzband/pip-tools/issues/759 gets fixed
else
pip-compile --no-header -U $reqsin 2>&1 | hpype
fi
done
}
# upgrade with hashes
pipuh () { # [req...]
local reqs=($@)
for reqsin in *requirements.in(N); do
print -rP "%F{cyan}> upgrading ${reqsin:r}.txt <- $reqsin . . .%f"
if [[ $# -gt 0 ]]; then
pip-compile --no-header --generate-hashes ${${@/*/-P}:^reqs} $reqsin 2>&1 | hpype
pipch $reqsin # can remove if https://github.com/jazzband/pip-tools/issues/759 gets fixed
else
pip-compile --no-header -U --generate-hashes $reqsin 2>&1 | hpype
fi
done
} |
@AndydeCleyre, probably, warning+skip is better than an error indeed. Thanks for the suggestion! |
I second the need for not raising error. And in my case (#950), I wouldn't want even warning. Maybe |
@atugushev I've implemented a very small change that seems to do "the right thing," with a simple test. I don't know that there's a strong case for errors or warnings in this case, so there are none raised in my PR. You mentioned in your WIP PR that there was a complication with "upgrading subdependencies" -- can you elaborate with an example to demonstrate the expectation? |
There were a few edge cases with sub-deps. Some of them, probably, wouldn't relevant if we don't want to raise a error/warning. I'll elaborate on these cases in your PR. |
FTR, I've updated the "Expected result" in the issue description, since both variants fine by me. |
…exclude -P args not already pinned or primarily required; fixes jazzband#759
…exclude -P args not already pinned or primarily required; fixes jazzband#759 Co-Authored-By: Albert Tugushev <albert@tugushev.ru> use long option style --upgrade-package in test exact line-matching in expected output more readable if/else instead of ternary
Pip-compile should raise an error while trying to upgrade a package which doesn't exist in a requirements.in.
Environment Versions
Steps to replicate
Expected result
Raise a error/warning or skip non-existing package.
Actual result
The text was updated successfully, but these errors were encountered: