Skip to content

Max Backtracking Option and print out current failure casues #10417

@notatallshaw

Description

@notatallshaw

What's the problem this feature will solve?
When a user has a complex requirements set it's possible that the backtracking can take hours / days / years to find a solution.

In a large requirements list it can be unclear why pip is backtracking as the conflict may exist many layers deep that the user does not know about.

Adding a max backtracking option attempts to solve 2 use cases:

  1. When a user is debugging they can set max backtracking to 0 and be able to manually inspect the failure causes and improve their requirements
  2. When a user is paying for CPU time, e.g. in a cloud environment, they may prefer pip to fail early in backtracking rather than run for hours. In this case they could set say a "reasonable" max backtracking such as 100 or 1000

Describe the solution you'd like

  1. Add a maximum backtrack count to pip CLI and pass to the Resolution object
  2. Add a self._backtrack_count to Resolution object
  3. When backtracking increment self._backtrack_count and check if exceeds the maximum backtrack count
  4. If it exceeds the maximum backtrack count log an error message that this happened and raise raise ResolutionImpossible(causes) so the user can inspect the current error was causing the backtracking

Additional context

This requires adding to the pip CLI, updating resolvelib, adding many test cases, and updating the documentation. I currently don't have a strong enough understanding of pip's code base to implement all of this. But if no one else works on this I will try and eventually submit the relevant PRs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions