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

37 commits

Author SHA1 Message Date
Paul Moore
ddbc8fd7c1 Split find_matches into generation and sorting 2020-05-13 17:52:09 +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
Paul Moore
8664218164 Merge branch 'master' into nr_constraints2 2020-05-05 11:41:09 +01:00
Paul Moore
1599cc2a36 Merge branch 'master' into nr_upgrade_strategy 2020-05-03 11:01:27 +01:00
Paul Moore
c92f55f9fc Implement constraints 2020-04-29 13:03:25 +01: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
Pradyun Gedam
746f47cc3a
Factor out logic for getting weights 2020-04-24 17:27:40 +05:30
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
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
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