Skip to content

Commit

Permalink
Merge pull request #8530 from pradyunsg/rollout-flags
Browse files Browse the repository at this point in the history
  • Loading branch information
pradyunsg authored Jul 4, 2020
2 parents 107ec29 + 49b793c commit 8db4fc8
Show file tree
Hide file tree
Showing 8 changed files with 97 additions and 65 deletions.
7 changes: 7 additions & 0 deletions src/pip/_internal/cli/base_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,13 @@ def _main(self, args):
issue=8333,
)

if 'resolver' in options.unstable_features:
logger.critical(
"--unstable-feature=resolver is no longer supported, and "
"has been replaced with --use-feature=2020-resolver instead."
)
sys.exit(ERROR)

try:
status = self.run(options, args)
assert isinstance(status, int)
Expand Down
29 changes: 27 additions & 2 deletions src/pip/_internal/cli/cmdoptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -906,8 +906,31 @@ def check_list_path_option(options):
action='append',
default=[],
choices=['resolver'],
help=SUPPRESS_HELP, # TODO: Enable this when the resolver actually works.
# help='Enable unstable feature(s) that may be backward incompatible.',
help=SUPPRESS_HELP, # TODO: drop this in pip 20.3
) # type: Callable[..., Option]

use_new_feature = partial(
Option,
'--use-feature',
dest='features_enabled',
metavar='feature',
action='append',
default=[],
choices=['2020-resolver'],
help='Enable new functionality, that may be backward incompatible.',
) # type: Callable[..., Option]

use_deprecated_feature = partial(
Option,
'--use-deprecated',
dest='deprecated_features_enabled',
metavar='feature',
action='append',
default=[],
choices=[],
help=(
'Enable deprecated functionality, that will be removed in the future.'
),
) # type: Callable[..., Option]


Expand Down Expand Up @@ -939,6 +962,8 @@ def check_list_path_option(options):
no_color,
no_python_version_warning,
unstable_feature,
use_new_feature,
use_deprecated_feature,
]
} # type: Dict[str, Any]

Expand Down
2 changes: 1 addition & 1 deletion src/pip/_internal/cli/req_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ def make_resolver(
# The long import name and duplicated invocation is needed to convince
# Mypy into correctly typechecking. Otherwise it would complain the
# "Resolver" class being redefined.
if 'resolver' in options.unstable_features:
if '2020-resolver' in options.features_enabled:
import pip._internal.resolution.resolvelib.resolver
return pip._internal.resolution.resolvelib.resolver.Resolver(
preparer=preparer,
Expand Down
4 changes: 2 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ def use_new_resolver(request):
"""
new_resolver = request.config.getoption("--new-resolver")
if new_resolver:
os.environ["PIP_UNSTABLE_FEATURE"] = "resolver"
os.environ["PIP_USE_FEATURE"] = "2020-resolver"
else:
os.environ.pop("PIP_UNSTABLE_FEATURE", None)
os.environ.pop("PIP_USE_FEATURE", None)
yield new_resolver


Expand Down
2 changes: 1 addition & 1 deletion tests/functional/test_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ def test_vcs_url_urlquote_normalization(script, tmpdir):
)


@pytest.mark.parametrize("resolver", ["", "--unstable-feature=resolver"])
@pytest.mark.parametrize("resolver", ["", "--use-feature=2020-resolver"])
def test_basic_install_from_local_directory(script, data, resolver):
"""
Test installing from a local directory.
Expand Down
Loading

0 comments on commit 8db4fc8

Please sign in to comment.