Commit Graph

198 Commits

Author SHA1 Message Date
Paul Moore 09d311594e Move error handling to factory.get_installation_error() 2020-06-17 16:44:53 +01:00
Paul Moore c827f2964c Revised ResolutionImpossible message 2020-06-17 16:44:53 +01:00
Paul Moore 27521ac1f2 Remove duplicates from the list of conflicts in ResolutionImpossible reporting 2020-06-17 16:44:53 +01:00
Tzu-ping Chung 78db0ba40b Set the requirement context on hash error
This improves the message shown by the hash error to include the
requirement that caused it.
2020-06-16 14:54:04 +08:00
Tzu-ping Chung 439da2f902 Implement yanked link warning in the new resolver 2020-06-15 16:38:10 +08:00
Tzu-ping Chung ebb90c6411 Reject incompatibile direct wheel link
This mirrors the behavior in the legacy resolver. In the future we may
want to backtrack in this situation instead, but I haven't found a clean
way to do this. We may need to introduce an "empty" requirement class.

The `PackageFinder.target_python` interface is also not the most clean.
Maybe we should expose the target Python object instead. Not sure yet.
2020-06-10 20:57:23 +08:00
Paul Moore 57b39a85bc
Merge pull request #8397 from uranusjr/new-resolver-fix-candidate-ordering
New resolver fix candidate ordering
2020-06-10 12:24:37 +01:00
Paul Moore 7bf78f05df
Merge pull request #8283 from uranusjr/pre-existing-build-directory-fix
Pre-existing build directory fix
2020-06-09 16:47:53 +01:00
Tzu-ping Chung e647b12540 Yield installed candidate at the correct position 2020-06-05 08:17:28 +08:00
Paul Moore d3ce025e8d
Merge pull request #8378 from uranusjr/direct-url-fix
Fix direct URL by always passing the template’s URL values into candidate
2020-06-04 17:31:45 +01:00
Tzu-ping Chung 09a7f271c7 Only attach UUID to build dir for spec candidates
These are the only cases where backtracking can happen. This approach
also accounts for VCS requirements relying on the same ensure function
to do cloning :/
2020-06-04 23:26:19 +08:00
Pradyun Gedam 85ce4dfd2c
Merge pull request #8374 from uranusjr/unsupported-link-with-marker
Correctly apply marker matching logic to all requirements
2020-06-04 11:34:31 +05:30
Tzu-ping Chung e4f870ba25 Raise proper exceptions on metadata mismatch 2020-06-03 03:52:07 +08:00
Tzu-ping Chung a0d12df489 Copy link values from template to candidate's ireq
We need to set the original link so the value is accessible in later
code, when we return the ireq backing the candidate. This is needed for
some parts of the post processing like PEP 610 support, which needs to
record the original, remote URL, not the potentially hit cache link.
2020-06-02 19:12:42 +08:00
Tzu-ping Chung a90fe9bd94 Remove outdated TODO comment 2020-06-02 19:07:12 +08:00
Tzu-ping Chung 1719fc3dcc Merge spec->req constructors
Since both functions now return Optional[Requirement], we can just use
the same implementation.
2020-06-02 12:02:52 +08:00
Tzu-ping Chung d5204dd0ba Move markers check into the ireq->req constructor
This makes the check apply to ALL requirement constructions, no
exceptions.
2020-06-02 12:02:52 +08:00
Tzu-ping Chung 258bd7945e Allow Candidate.iter_dependencies() to yield None 2020-06-02 11:53:08 +08:00
Stéphane Bidoul aa0c167498
Make sure user_supplied is propagated where needed 2020-05-31 18:33:51 +02:00
Stéphane Bidoul b9a19f6be0
Rename is_direct to user_supplied 2020-05-31 18:33:51 +02:00
Pradyun Gedam b5a5bcf13b
Rename parent to template 2020-05-28 18:50:09 +05:30
Tzu-ping Chung 9ee19a1190 Always use frozenset 2020-05-27 23:10:56 +08:00
Tzu-ping Chung b8404fde99 Always read extras from InstallRequirement.extras 2020-05-27 23:10:56 +08:00
Tzu-ping Chung 6c6b6a7765 Implement new Provider.find_matches() 2020-05-27 23:10:56 +08:00
Tzu-ping Chung 80f3b3e6e0 This is correct! 2020-05-27 20:19:38 +08:00
Tzu-ping Chung 48c3d0c8ec Typo in docstring
Co-authored-by: Paul Moore <p.f.moore@gmail.com>
2020-05-27 20:19:38 +08:00
Tzu-ping Chung bc9b288b1e Implement wheel cache lookup in the new resolver 2020-05-27 20:19:37 +08:00
Tzu-ping Chung dab7b94ade Derive Requirement name from ireq is possible
This is useful when resolving the wheel cache.
2020-05-27 20:19:37 +08:00
Tzu-ping Chung 5f2bc2b47c DO NOT sort the returned matches by version
A higher version is not always preferred over the lower; the user may
be explicitly preferring lower versions by specifying --prefer-binary
or similar flags.

PackageFinder already takes these into account for these and orders
the matches. Don't break it.
2020-05-25 14:12:36 +08:00
Paul Moore 48334aeb80 New resolver not raising DistributionNotFound 2020-05-22 15:36:10 +01:00
Pradyun Gedam 24e4cf7118
Update comments and documentation 2020-05-21 21:47:42 +05:30
Pradyun Gedam 901898c84f
Make mypy happy 2020-05-21 21:47:42 +05:30
Pradyun Gedam 9506a28114
ExtrasCandidate depends on exact base, before optional dependencies 2020-05-21 21:47:42 +05:30
Pradyun Gedam 95347df102
Directly require BaseCandidate in ExtrasCandidate 2020-05-21 21:47:42 +05:30
Pradyun Gedam 775f9ff6ca
Add a helper for making ExplicitRequirement objects 2020-05-21 21:47:38 +05:30
Paul Moore 278ac2d67f
Merge pull request #8286 from uranusjr/read-root-extras-correctly
Always read InstallRequirement.extras
2020-05-21 16:05:35 +01:00
Tzu-ping Chung d848ee934d Always read InstallRequirement.extras 2020-05-21 20:33:06 +08:00
Tzu-ping Chung de63eae0c3 Match logging 2020-05-21 18:09:35 +08:00
Tzu-ping Chung e6352bc468 Return package dependencies only if markers match 2020-05-21 16:14:26 +08:00
Tzu-ping Chung 5ebf22248c Ignore root dependencies with non-matching markers 2020-05-21 15:53:03 +08:00
Tzu-ping Chung c3ac76f66c Turn Candidate.get_dependencies() into iterable
This makes it easier to exclude dependencies when markers don't match.
2020-05-21 15:39:16 +08:00
Tzu-ping Chung 418d9051b8 Set max_rounds to an incredibly large number
We really don't want to raise ResolutionTooDeep yet since the metric is
not very useful. Try to avoid this until we come up with a better method
to count.
2020-05-20 21:15:09 +08:00
Tzu-ping Chung f39134699b Avoid the horrendous line break for type hints 2020-05-18 17:15:06 +08:00
Tzu-ping Chung ec86cb1970 Use OrderedDict to prefer links found *later* 2020-05-18 16:35:09 +08:00
Nguyễn Gia Phong 29940371cc Fix typo and simplify ireq call 2020-05-16 12:04:17 +07:00
Paul Moore c74577e18e
Merge pull request #8186 from uranusjr/install-req-from-dist-line-rewrite
Build ireq line from parent for installed dist
2020-05-15 22:33:03 +01:00
Paul Moore e28b388c73
Merge pull request #7997 from uranusjr/resolver-use-user-site
New resolver: implement --user
2020-05-15 20:01:50 +01:00
Paul Moore 640b5e1dec
Merge pull request #8192 from uranusjr/requires-python-contains
Allow prereleases in Requires-Python check
2020-05-15 20:01:01 +01:00
Paul Moore 4c599edc5b
Merge pull request #8243 from pfmoore/message_fixes
Fix some test failures related to message differences
2020-05-15 15:25:31 +01:00
Paul Moore adfb70a309
Merge pull request #8239 from pfmoore/constraints_fixes
Tidy up handling of unexpected forms of constraint
2020-05-15 14:58:29 +01:00
Paul Moore c258a1f517 Fix some test failures related to message differences 2020-05-15 14:17:47 +01:00
Paul Moore a56376b20f req.specifier is always a SpecifierSet 2020-05-15 13:58:12 +01:00
Paul Moore 96b3377cd7 Type annotations 2020-05-15 10:57:07 +01:00
Paul Moore 0bcae1e964 Add a deprecation warning for undocumented constraint forms 2020-05-15 09:54:40 +01:00
Paul Moore 6fcaf49cb0 Tidy up handling of unexpected forms of constraint 2020-05-14 17:04:18 +01:00
Paul Moore 9cf1bed78d Address review comments 2020-05-14 11:33:30 +01:00
Paul Moore 0db022fc42 Remove left-over print from debugging 2020-05-13 18:04:20 +01:00
Paul Moore ddbc8fd7c1 Split find_matches into generation and sorting 2020-05-13 17:52:09 +01:00
Tzu-ping Chung 1ea42caf1f Allow prereleases in Requires-Python check 2020-05-07 21:15:43 +08:00
Paul Moore 94f2dc435b
Merge pull request #8170 from pfmoore/nr_constraints2
New Resolver: Second try at implementing constraints
2020-05-07 12:40:49 +01:00
Paul Moore c7c319c4ed Fix type declarations. Mypy let me down :-( 2020-05-07 11:55:56 +01:00
Paul Moore 64b3d1b278 Merge constraints into a single SpecifierSet 2020-05-06 11:30:25 +01:00
Paul Moore ee4830b5ec Move constraints from factory to provider 2020-05-06 10:56:50 +01:00
Tzu-ping Chung d8062791dd Implement use-user-site 2020-05-06 03:48:34 +08:00
Paul Moore 8664218164 Merge branch 'master' into nr_constraints2 2020-05-05 11:41:09 +01:00
Tzu-ping Chung 6b34b39b7e Build ireq line from parent for installed dist 2020-05-04 02:19:12 +08:00
Tzu-ping Chung 647dc6e128 Include prereleases in specifier check 2020-05-04 02:08:27 +08:00
Paul Moore 1599cc2a36 Merge branch 'master' into nr_upgrade_strategy 2020-05-03 11:01:27 +01:00
Paul Moore 218e7d830d
Merge pull request #8146 from uranusjr/new-resolver-extra-in-explicit-requirement
New resolver: Carry extras info in ExplicitRequirement
2020-05-03 10:57:48 +01:00
Paul Moore 79a0afb79a
Merge pull request #8005 from uranusjr/candidate-from-link-retains-specifier
New resolver: Use requirement line to populate LinkCandidate._ireq
2020-05-03 09:59:50 +01:00
Paul Moore c92f55f9fc Implement constraints 2020-04-29 13:03:25 +01:00
Paul Moore 1eb7011da4 Add an assertion that upgrade_strategy is valid 2020-04-28 10:39:53 +01:00
Tzu-ping Chung 06d9ea0952 Mark local install as xfail 2020-04-27 14:36:59 +08:00
Tzu-ping Chung d8aede42d1 Correctly pass extras to explicit requirement
Local source directory is still not working due to some other reasons.
Need to investigate.
2020-04-27 14:23:15 +08:00
Pradyun Gedam 58e2057f1a
Optimize "in path" lookups
O(n) list lookups to O(1) set lookups
2020-04-25 04:20:20 +05:30
Pradyun Gedam d236004138
Rewrite `get_topological_weights` to allow cycles
We take the length for the longest path to any node from root, ignoring
any paths that contain any node twice (i.e. cycles).
2020-04-25 04:09:14 +05:30
Paul Moore bdf56a0303 Fix really, really dumb mistake 2020-04-24 17:52:51 +01:00
Paul Moore 2a66ad1e2d Add an assertion to ensure we don't reuse the factory 2020-04-24 16:44:02 +01:00
Pradyun Gedam e6853336fe
Revert "Drop code for nicer diffs later"
This reverts commit f927f9ae39.
2020-04-24 19:57:58 +05:30
Paul Moore 7a54b2b3a8 Use is_direct rather than an explicit root parameter 2020-04-24 14:30:34 +01:00
Paul Moore 04bf571521 Ensure root requirement name is canonicalised 2020-04-24 14:30:34 +01:00
Pradyun Gedam 746f47cc3a
Factor out logic for getting weights 2020-04-24 17:27:40 +05:30
Tzu-ping Chung e03614fe6d Use req to populate candidate line instead of link
This ensures a candidate built from a "found" link (from e.g. index) is
categorized as specifier-based, not URL-based. This is important to
avoid a specifier-based candidate to be 'pip freeze'-ed in the direct
URL form due to PEP 610 (direct-url.json).
2020-04-24 19:14:00 +08:00
Paul Moore d605530b44 Implement upgrade strategies for the new resolver 2020-04-24 11:08:06 +01:00
Pradyun Gedam f927f9ae39
Drop code for nicer diffs later 2020-04-23 07:04:28 +05:30
Pradyun Gedam 3fe1eab593
Reword get_installation_order docstring 2020-04-23 07:02:53 +05:30
Tzu-ping Chung 572d03b25b Always allow prereleases in is_satisfied_by() 2020-04-18 23:08:30 +08:00
Pradyun Gedam 97f639057e
Merge pull request #8014 from uranusjr/always-return-installed-candidate 2020-04-18 16:15:14 +05:30
Tzu-ping Chung 9c97b285b9 Rename variable for clarity 2020-04-16 13:44:13 +08:00
Paul Moore ea391b2aab Merge with master 2020-04-14 11:27:10 +01:00
Pradyun Gedam 92c9f8136a
Merge pull request #8004 from uranusjr/requires-python-error
New Resolver: Raise UnsupportedPythonVersion for Requires-Python mismatch
2020-04-13 19:42:51 +05:30
Tzu-ping Chung f4f0a34053 Block user from unfinished parts of the resolver 2020-04-13 21:32:20 +08:00
Paul Moore 3642589903 Make message more user friendly when unable to resolve 2020-04-13 11:32:21 +01:00
Tzu-ping Chung 84b99c20b8 Canonicalize installed distribution keys 2020-04-13 18:05:24 +08:00
Tzu-ping Chung d2028e9538 Implement RequiresPythonRequirement with context
This specialized class is able to carry more context information than
the previous implementation (which reuses ExplicitRequirement). Error
reports can thus provide better messages by introspecting.
2020-04-10 23:17:29 +08:00
Pradyun Gedam 8cca170ceb
Merge pull request #7976 from uranusjr/installed-candidate-equal
New Resolver: Implement equality on candidate classes
2020-04-10 18:57:56 +05:30
Tzu-ping Chung cfac6aebdd Always return an install candidate last if matches
This rewrites how a SpecifierRequirement generates candidates, so it

* Always return an AlreadyInstalledCandidate (as long as the version
  satisfies the specifier), even if PackageFinder does not return a
  candidate for the same version.
* Always put the AlreadyInstalledCandidate last, so it's preferred over
  LinkCandidate, preventing version changes if possible.
2020-04-10 20:51:06 +08:00
Paul Moore 6c97645e2f
Merge pull request #8000 from uranusjr/new-resolver-normal-test-progress
New Resolver: Make sure candidates are prepared after resolution
2020-04-10 11:56:56 +01:00
Tzu-ping Chung 56e065f956 Move dist preparation to its own method 2020-04-09 02:27:37 +08:00
Tzu-ping Chung a7d17f8da6 Make sure candidates are prepared after resolution 2020-04-08 23:38:10 +08:00