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

Fixes checking constraint throws deprecation messages. #5309

Merged
merged 3 commits into from
Aug 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions news/5309.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix #5273, use our own method for checking if a package is a valid constraint.
15 changes: 8 additions & 7 deletions pipenv/utils/dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@

from pipenv.patched.pip._vendor.packaging.markers import Marker
from pipenv.patched.pip._vendor.packaging.version import parse
from pipenv.vendor.requirementslib.models.requirements import Requirement
from pipenv.vendor.requirementslib.models.requirements import (
InstallRequirement,
Requirement,
)

from .constants import SCHEME_LIST, VCS_LIST
from .shell import temp_path
Expand Down Expand Up @@ -270,16 +273,14 @@ def convert_deps_to_pip(

def get_constraints_from_deps(deps):
"""Get contraints from Pipfile-formatted dependency"""
from pipenv.patched.pip._internal.req.req_install import (
check_invalid_constraint_type,
)
from pipenv.vendor.requirementslib.models.requirements import Requirement

def is_constraints(dep: InstallRequirement) -> bool:
return dep.name and not dep.editable and not dep.extras

constraints = []
for dep_name, dep in deps.items():
new_dep = Requirement.from_pipfile(dep_name, dep)
problem = check_invalid_constraint_type(new_dep.as_ireq())
if not problem:
if is_constraints(new_dep.as_ireq()):
c = new_dep.as_line().strip()
constraints.append(c)
return constraints
Expand Down