Skip to content

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

@jhines-ocient

Description

@jhines-ocient

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething is not workingresolverRelated to dependency resolver

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions