Commit Graph

56 Commits

Author SHA1 Message Date
Nguyễn Gia Phong f8b06a3906 Enable flake8-logging-format 2020-07-17 14:33:19 +07:00
Pradyun Gedam b419ca7317
Fix the link on new-resolver dependency conflicts 2020-07-17 06:03:01 +05:30
Tzu-ping Chung 01e0700e68 Skip installing if the version matches locally
This check only applies to explicit requirements since we avoid
downloading the dist from finder altogether when there is a matching
installation (although the check wouldn’t change the behaviour in that
case anyway).

We can do this when we build the `ExplicitRequirement` instead, like how
we did for `SpecifierRequirement`, but that would require us to resolve
the direct requirement’s version eagerly, which I don’t want to.

The implemented approach checks the version only after resolution, at
which point the distribution is already built anyway and the operation
is cheap.
2020-07-06 11:06:14 +08:00
Paul Moore d287033599
Merge pull request #8394 from pfmoore/nr_conflict_message
Improve the message for "Resolution Conflict" errors
2020-06-18 13:45:51 +01:00
Paul Moore 868ba81a74 Next iteration of message 2020-06-17 17:11:32 +01:00
Paul Moore 2795742b31 Add handling of inconsistent root requirements 2020-06-17 16:47:04 +01:00
Paul Moore 09d311594e Move error handling to factory.get_installation_error() 2020-06-17 16:44:53 +01: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
Tzu-ping Chung e647b12540 Yield installed candidate at the correct position 2020-06-05 08:17:28 +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
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 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
Pradyun Gedam 901898c84f
Make mypy happy 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
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 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
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 96b3377cd7 Type annotations 2020-05-15 10:57:07 +01:00
Paul Moore 9cf1bed78d Address review comments 2020-05-14 11:33:30 +01:00
Paul Moore ddbc8fd7c1 Split find_matches into generation and sorting 2020-05-13 17:52:09 +01:00
Tzu-ping Chung d8062791dd Implement use-user-site 2020-05-06 03:48:34 +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 1eb7011da4 Add an assertion that upgrade_strategy is valid 2020-04-28 10:39:53 +01: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
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
Paul Moore d605530b44 Implement upgrade strategies for the new resolver 2020-04-24 11:08:06 +01: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
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
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
Tzu-ping Chung be60eaaa4f Uninstall existing dist before reinstallation 2020-04-08 17:17:25 +08:00
Tzu-ping Chung 90ce7c9edd Refactor to prepare for upgrade procedures 2020-04-08 17:17:25 +08:00
Tzu-ping Chung b89e1c2fb4 Canonicalize InstallationCandidate name
Caught by test_single_download_from_requirements_file etc.
2020-04-07 19:05:26 +08:00
Tzu-ping Chung 05f7dbd0c8 Type hint hacks 2020-04-04 18:15:26 +08:00
Tzu-ping Chung 2430aba879 Implement editable candidate 2020-04-04 17:51:43 +08:00
Tzu-ping Chung 3b06cb6b53 Refactor ireq-related operations to base class 2020-04-03 21:33:16 +08:00
Paul Moore d53d3d6b24 Use the name/version from the InstallationCandidate 2020-04-03 11:23:35 +01:00
Tzu-ping Chung 7511737ee7 AlreadyInstalledCandidate 2020-04-03 01:27:34 +08:00
Tzu-ping Chung f061f3f691 Fetch install dist for a candidate if available
The candidate creation logic is further moved into the factory. The
factory would use pkg_resources.get_distribution() to find a matching
distribution for a givan InstallationCandidate. If found, the Candidate
would be created based on that found distribution, instead of the link.

--ignore-installed is implemented as to always use the link to create
candidates, even if an installed distribution is found.
2020-04-03 00:36:26 +08:00