You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
pip-compile generates inconsistent via comments when using backtracking resolver on constrained requirements.
When a constrained <constrained_requirements_file>.txt file is not yet generated, -c <requirements_file.txt> references are correctly added to via comments, but they are removed when re-compiling the requirements when the constrained <constrained_requirements_file>.txt file already exists.
This seems to apply only to the backtracking resolver, since I wasn't able to reproduce the issue using the legacy resolver.
Environment Versions
OS Type: Linux (x86_64)
Python version: 3.10.8
pip version: 22.3
pip-tools version: 6.9.0 (also tried on master branch, at commit 1fb2e69)
Create a requirements.in file with the following content:
starlette==0.21.0
Create a requirements-dev.in file with the following content:
-crequirements.txthttpx==0.22.0
Run pip-compile --resolver=backtracking requirements.in
Run pip-compile --resolver=backtracking requirements-dev.in
Run pip-compile --resolver=backtracking requirements-dev.in again
Expected result
pip-compile writes the following requirements-dev.txt for both runs of pip-compile --resolver=backtracking requirements-dev.in:
## This file is autogenerated by pip-compile with python 3.10# To update, run:## pip-compile --resolver=backtracking requirements-dev.in#anyio==3.6.2# via# -c requirements.txt# httpcorecertifi==2022.9.24# via# httpcore# httpxcharset-normalizer==3.0.0# via httpxh11==0.12.0# via httpcorehttpcore==0.14.7# via httpxhttpx==0.22.0# via -r requirements-dev.inidna==3.4# via# -c requirements.txt# anyio# rfc3986rfc3986[idna2008]==1.5.0# via httpxsniffio==1.3.0# via# -c requirements.txt# anyio# httpcore# httpx
Actual result
The first time pip-compile --resolver=backtracking requirements-dev.in is run (where requirements-dev.txt doesn't yet exist), the correct requirements-dev.txt is generated:
## This file is autogenerated by pip-compile with python 3.10# To update, run:## pip-compile --resolver=backtracking requirements-dev.in#anyio==3.6.2# via# -c requirements.txt# httpcorecertifi==2022.9.24# via# httpcore# httpxcharset-normalizer==3.0.0# via httpxh11==0.12.0# via httpcorehttpcore==0.14.7# via httpxhttpx==0.22.0# via -r requirements-dev.inidna==3.4# via# -c requirements.txt# anyio# rfc3986rfc3986[idna2008]==1.5.0# via httpxsniffio==1.3.0# via# -c requirements.txt# anyio# httpcore# httpx
The second time pip-compile --resolver=backtracking requirements-dev.in is run (where requirements-dev.txt exists), the following diff is applied:
pip-compile
generates inconsistentvia
comments when using backtracking resolver on constrained requirements.When a constrained
<constrained_requirements_file>.txt
file is not yet generated,-c <requirements_file.txt>
references are correctly added tovia
comments, but they are removed when re-compiling the requirements when the constrained<constrained_requirements_file>.txt
file already exists.This seems to apply only to the backtracking resolver, since I wasn't able to reproduce the issue using the legacy resolver.
Environment Versions
master
branch, at commit 1fb2e69)Steps to replicate
I've created a reproduction repository (https://github.com/mkniewallner/pip-compile-inconsistent-via-backtracking-resolver) with a README and commits history that highlight the issue, but basically:
requirements.in
file with the following content:requirements-dev.in
file with the following content:pip-compile --resolver=backtracking requirements.in
pip-compile --resolver=backtracking requirements-dev.in
pip-compile --resolver=backtracking requirements-dev.in
againExpected result
pip-compile
writes the followingrequirements-dev.txt
for both runs ofpip-compile --resolver=backtracking requirements-dev.in
:Actual result
The first time
pip-compile --resolver=backtracking requirements-dev.in
is run (whererequirements-dev.txt
doesn't yet exist), the correctrequirements-dev.txt
is generated:The second time
pip-compile --resolver=backtracking requirements-dev.in
is run (whererequirements-dev.txt
exists), the following diff is applied:The text was updated successfully, but these errors were encountered: