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

Convert exported requirements to constraints format #308

Merged
merged 20 commits into from
Mar 14, 2021

Conversation

cjolowicz
Copy link
Owner

@cjolowicz cjolowicz commented Mar 13, 2021

This PR fixes installation errors due to the use of some forms of requirements as constraints that are no longer supported with pip's new dependency resolver:

  • URL requirements
  • Path requirements
  • Requirements with extras
  • Editable requirements

Constraints are now rewritten in the form name==version[; markers], and skipped if either name or version are empty.

This PR adds a dependency on the packaging library.

Fixes #141

@cjolowicz cjolowicz added the bug Something isn't working label Mar 13, 2021
@cjolowicz cjolowicz force-pushed the fix-invalid-constraints branch 6 times, most recently from 85a2577 to 54bec74 Compare March 14, 2021 01:06
Add a failing test for URL dependencies.

Test output below:

  nox > Command python -m pip install
  --constraint=.nox/test/tmp/requirements.txt
  file:///…/url-dependency/dist/url_dependency-0.1.0-py3-none-any.whl failed
  with exit code 1:

  DEPRECATION: Constraints are only allowed to take the form of a package name
  and a version specifier. Other forms were originally permitted as an accident
  of the implementation, but were undocumented. The new implementation of the
  resolver no longer supports these forms. A possible replacement is replacing
  the constraint with a requirement.. You can find discussion regarding this at
  pypa/pip#8210.

  ERROR: Links are not allowed as constraints
@cjolowicz cjolowicz force-pushed the fix-invalid-constraints branch from 54bec74 to a06ae67 Compare March 14, 2021 01:18
@cjolowicz cjolowicz merged commit b2699b5 into main Mar 14, 2021
@cjolowicz cjolowicz deleted the fix-invalid-constraints branch March 14, 2021 01:30
This was referenced Mar 15, 2021
JSchlensok added a commit to wilhelm-lab/oktoberfest that referenced this pull request Aug 7, 2024
Since nox-poetry skips URL constraints (cjolowicz/nox-poetry#308),
DLomix could not be installed from source in a Nox session as without a
constraint, pip would fall back to PyPI. See pypa/pip#8210
and pypa/pip#8253 for further context.

Manually invoking pip in a session prevents this.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Installation from path or url cannot be constrained to a version
1 participant