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

Using --autoresolve with -P and packages with version ranges fails confusingly #393

Closed
PeterJCLaw opened this issue May 3, 2023 · 0 comments · Fixed by #394
Closed

Using --autoresolve with -P and packages with version ranges fails confusingly #393

PeterJCLaw opened this issue May 3, 2023 · 0 comments · Fixed by #394

Comments

@PeterJCLaw
Copy link
Contributor

It seems that passing a package range to -P when also using --autoresolve and more than one layer of requirements causes pip-compile-multi to get confused about where some of the version pins are coming from.

This is reproducible with:

requirements/prod.in:

markupsafe

requirements/prod.txt:

# SHA1:2f781f20c9698050fd9afac72c0364db5deacb05
#
# This file is autogenerated by pip-compile-multi
# To update, run:
#
#    pip-compile-multi
#
markupsafe==2.0.1
    # via
    #   -c requirements/tests.txt
    #   -r requirements/prod.in

requirements/tests.in:

-r prod.in

requirements/tests.txt:

# SHA1:939d3916ae2e78296c77d899249472d04707c772
#
# This file is autogenerated by pip-compile-multi
# To update, run:
#
#    pip-compile-multi
#
-r prod.txt

then:

$ pip-compile-multi --autoresolve -P 'markupsafe<2.1.2'
Creating a temporary file with all dependencies at requirements/tests.txt
Locking requirements/prod.in to requirements/prod.txt. References: []
Locking requirements/tests.in to requirements/tests.txt. References: ['requirements/prod.in']
Package markupsafe was resolved to different versions in different environments: 2.1.1 and 2.0.1
Traceback (most recent call last):
  File "/tmp/venv/lib/python3.10/site-packages/pipcompilemulti/cli_v1.py", line 26, in cli
    recompile()
  File "/tmp/venv/lib/python3.10/site-packages/pipcompilemulti/actions.py", line 31, in recompile
    compile_topologically(env_confs, deduplicator)
  File "/tmp/venv/lib/python3.10/site-packages/pipcompilemulti/actions.py", line 38, in compile_topologically
    if env.maybe_create_lockfile():
  File "/tmp/venv/lib/python3.10/site-packages/pipcompilemulti/environment.py", line 51, in maybe_create_lockfile
    self.create_lockfile()
  File "/tmp/venv/lib/python3.10/site-packages/pipcompilemulti/environment.py", line 72, in create_lockfile
    self.fix_lockfile()
  File "/tmp/venv/lib/python3.10/site-packages/pipcompilemulti/environment.py", line 134, in fix_lockfile
    sections = [
  File "/tmp/venv/lib/python3.10/site-packages/pipcompilemulti/environment.py", line 135, in <listcomp>
    self.fix_pin(section)
  File "/tmp/venv/lib/python3.10/site-packages/pipcompilemulti/environment.py", line 211, in fix_pin
    raise RuntimeError(
RuntimeError: Please add constraints for the package version listed above
PeterJCLaw added a commit to PeterJCLaw/pip-compile-multi that referenced this issue May 4, 2023
The issue reported in peterdemin#393
turns out to have also been fixed by the range handling fix in the
previous commit. This adds a test which verifies that.

Fixes peterdemin#393
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant