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

56 commits

Author SHA1 Message Date
Tzu-ping Chung 65ffd338f4 Explain how Requires-Python matching works 2020-04-02 19:02:20 +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 e06048cb8b Aggregate helper usages into factory object
This prevents us from having to hold multiple references of
finder/preparer/make_install_req in each requirement/candidate class.
Instead we just pass around the factory object, and let others use the
instances on it.
2020-04-01 15:31:52 +08:00
Tzu-ping Chung 4ae50f9af7 Remove unused preparer from SpecifierRequirement 2020-03-27 19:00:27 +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