Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: pypa/pip
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 70731ea02e416852e835951adea61258a7cdaa97
Choose a base ref
..
head repository: pypa/pip
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 16ea298ecac444fc10bb2d2f478a80014bed5c3d
Choose a head ref
3 changes: 2 additions & 1 deletion docs/html/index.rst
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@ Please take a look at our documentation for how to install and use pip:
ux_research_design
news

In 2020, we're working on improvements to the heart of pip. Please `learn more and take our survey`_ to help us do it right.
In 2020, we're working on improvements to the heart of pip: :ref:`Resolver changes 2020`. Please `learn more and take our survey`_ to help us do it right, and `join our user experience surveys pool`_.

If you find bugs, need help, or want to talk to the developers, please use our mailing lists or chat rooms:

@@ -40,6 +40,7 @@ rooms, and mailing lists is expected to follow the `PSF Code of Conduct`_.

.. _package installer: https://packaging.python.org/guides/tool-recommendations/
.. _Python Package Index: https://pypi.org
.. _join our user experience surveys pool: ux_research_design
.. _learn more and take our survey: https://pyfound.blogspot.com/2020/03/new-pip-resolver-to-roll-out-this-year.html
.. _Installation: https://pip.pypa.io/en/stable/installing.html
.. _Documentation: https://pip.pypa.io/en/stable/
2 changes: 2 additions & 0 deletions news/8924.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
New resolver: Tweak resolution logic to improve user experience when
user-supplied requirements conflict.
Empty file.
Original file line number Diff line number Diff line change
@@ -117,6 +117,6 @@ def __bool__(self):
# type: () -> bool
if self._prefers_installed and self._installed:
return True
return any(1 for _ in self)
return any(self)

__nonzero__ = __bool__ # XXX: Python 2.
7 changes: 4 additions & 3 deletions src/pip/_internal/resolution/resolvelib/provider.py
Original file line number Diff line number Diff line change
@@ -43,7 +43,7 @@ def __init__(
self._constraints = constraints
self._ignore_dependencies = ignore_dependencies
self._upgrade_strategy = upgrade_strategy
self.user_requested = user_requested
self._user_requested = user_requested

def identify(self, dependency):
# type: (Union[Requirement, Candidate]) -> str
@@ -56,7 +56,8 @@ def get_preference(
information # type: Sequence[Tuple[Requirement, Candidate]]
):
# type: (...) -> Any
return bool(candidates)
transitive = all(parent is not None for _, parent in information)
return (transitive, bool(candidates))

def find_matches(self, requirements):
# type: (Sequence[Requirement]) -> Iterable[Candidate]
@@ -79,7 +80,7 @@ def _eligible_for_upgrade(name):
if self._upgrade_strategy == "eager":
return True
elif self._upgrade_strategy == "only-if-needed":
return (name in self.user_requested)
return (name in self._user_requested)
return False

return self._factory.find_candidates(
2 changes: 1 addition & 1 deletion tools/requirements/tests.txt
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@ enum34; python_version < '3.4'
freezegun
mock
pretend
pytest<6.1.0 # Until https://github.com/pytest-dev/pytest-rerunfailures/issues/128 is fixed
pytest
pytest-cov
pytest-rerunfailures
pytest-timeout