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
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
591d476fca
Note on why we don't implement equality
2020-04-08 16:38:47 +08:00
Tzu-ping Chung
018c051a8e
Implement equality on candidate classes
2020-04-08 16:38:47 +08:00
Paul Moore
bd912cf0de
Merge pull request #7993 from uranusjr/new-resolver-normal-test-progress
...
Canonicalise project name from InstallationCandidate
2020-04-08 09:12:50 +01:00
Tzu-ping Chung
6d40804b12
Add __repr__ to requirement/candidate models
2020-04-07 20:53: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
2f36ac7587
Add assertion message for easier debugging
2020-04-07 19:02:17 +08:00
Tzu-ping Chung
74c5042052
Accept InsatllRequirement as comes_from
2020-04-05 12:17:25 +08:00
Tzu-ping Chung
aead201fda
No need to think about editable for installed dist
2020-04-04 21:53:04 +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
Tzu-ping Chung
9ca2240530
More clarification on the name
2020-04-02 21:42:29 +08:00
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
4491f38047
Return Requirement directly from get_dependencies
...
This is possible now we have the factory construct.
2020-04-01 15:31:52 +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
6db0df928c
Move wheel cache out of InstallRequirment
2020-03-30 17:36:03 +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
Paul Moore
fea9766fa2
Merge branch 'master' into new_resolver_extras
2020-03-26 15:49:43 +00:00
Paul Moore
a68345e81c
Warn if invalid extras are given
2020-03-26 14:53:24 +00:00
Paul Moore
7e97cf6426
Ignore invalid extras
2020-03-26 11:57:34 +00:00
Paul Moore
67bf5890ea
Document the ExtrasCandidate class
2020-03-26 11:56:46 +00:00
Paul Moore
ffb56db5dd
Allow candidates to not have an associated install requirement
2020-03-26 11:19:10 +00:00
Paul Moore
d79aacc61c
Forgot to run lint before pushing again :-(
2020-03-25 12:39:21 +00:00
Paul Moore
bd0f7fe346
Add an ExtrasCandidate class
2020-03-25 12:27:24 +00:00
Paul Moore
76de49bc24
Make a proper get_install_requirement method for candidates
2020-03-25 12:27:24 +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
Tzu-ping Chung
ff35f7f26a
Remove stale TODO comment
2020-03-23 17:15:55 +08:00
Paul Moore
c83505b848
Remove an obsolete comment
2020-03-20 13:57:45 +00:00
Paul Moore
ffe553638c
Address review requirements
2020-03-19 10:55:33 +00:00