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

Prompt user to use the backtracking resolver on errors #1719

Merged
merged 10 commits into from
Nov 10, 2022
10 changes: 9 additions & 1 deletion piptools/scripts/compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

from .._compat import IS_CLICK_VER_8_PLUS, parse_requirements
from ..cache import DependencyCache
from ..exceptions import PipToolsError
from ..exceptions import NoCandidateFound, PipToolsError
from ..locations import CACHE_DIR
from ..logging import log
from ..repositories import LocalRequirementsRepository, PyPIRepository
Expand Down Expand Up @@ -545,6 +545,14 @@ def cli(
)
results = resolver.resolve(max_rounds=max_rounds)
hashes = resolver.resolve_hashes(results) if generate_hashes else None
except NoCandidateFound as e:
if resolver_cls == LegacyResolver:
maxfenv marked this conversation as resolved.
Show resolved Hide resolved
log.error(
"Using legacy resolver. Consider using backtracking resolver with --resolver=backtracking"
maxfenv marked this conversation as resolved.
Show resolved Hide resolved
)

log.error(str(e))
sys.exit(2)
except PipToolsError as e:
log.error(str(e))
sys.exit(2)
Expand Down