Skip to content

Commit

Permalink
Deprecate pip-compile --resolver=legacy (#1724)
Browse files Browse the repository at this point in the history
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Sorin Sbarnea <sorin.sbarnea@gmail.com>
Resolves #1659
  • Loading branch information
atugushev committed Nov 13, 2022
1 parent 56d5f62 commit b776317
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.rst
Expand Up @@ -571,6 +571,8 @@ This section lists ``pip-tools`` features that are currently deprecated.
default. Use ``--no-allow-unsafe`` to keep the old behavior. It is
recommended to pass the ``--allow-unsafe`` now to adapt to the upcoming
change.
- Legacy resolver is deprecated and will be removed in future versions.
Use ``--resolver=backtracking`` instead.

A Note on Resolvers
===================
Expand Down
7 changes: 7 additions & 0 deletions piptools/scripts/compile.py
Expand Up @@ -378,6 +378,13 @@ def cli(
if isinstance(output_file, LazyFile): # pragma: no cover
ctx.call_on_close(safecall(output_file.close_intelligently))

if resolver_name == "legacy":
log.warning(
"WARNING: using legacy resolver is deprecated and will be removed in "
"future versions. The default resolver will be change to 'backtracking' "
"in 7.0.0 version. Specify --resolver=backtracking to silence this warning."
)

###
# Setup
###
Expand Down
14 changes: 14 additions & 0 deletions tests/test_cli_compile.py
Expand Up @@ -2546,3 +2546,17 @@ def test_failure_of_legacy_resolver_prompts_for_backtracking(
assert out.exit_code == 0, out
else: # pragma: no cover
raise AssertionError("unreachable")


def test_print_deprecation_warning_if_using_legacy_resolver(runner, current_resolver):
with open("requirements.in", "w"):
pass

out = runner.invoke(cli)
assert out.exit_code == 0, out

expected_warning = "WARNING: using legacy resolver is deprecated"
if current_resolver == "legacy":
assert expected_warning in out.stderr
else:
assert expected_warning not in out.stderr

0 comments on commit b776317

Please sign in to comment.