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

Support --constraints #315

Closed
Julian opened this issue Nov 10, 2016 · 4 comments · Fixed by #788
Closed

Support --constraints #315

Julian opened this issue Nov 10, 2016 · 4 comments · Fixed by #788
Assignees

Comments

@Julian
Copy link

Julian commented Nov 10, 2016

pex barfs on pip --constraints.

pex runtests: commands[0] | /Users/Julian/Development/Thing/.tox/pex/bin/pex --no-wheel --requirement /Users/Julian/Development/Thing/requirements.txt /Users/Julian/Development/Thing[server] --entry-point twisted:twist --output-file /Users/Julian/Development/Thing/dist/thing
Traceback (most recent call last):
  File "/Users/Julian/Development/Thing/.tox/pex/bin/pex", line 11, in <module>
    sys.exit(main())
  File "/Users/Julian/Development/Thing/.tox/pex/site-packages/pex/bin/pex.py", line 540, in main
    pex_builder = build_pex(reqs, options, resolver_options_builder)
  File "/Users/Julian/Development/Thing/.tox/pex/site-packages/pex/bin/pex.py", line 478, in build_pex
    resolvables.extend(requirements_from_file(requirements_txt, resolver_option_builder))
  File "/Users/Julian/Development/Thing/.tox/pex/site-packages/pex/requirements.py", line 94, in requirements_from_file
    return requirements_from_lines(fp.readlines(), builder=builder, relpath=relpath)
  File "/Users/Julian/Development/Thing/.tox/pex/site-packages/pex/requirements.py", line 78, in requirements_from_lines
    raise UnsupportedLine('Could not resolve line: %s (%s)' % (resolvable, e))
UnsupportedLine: Could not resolve line: --constraint https://example/constraints.txt (Unknown requirement type: --constraint https://example.com/constraints.txt)
@bloomonkey
Copy link

This does seem to have been looked at in a recent PR (#335), but I believe that it is not yet correctly implemented.

--constraints in pip constrains the versions of libraries if, and only if, they are required by the package or one of its dependencies. An example would probably help here; given a file:

# constraints.txt
requests==2.0.0
dontyouwantmebaby==0.0.0

pip will find and install (or just download in this example) only requests==2.0.0:

$ pip download --constraint constraints.txt requests
Collecting requests==2.0.0 (from -c constraints.txt (line 1))
  File was already downloaded /Users/john.harrison/code/pex/requests-2.0.0-py2.py3-none-any.whl
Successfully downloaded requests

whereas pex attempts to satisfy a non-requirement:

$ ./dist/pex27 --constraints constraints.txt requests
Could not satisfy all requirements for dontyouwantmebaby==0.0.0:
    dontyouwantmebaby==0.0.0

@kwlzn
Copy link
Contributor

kwlzn commented Apr 7, 2017

@bloomonkey thanks for the report. you're right this isn't working as intended - marking as a bug.

@kwlzn kwlzn added the bug label Apr 7, 2017
@bloomonkey
Copy link

Thanks. I'll make a PR if I can figure out how to make it work correctly within the dependency resolution stuffs. In case it helps anyone else, my workaround for the time being is:

mkdir deps
pip download -d ./deps -r requirements.txt -c constraints.txt
pex --no-pypi -f ./deps -r requirements.txt {args}

@kwlzn
Copy link
Contributor

kwlzn commented Apr 7, 2017

cc @toumorokoshi based on his work in #335

it's unclear if this is a regression or a longer-standing bug.

@jsirois jsirois self-assigned this Nov 14, 2019
jsirois added a commit that referenced this issue Nov 14, 2019
This changes Pex to vendor pip and defer all resolution and building to it.

As part of this change some ambiguous and / or broken features were changed and APIs adjusted:
+ The egg distribution format is no longer supported.
+ The deprecated `--interpreter-cache-dir` CLI option was removed.
+ The `--cache-ttl` CLI option and `cache_ttl` resolver API argument were removed.
+ The resolver API replaced `fetchers` with a list of `indexes` and a list of `find_links` repos.
+ The resolver API removed (http) `context` which is now automatically handled.
+ The resolver API removed `precedence` which is now pip default precedence - wheels when available and not ruled out via the `--no-wheel` CLI option or `use_wheel=False` API argument.
+ The `--platform` CLI option and `platform` resolver API argument now must be full platform strings that include platform, implementation, version and abi; e.g.: `--platform=macosx-10.13-x86_64-cp-36-m`.
+ The `--manylinux` CLI option and `use_manylinux` resolver API argument were removed. Instead, to resolve manylinux wheels for a foreign platform, specify the manylinux platform to use with an explicit `--platform` CLI flag or `platform` resolver API argument; e.g.: `--platform=manylinux2010-x86_64-cp-36-m`.

Fixes #781

Additionally:
Fixes #771
Fixes #763
Fixes #761
Fixes #735 
Fixes #694 
Fixes #660
Fixes #658 
Fixes #642
Fixes #641
Fixes #628
Fixes #620
Fixes #614
Fixes #611
Fixes #608
Fixes #439
Fixes #415
Fixes #387
Fixes #315
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants