Skip to content

Commit 07b0a2f

Browse files
committed
Flip the switch in the new resolver
- Python 2 doesn't get the new shiny thing. - Passing --use-deprecated=legacy-resolver uses the deprecated legacy resolver. - Passing --use-feature=2020-resolver is now a no-op, that prints a warning that it's going to be removed.
1 parent 6859de0 commit 07b0a2f

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

src/pip/_internal/cli/req_command.py

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
import os
1010
from functools import partial
1111

12+
from pip._vendor.six import PY2
13+
1214
from pip._internal.cli import cmdoptions
1315
from pip._internal.cli.base_command import Command
1416
from pip._internal.cli.command_context import CommandContextMixIn
@@ -198,11 +200,26 @@ def __init__(self, *args, **kw):
198200
def determine_resolver_variant(options):
199201
# type: (Values) -> str
200202
"""Determines which resolver should be used, based on the given options."""
203+
# We didn't want to change things for Python 2, since it's nearly done with
204+
# and we're using performance improvements that only work on Python 3.
205+
if PY2:
206+
if '2020-resolver' in options.features_enabled:
207+
return "2020-resolver"
208+
else:
209+
return "legacy"
210+
211+
# Warn about the options that are gonna be removed.
201212
if '2020-resolver' in options.features_enabled:
202-
resolver_variant = "2020-resolver"
203-
else:
204-
resolver_variant = "legacy"
205-
return resolver_variant
213+
logger.warning(
214+
"--use-feature=2020-resolver no longer has any effect, "
215+
"since it is now the default dependency resolver in pip. "
216+
"This will become an error in pip 21.0."
217+
)
218+
219+
if "legacy-resolver" in options.deprecated_features_enabled:
220+
return "legacy"
221+
222+
return "2020-resolver"
206223

207224
@classmethod
208225
def make_requirement_preparer(

0 commit comments

Comments
 (0)