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

69 commits

Author SHA1 Message Date
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 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 be60eaaa4f Uninstall existing dist before reinstallation 2020-04-08 17:17:25 +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
Tzu-ping Chung 190c424b1e Implement Python as a dependency
If a dist contains Requires-Python metadata, it is converted into a
Requirement for the resolver based on whether the Requires-Python
is compatible or not.

If it is compatible, an ExplicitRequirement is returned to hold the
Python information (either sys.version_info, or the user-supplied
--python-version).

If it is incompatible, a special NoMatchRequirement is returned, which
never matches to anything, generating a ResolutionImpossible to report
the Python version incompatibility.

The --ignore-requires-python flag is implemented as to not return a
Requirement for Requires-Python at all.
2020-04-02 18:36:08 +08:00
Tzu-ping Chung d29c86af98 Add method to create requirement from spec 2020-04-01 16:53:39 +08:00
Tzu-ping Chung 6db0df928c Move wheel cache out of InstallRequirment 2020-03-30 17:36:03 +08:00
Tzu-ping Chung 07563847b0 Decouple candidate and requirement modules
This introduces a new module "factory" that contains all methods dealing
with producing candidates/requirements from an input
requirement/candidate. This allows both models to know nothing about
each other, and simply rely on the intermediate to produce the other.

I *believe* this also helps us reduce merge conflicts due to adding
arguments to those producer functions, since now we only need to modify
the factory, and exactly one of candidate/requirement.

This is only part of a big scheme--the plan is to also move
Candidate.get_dependencies() and Requirement.find_matches() into the
factory class, so they can avoid holding and passing around finder,
preparer, and make_install_req. This is also necessary to change the
return type of Candidate.get_dependencies() to Requirement without
hard-coupling.
2020-03-27 03:14:51 +08:00
Paul Moore fea9766fa2 Merge branch 'master' into new_resolver_extras 2020-03-26 15:49:43 +00:00
Paul Moore ffb56db5dd Allow candidates to not have an associated install requirement 2020-03-26 11:19:10 +00:00
Tzu-ping Chung 3cb7a08f0d Implement ignore_dependencies in new resolver
If this flag is set, simply report every candidate has no dependencies.
2020-03-24 02:02:36 +08:00
Tzu-ping Chung 5af542ccac Use named arguments for clarity 2020-03-24 02:00:08 +08:00
Paul Moore 1ebe1e0935 Integrate the new provider with --unstable-feature=resolver 2020-03-18 14:49:49 +00:00
Tzu-ping Chung dad77a9e4d Better handle root vetices in graph
ResolveLib *should* always produce a graph with only one root vertice,
which is None. But we don't really need to rely on that implementation
detail. Vertices without any parents can be assigned 0 in all cases.
2020-03-15 23:01:58 +08:00
Tzu-ping Chung ffb3692e00 Add simple tests for get_installation_order()
The implementation is improved a bit to make the sorting result more
predictable for easier testing.
2020-03-15 23:01:57 +08:00
Tzu-ping Chung 53775279c4 Fix graph-walking terminal condition
The weight mapping should have size `len(packages) + 1` because it needs
to contain a "sentinel" node (None).
2020-03-15 22:25:26 +08:00
Tzu-ping Chung a3f6c17d36 Implement resolver methods on provider interface
This is using a temporary PipProvider class, which should be replaced by
the actual implementation after it is merged.
2020-03-15 15:25:38 +08:00
Tzu-ping Chung fc810d7353 Add --unstable-feature=resolver
This introduces a new general option --unstable-feature that can be used
to opt into "preview" features in pip not enabled by default. Currently
the only available feature is "resolver".

A stub resolver interface (which would fail on invocation) is provided
to respond to the flag.

The --unstable-feature option is hidden from --help since the resolver
does not yet work. This suppression should be removed when we release
the resolver for general/public testing.
2020-03-11 18:51:01 +08:00