-
-
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
Fix missing dependencies of relevant constraints #1037
Fix missing dependencies of relevant constraints #1037
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1037 +/- ##
=========================================
+ Coverage 99.5% 99.5% +<.01%
=========================================
Files 34 34
Lines 2418 2441 +23
Branches 306 307 +1
=========================================
+ Hits 2406 2429 +23
Misses 6 6
Partials 6 6
Continue to review full report at Codecov.
|
Would appreciate a review on this PR. Let me know if there is something I can do to make this better. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @jeevb,
Thanks for your contribution. I've tried your test case with the latest pip-tools and got the expected results. Are you sure there is a bug to fix?
Thanks for following up on this @atugushev. I'm getting the following error running the test on the current master:
Same error running off of the |
@atugushev: Were you able to reproduce the issue? |
Thanks for pinging. I've looked it more deeply. It seems there's a misunderstanding on how pip-compile works with constraints file (i.e.,
This construction in
means that you want to include |
Thanks for taking the time to present a detailed explanation.
This is exactly what I am trying to achieve, but Also, with regard to the test case in this PR, can you clarify what the expected result is? |
Could you elaborate, which one exactly? |
The following are all dependencies of dependencies of
If the failure of the test in this PR is expected too, please free to close this. |
Indeed, at least |
But locally on Mac OS X I've got completely different results, see: $ cat constraints.txt
ipython==7.11.1
jedi==0.15.2
prompt-toolkit==3.0.2
$ cat requirements.in
-c constraints.txt
ipykernel
$ pip-compile
#
# This file is autogenerated by pip-compile
# To update, run:
#
# pip-compile
#
appnope==0.1.0 # via ipykernel
decorator==4.4.1 # via traitlets
ipykernel==5.1.3
ipython-genutils==0.2.0 # via traitlets
ipython==7.11.1 # via ipykernel
jupyter-client==5.3.4 # via ipykernel
jupyter-core==4.6.1 # via jupyter-client
python-dateutil==2.8.1 # via jupyter-client
pyzmq==18.1.1 # via jupyter-client
six==1.14.0 # via python-dateutil, traitlets
tornado==6.0.3 # via ipykernel, jupyter-client
traitlets==4.3.3 # via ipykernel, jupyter-client, jupyter-core Note |
Could you try to compile with
|
Yes I am able to exactly reproduce your output above after clearing my However, I am still not seeing |
I suspect that's because Without constraints: $ cat requirements.in
flask
$ pip-compile
#
# This file is autogenerated by pip-compile
# To update, run:
#
# pip-compile
#
click==7.0 # via flask
flask==1.1.1
itsdangerous==1.1.0 # via flask
jinja2==2.10.3 # via flask
markupsafe==1.1.1 # via jinja2
werkzeug==0.16.0 # via flask With $ cat constraints.txt
jinja2==2.10.3
$ cat requirements.in
-c constraints.txt
flask
$ pip-compile -r
#
# This file is autogenerated by pip-compile
# To update, run:
#
# pip-compile
#
click==7.0 # via flask
flask==1.1.1
itsdangerous==1.1.0 # via flask
jinja2==2.10.3 # via flask
werkzeug==0.16.0 # via flask Note Also, I'm inclined to think that we finally found the cause of weird bugs with the cache: cat /Users/albert/Library/Caches/pip-tools/depcache-py3.8.json | python -m json.tool
{
"__format__": 1,
"dependencies": {
"click": {
"7.0": []
},
"flask": {
"1.1.1": [
"Jinja2>=2.10.1",
"Werkzeug>=0.15",
"click>=5.1",
"itsdangerous>=0.24"
]
},
"itsdangerous": {
"1.1.0": []
},
"jinja2": {
"2.10.3": []
},
"werkzeug": {
"0.16.0": []
}
}
} |
I agree completely with this.
I think the problem is that dependencies of constraints are not resolved per here. We then cache this result, and when a requirement is no longer marked as a constraint in a later round of resolution, it continues to use this old (and wrong) cache result. |
9d36cac
to
600f437
Compare
With this PR, all dependencies are properly resolved: $ cat constraints.txt
jinja2==2.10.3
$ cat requirements.in
-c constraints.txt
flask
$ pip-compile -r
#
# This file is autogenerated by pip-compile
# To update, run:
#
# pip-compile
#
click==7.0 # via flask
flask==1.1.1
itsdangerous==1.1.0 # via flask
jinja2==2.10.3 # via flask
markupsafe==1.1.1 # via jinja2
werkzeug==0.16.0 # via flask
$ cat ~/Library/Caches/pip-tools/depcache-py3.7.json | jq .
{
"__format__": 1,
"dependencies": {
"click": {
"7.0": []
},
"flask": {
"1.1.1": [
"Jinja2>=2.10.1",
"Werkzeug>=0.15",
"click>=5.1",
"itsdangerous>=0.24"
]
},
"itsdangerous": {
"1.1.0": []
},
"jinja2": {
"2.10.3": [
"MarkupSafe>=0.23"
]
},
"markupsafe": {
"1.1.1": []
},
"werkzeug": {
"0.16.0": []
}
}
} |
ccbb0e0
to
65d8eb0
Compare
65d8eb0
to
73c0610
Compare
After digging around a little on |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome fix! 🎉 I've tried it locally — it works with my projects. I think it's worth to add a functional test to cover the main use-case or we could add it in a following up PR (both options fine by me). Also, I left one minor comment.
Happy to add the functional test in this PR. Is there an example or some documentation that I can follow? |
…nts are properly resolved
This should be ready for a final review! Looks like there are some unrelated CI errors. I wonder if these might be fixed with a build restart... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
@jeevb thanks for the awesome work! Much appreciated! 🎉 🎉 🎉 |
|
Fixes #1041
Environment:
OS: Mac OS X (10.14.6) - Darwin Kernel Version 18.7.0
pip
version: 20.0.2pip-tools
version: 4.4.0A bug exists where dependencies of relevant constraints may not be added to the output file as shown below:
constraints.txt
:requirements.in
:requirements.txt
:Expected
requirements.txt
:Changelog-friendly one-liner: Fixes bug where dependencies of relevant constraints may be missing from output file.
Contributor checklist