1
1
Fork 0
mirror of https://github.com/pypa/pip synced 2023-12-13 21:30:23 +01:00
Commit graph

260 commits

Author SHA1 Message Date
Pradyun Gedam 7165ab8cb9
Revert "Skip candidate not providing valid metadata" 2020-12-15 10:17:20 +00:00
Tzu-ping Chung d869e0cbfd Merge master 2020-12-12 18:49:14 +08:00
Tzu-ping Chung b2c04877fa Add comments explaining InstallationError handling 2020-12-12 18:47:37 +08:00
Pradyun Gedam 0aee48ff1f
Merge pull request #9265 from uranusjr/new-resolver-cache-installed-candidates
Cache AlreadyInstalledCandidate
2020-12-11 21:03:56 +00:00
Tzu-ping Chung 120105d3e8 Cache AlreadyInstalledCandidate
Since the "Requirement already satisfied" message is printed during
candidate preparation, instantiating the candidate multiple times result
in excessive logging during intensive backtracking. By caching the
already-installed candidates, each package is only prepared, and thus
only logged once.
2020-12-12 02:39:54 +08:00
Tzu-ping Chung d45541c8f3 Skip candidate not providing valid metadata
This is done by catching InstallationError from the underlying
distribution preparation logic. There are three cases to catch:

1. Candidates from indexes. These are simply ignored since we can
   potentially satisfy the requirement with other candidates.
2. Candidates from URLs with a dist name (PEP 508 or #egg=). A new
   UnsatisfiableRequirement class is introduced to represent this; it is
   like an ExplicitRequirement without an underlying candidate. As the
   name suggests, an instance of this can never be satisfied, and will
   cause eventual backtracking.
3. Candidates from URLs without a dist name. This is only possible for
   top-level user requirements, and no recourse is possible for them. So
   we error out eagerly.

The InstallationError raised during distribution preparation is cached
in the factory, like successfully prepared candidates, since we don't
want to repeatedly try to build a candidate if we already know it'd
fail. Plus pip's preparation logic also does not allow packages to be
built multiple times anyway.
2020-12-12 02:23:32 +08:00
Tzu-ping Chung 8bf159f4c7 Intentionally delay resolving setuptools 2020-12-09 12:04:37 +08:00
Tzu-ping Chung e2fb3e12ab Use the project name to look up constraints
User-specified constraints only contain the project name without extras,
but a constraint a project A would also apply to A's extra variants.
This introduces a new project_name property on Requirement and Candidate
classes for this lookup.
2020-12-08 16:32:24 +08:00
Tzu-ping Chung ffb3d1bc76 Correctly implement yanking logic
Do not return yanked versions from an index, unless the version
range can only be satisfied by yanked candidates.
2020-12-04 23:46:25 +08:00
Tzu-ping Chung 82fe333c09 Also prefer requirements with non-empty specifiers 2020-12-03 20:06:28 +08:00
Tzu-ping Chung 4ad924a66f Resolve direct and pinned requirements first 2020-12-03 17:44:23 +08:00
Pradyun Gedam 1133342f30
Always reinstall editables
Signed-off-by: Pradyun Gedam <pradyunsg@users.noreply.github.com>
2020-11-28 13:56:40 +00:00
Pradyun Gedam 9f4c5409d0
🎨 Breakup and move comment
Signed-off-by: Pradyun Gedam <pradyunsg@users.noreply.github.com>
2020-11-28 13:54:39 +00:00
Pradyun Gedam b2785d8ab9
Drop incorrect line from comment
This was a copy-paste error that I didn't catch earlier.

Signed-off-by: Pradyun Gedam <pradyunsg@users.noreply.github.com>
2020-11-25 14:13:08 +00:00
Pradyun Gedam 5753884715
Don't deprecate reinstalling from .zip files
Signed-off-by: Pradyun Gedam <pradyunsg@users.noreply.github.com>
2020-11-25 14:13:08 +00:00
Pradyun Gedam 9add1c1f61
Add deprecation warning when reinstalling sdists
Signed-off-by: Pradyun Gedam <pradyunsg@users.noreply.github.com>
2020-11-25 14:13:08 +00:00
Pradyun Gedam d6e3643fd9
Print a message and don't reinstall wheels
Also, adds a test for source distributions being reinstalled.

Signed-off-by: Pradyun Gedam <pradyunsg@users.noreply.github.com>
2020-11-25 14:13:04 +00:00
Pradyun Gedam ce46a5e36d
Re-install local candidates unconditionally
Signed-off-by: Pradyun Gedam <pradyunsg@users.noreply.github.com>
2020-11-25 14:12:08 +00:00
Tzu-ping Chung 9efafb186f Implement __str__ for debuggability 2020-11-21 22:14:24 +08:00
Tzu-ping Chung d589795834 Allow constraining an explicit requirement 2020-11-21 22:14:24 +08:00
Pradyun Gedam 0f43e77b7f
Include package name in backtracking messaging
Signed-off-by: Pradyun Gedam <pradyunsg@users.noreply.github.com>
2020-11-19 18:38:30 +00:00
Pradyun Gedam c09549caff
Merge pull request #9101 from uranusjr/new-resolver-error-message-dedup
Use set to dedup package list in error message
2020-11-14 23:56:55 +05:30
Tzu-ping Chung 5ef05cfb1f Make sure periods are followed by a space
The strings are *delibrately* reformatted so line continuations occur in
the middle of sentences. This helps me ensure all spaces are added
properly.
2020-11-10 14:58:38 +08:00
Tzu-ping Chung bf55229fc6 Use set to dedup package list in error message 2020-11-04 21:29:19 +08:00
Tzu-ping Chung 69a95cf391 Tie-break requirements with package name
This makes the ordering deterministic to improve debugging and user
experience.
2020-11-04 21:23:40 +08:00
Tzu-ping Chung d08b4d99e2 Use packaging.version to check version equality 2020-11-03 16:04:35 +08:00
Xavier Fernandez fad456a165 resolver: stabilize output for tests (& users)
Otherwise the test_install_distribution_union_with_versions test can end
up with either:

    Cannot install localextras[bar] 0.0.2 and localextras[baz] 0.0.1 because these package versions have conflicting dependencies.

or

    Cannot install localextras[baz] 0.0.2 and localextras[bar] 0.0.1 because these package versions have conflicting dependencies.
2020-10-31 00:07:34 +01:00
Pradyun Gedam 9f318de7b6
Add a debugging reporter for pip's resolver 2020-10-29 02:33:50 +05:30
Pradyun Gedam 00e531a16e
Merge pull request #9017 from pradyunsg/backtracking-messaging 2020-10-28 18:25:29 +05:30
Pradyun Gedam 741b80ac08
Update wording in informational message 2020-10-28 18:25:12 +05:30
Pradyun Gedam 55e316a452
Add the last line to the info message 2020-10-27 19:32:36 +05:30
Pradyun Gedam 1acca46aa3
Prefix backtracking message with "INFO: " 2020-10-27 19:32:36 +05:30
Pradyun Gedam f3307a5103
Present a message upon first backtrack 2020-10-27 19:32:36 +05:30
Pradyun Gedam daa003bd9b
Make mypy happy 2020-10-27 19:32:36 +05:30
Pradyun Gedam 95171c881f
Display messages when backtracking on a package 2020-10-27 19:32:35 +05:30
Pradyun Gedam 1bb7bf6a4c
Update type annotation 2020-10-27 01:00:30 +05:30
Pradyun Gedam e74116a436
Change assertion in topological sorting 2020-10-27 00:53:41 +05:30
Tzu-ping Chung b921db84bd Improve sorting logic 2020-10-13 16:12:11 +08:00
Tzu-ping Chung 761433cee8 Eliminate len() usage in tests 2020-10-13 16:12:11 +08:00
Tzu-ping Chung 17d0086ea2 Do this all over again 2020-10-13 16:12:11 +08:00
Tzu-ping Chung 6e3d56897b Always return the installed version 2020-10-13 16:12:11 +08:00
Tzu-ping Chung 01c9b6cf25 Cache results and remove unused implementation 2020-10-13 16:06:00 +08:00
Tzu-ping Chung a270ca5616 Mypy is wrong 2020-10-13 16:06:00 +08:00
Tzu-ping Chung 8326148149 Implement "lazy sequence" to avoid Internet
find_matches() is modified to return a special type that implements
the sequence protocol (instead of a plain list). This special sequence
type tries to use the installed candidate as the first element if
possible, and only access indexes when the installed candidate is
considered unsatisfactory.
2020-10-13 16:06:00 +08:00
Noah Gorny 960dca9949 resolvelib: factory: Get installed distributions correctly 2020-10-10 02:23:08 +03:00
Tzu-ping Chung c2de8974d4 Resolve user-requested requirements first 2020-09-28 22:23:10 +08:00
Tzu-ping Chung ebc1375612 Make private attribute looks private 2020-09-28 22:19:51 +08:00
Pradyun Gedam 58c594c06b
Prepare isort for black 2020-09-23 21:47:47 +05:30
Pradyun Gedam 25ab172b55
Update linter: isort 2020-09-23 19:52:28 +05:30
Pradyun Gedam e61bb616ef
Merge pull request #8839 from uranusjr/new-resolver-hash-intersect 2020-09-17 10:58:44 +05:30