Skip to content

Commit 8db4fc8

Browse files
authored
Merge pull request #8530 from pradyunsg/rollout-flags
2 parents 107ec29 + 49b793c commit 8db4fc8

File tree

8 files changed

+97
-65
lines changed

8 files changed

+97
-65
lines changed

src/pip/_internal/cli/base_command.py

+7
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,13 @@ def _main(self, args):
204204
issue=8333,
205205
)
206206

207+
if 'resolver' in options.unstable_features:
208+
logger.critical(
209+
"--unstable-feature=resolver is no longer supported, and "
210+
"has been replaced with --use-feature=2020-resolver instead."
211+
)
212+
sys.exit(ERROR)
213+
207214
try:
208215
status = self.run(options, args)
209216
assert isinstance(status, int)

src/pip/_internal/cli/cmdoptions.py

+27-2
Original file line numberDiff line numberDiff line change
@@ -906,8 +906,31 @@ def check_list_path_option(options):
906906
action='append',
907907
default=[],
908908
choices=['resolver'],
909-
help=SUPPRESS_HELP, # TODO: Enable this when the resolver actually works.
910-
# help='Enable unstable feature(s) that may be backward incompatible.',
909+
help=SUPPRESS_HELP, # TODO: drop this in pip 20.3
910+
) # type: Callable[..., Option]
911+
912+
use_new_feature = partial(
913+
Option,
914+
'--use-feature',
915+
dest='features_enabled',
916+
metavar='feature',
917+
action='append',
918+
default=[],
919+
choices=['2020-resolver'],
920+
help='Enable new functionality, that may be backward incompatible.',
921+
) # type: Callable[..., Option]
922+
923+
use_deprecated_feature = partial(
924+
Option,
925+
'--use-deprecated',
926+
dest='deprecated_features_enabled',
927+
metavar='feature',
928+
action='append',
929+
default=[],
930+
choices=[],
931+
help=(
932+
'Enable deprecated functionality, that will be removed in the future.'
933+
),
911934
) # type: Callable[..., Option]
912935

913936

@@ -939,6 +962,8 @@ def check_list_path_option(options):
939962
no_color,
940963
no_python_version_warning,
941964
unstable_feature,
965+
use_new_feature,
966+
use_deprecated_feature,
942967
]
943968
} # type: Dict[str, Any]
944969

src/pip/_internal/cli/req_command.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ def make_resolver(
259259
# The long import name and duplicated invocation is needed to convince
260260
# Mypy into correctly typechecking. Otherwise it would complain the
261261
# "Resolver" class being redefined.
262-
if 'resolver' in options.unstable_features:
262+
if '2020-resolver' in options.features_enabled:
263263
import pip._internal.resolution.resolvelib.resolver
264264
return pip._internal.resolution.resolvelib.resolver.Resolver(
265265
preparer=preparer,

tests/conftest.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,9 @@ def use_new_resolver(request):
105105
"""
106106
new_resolver = request.config.getoption("--new-resolver")
107107
if new_resolver:
108-
os.environ["PIP_UNSTABLE_FEATURE"] = "resolver"
108+
os.environ["PIP_USE_FEATURE"] = "2020-resolver"
109109
else:
110-
os.environ.pop("PIP_UNSTABLE_FEATURE", None)
110+
os.environ.pop("PIP_USE_FEATURE", None)
111111
yield new_resolver
112112

113113

tests/functional/test_install.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ def test_vcs_url_urlquote_normalization(script, tmpdir):
405405
)
406406

407407

408-
@pytest.mark.parametrize("resolver", ["", "--unstable-feature=resolver"])
408+
@pytest.mark.parametrize("resolver", ["", "--use-feature=2020-resolver"])
409409
def test_basic_install_from_local_directory(script, data, resolver):
410410
"""
411411
Test installing from a local directory.

0 commit comments

Comments
 (0)