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

pip-compile drops annotations when using --resolver=backtracking #1853

Closed
jhines-ocient opened this issue Apr 26, 2023 · 4 comments · Fixed by #1890
Closed

pip-compile drops annotations when using --resolver=backtracking #1853

jhines-ocient opened this issue Apr 26, 2023 · 4 comments · Fixed by #1890
Labels
bug Something is not working resolver Related to dependency resolver

Comments

@jhines-ocient
Copy link

Summary

pip-compile drops annotations when using --resolver=backtracking. Source requirements.in files are missing under the relevant via section. Which source file is missing is dependent on the order of the arguments.

Running the below tests with more files, it appears that only the first and last files are included in the annotations.

Environment Versions

  1. OS Type: Linux 4.15.0-182-generic Ubuntu x86_64 GNU/Linux
  2. Python version: $ python -V: Python 3.8.16
  3. pip version: $ pip --version: pip 22.0.3 from python 3.8
  4. pip-tools version: $ pip-compile --version: pip-compile, version 6.10.0

Steps to replicate

  1. Create 3 requirements.in files with the same single requirement (a.in, b.in, and c.in). I used requests.
$ cat a.in
requests
$ cat b.in
requests
$ cat c.in
requests
  1. Run pip-compile --resolver=legacy --output-file=legacy-requirements.txt a.in b.in c.in to generate the expected result
  2. Run pip-compile --resolver=backtracking --output-file=backtracking-requirements.txt a.in b.in c.in to generate the first actual result
  3. Run pip-compile --resolver=backtracking --output-file=backtracking-reorder-requirements.txt a.in c.in b.in to generate the second actual result

Expected result

Generated by Step 2, specifically the via section of requests. I expect that the annotations section would always contain every source for the relevant requirement.

#
# This file is autogenerated by pip-compile with python 3.8
# To update, run:
#
#    pip-compile --output-file=legacy-requirements.txt a.in b.in c.in
#
certifi==2022.12.7
    # via requests
charset-normalizer==3.1.0
    # via requests
idna==3.4
    # via requests
requests==2.28.2
    # via
    #   -r a.in
    #   -r b.in
    #   -r c.in
urllib3==1.26.15
    # via requests

First Actual result

Generated by Step 3, note b.in is missing from the via section of requests

#
# This file is autogenerated by pip-compile with python 3.8
# To update, run:
#
#    pip-compile --output-file=backtracking-requirements.txt --resolver=backtracking a.in b.in c.in
#
certifi==2022.12.7
    # via requests
charset-normalizer==3.1.0
    # via requests
idna==3.4
    # via requests
requests==2.28.2
    # via
    #   -r a.in
    #   -r c.in
urllib3==1.26.15
    # via requests

Second Actual Result

Generated by Step 4, note now c.in is missing from the via section of requests

#
# This file is autogenerated by pip-compile with python 3.8
# To update, run:
#
#    pip-compile --output-file=backtracking-reorder-requirements.txt --resolver=backtracking a.in b.in c.in
#
certifi==2022.12.7
    # via requests
charset-normalizer==3.1.0
    # via requests
idna==3.4
    # via requests
requests==2.29.0
    # via
    #   -r a.in
    #   -r b.in
urllib3==1.26.15
    # via requests
@atugushev atugushev added bug Something is not working resolver Related to dependency resolver labels Apr 26, 2023
@AndydeCleyre
Copy link
Contributor

Thanks!

Reproduced also with the latest versions of Python, pip-tools, and pip.

@lpulley
Copy link
Contributor

lpulley commented Jun 13, 2023

Has the cause of this been determined? I've seen many a malformed lockfile entry due to this, and it seems like something that wouldn't require much new code, but I'm not familiar enough with this project to say for certain. I could be entirely misjudging it.

In any case, this seems like it should affect lots of users, so I'm surprised to see so little conversation here. If this becomes enough of a problem, I might try to learn how all this works and try to fix it myself, but I'm hopeful that someone is already working on this quietly?

@atugushev
Copy link
Member

@lpulley AFAIK, nobody's working on this. Feel free to pick this up if you'd like.

@lpulley
Copy link
Contributor

lpulley commented Jun 26, 2023

Figured this out and put up #1890.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is not working resolver Related to dependency resolver
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants