Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
镜像
Python_Packaging_Authority
pip
提交
f981facb
P
pip
项目概览
镜像
/
Python_Packaging_Authority
/
pip
12 个月 前同步成功
通知
0
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
pip
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
f981facb
编写于
3月 11, 2020
作者:
P
Paul Moore
提交者:
GitHub
3月 11, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #7845 from uranusjr/resolver-flag
Add --unstable-feature=resolver
上级
e15ef595
fc810d73
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
95 addition
and
8 deletion
+95
-8
src/pip/_internal/cli/cmdoptions.py
src/pip/_internal/cli/cmdoptions.py
+14
-0
src/pip/_internal/cli/req_command.py
src/pip/_internal/cli/req_command.py
+21
-3
src/pip/_internal/resolution/base.py
src/pip/_internal/resolution/base.py
+20
-0
src/pip/_internal/resolution/legacy/resolver.py
src/pip/_internal/resolution/legacy/resolver.py
+4
-5
src/pip/_internal/resolution/resolvelib/__init__.py
src/pip/_internal/resolution/resolvelib/__init__.py
+0
-0
src/pip/_internal/resolution/resolvelib/resolver.py
src/pip/_internal/resolution/resolvelib/resolver.py
+36
-0
未找到文件。
src/pip/_internal/cli/cmdoptions.py
浏览文件 @
f981facb
...
...
@@ -915,6 +915,19 @@ no_python_version_warning = partial(
)
# type: Callable[..., Option]
unstable_feature
=
partial
(
Option
,
'--unstable-feature'
,
dest
=
'unstable_features'
,
metavar
=
'feature'
,
action
=
'append'
,
default
=
[],
choices
=
[
'resolver'
],
help
=
SUPPRESS_HELP
,
# TODO: Enable this when the resolver actually works.
# help='Enable unstable feature(s) that may be backward incompatible.',
)
# type: Callable[..., Option]
##########
# groups #
##########
...
...
@@ -943,6 +956,7 @@ general_group = {
disable_pip_version_check
,
no_color
,
no_python_version_warning
,
unstable_feature
,
]
}
# type: Dict[str, Any]
...
...
src/pip/_internal/cli/req_command.py
浏览文件 @
f981facb
...
...
@@ -26,7 +26,6 @@ from pip._internal.req.constructors import (
)
from
pip._internal.req.req_file
import
parse_requirements
from
pip._internal.req.req_set
import
RequirementSet
from
pip._internal.resolution.legacy.resolver
import
Resolver
from
pip._internal.self_outdated_check
import
(
make_link_collector
,
pip_self_version_check
,
...
...
@@ -42,6 +41,7 @@ if MYPY_CHECK_RUNNING:
from
pip._internal.models.target_python
import
TargetPython
from
pip._internal.req.req_install
import
InstallRequirement
from
pip._internal.req.req_tracker
import
RequirementTracker
from
pip._internal.resolution.base
import
BaseResolver
from
pip._internal.utils.temp_dir
import
(
TempDirectory
,
TempDirectoryTypeRegistry
,
...
...
@@ -248,7 +248,7 @@ class RequirementCommand(IndexGroupCommand):
use_pep517
=
None
,
# type: Optional[bool]
py_version_info
=
None
# type: Optional[Tuple[int, ...]]
):
# type: (...) -> Resolver
# type: (...) ->
Base
Resolver
"""
Create a Resolver instance for the given parameters.
"""
...
...
@@ -258,7 +258,25 @@ class RequirementCommand(IndexGroupCommand):
wheel_cache
=
wheel_cache
,
use_pep517
=
use_pep517
,
)
return
Resolver
(
# The long import name and duplicated invocation is needed to convince
# Mypy into correctly typechecking. Otherwise it would complain the
# "Resolver" class being redefined.
if
'resolver'
in
options
.
unstable_features
:
import
pip._internal.resolution.resolvelib.resolver
return
pip
.
_internal
.
resolution
.
resolvelib
.
resolver
.
Resolver
(
preparer
=
preparer
,
finder
=
finder
,
make_install_req
=
make_install_req
,
use_user_site
=
use_user_site
,
ignore_dependencies
=
options
.
ignore_dependencies
,
ignore_installed
=
ignore_installed
,
ignore_requires_python
=
ignore_requires_python
,
force_reinstall
=
force_reinstall
,
upgrade_strategy
=
upgrade_strategy
,
py_version_info
=
py_version_info
,
)
import
pip._internal.resolution.legacy.resolver
return
pip
.
_internal
.
resolution
.
legacy
.
resolver
.
Resolver
(
preparer
=
preparer
,
finder
=
finder
,
make_install_req
=
make_install_req
,
...
...
src/pip/_internal/resolution/base.py
0 → 100644
浏览文件 @
f981facb
from
pip._internal.utils.typing
import
MYPY_CHECK_RUNNING
if
MYPY_CHECK_RUNNING
:
from
typing
import
Callable
,
List
from
pip._internal.req.req_install
import
InstallRequirement
from
pip._internal.req.req_set
import
RequirementSet
InstallRequirementProvider
=
Callable
[
[
str
,
InstallRequirement
],
InstallRequirement
]
class
BaseResolver
(
object
):
def
resolve
(
self
,
root_reqs
,
check_supported_wheels
):
# type: (List[InstallRequirement], bool) -> RequirementSet
raise
NotImplementedError
()
def
get_installation_order
(
self
,
req_set
):
# type: (RequirementSet) -> List[InstallRequirement]
raise
NotImplementedError
()
src/pip/_internal/resolution/legacy/resolver.py
浏览文件 @
f981facb
...
...
@@ -29,6 +29,7 @@ from pip._internal.exceptions import (
UnsupportedPythonVersion
,
)
from
pip._internal.req.req_set
import
RequirementSet
from
pip._internal.resolution.base
import
BaseResolver
from
pip._internal.utils.logging
import
indent_log
from
pip._internal.utils.misc
import
dist_in_usersite
,
normalize_version_info
from
pip._internal.utils.packaging
import
(
...
...
@@ -38,17 +39,15 @@ from pip._internal.utils.packaging import (
from
pip._internal.utils.typing
import
MYPY_CHECK_RUNNING
if
MYPY_CHECK_RUNNING
:
from
typing
import
Callable
,
DefaultDict
,
List
,
Optional
,
Set
,
Tuple
from
typing
import
DefaultDict
,
List
,
Optional
,
Set
,
Tuple
from
pip._vendor
import
pkg_resources
from
pip._internal.distributions
import
AbstractDistribution
from
pip._internal.index.package_finder
import
PackageFinder
from
pip._internal.operations.prepare
import
RequirementPreparer
from
pip._internal.req.req_install
import
InstallRequirement
from
pip._internal.resolution.base
import
InstallRequirementProvider
InstallRequirementProvider
=
Callable
[
[
str
,
InstallRequirement
],
InstallRequirement
]
DiscoveredDependencies
=
DefaultDict
[
str
,
List
[
InstallRequirement
]]
logger
=
logging
.
getLogger
(
__name__
)
...
...
@@ -102,7 +101,7 @@ def _check_dist_requires_python(
))
class
Resolver
(
object
):
class
Resolver
(
BaseResolver
):
"""Resolves which packages need to be installed/uninstalled to perform
\
the requested operation without breaking the requirements of any package.
"""
...
...
src/pip/_internal/resolution/resolvelib/__init__.py
0 → 100644
浏览文件 @
f981facb
src/pip/_internal/resolution/resolvelib/resolver.py
0 → 100644
浏览文件 @
f981facb
from
pip._internal.resolution.base
import
BaseResolver
from
pip._internal.utils.typing
import
MYPY_CHECK_RUNNING
if
MYPY_CHECK_RUNNING
:
from
typing
import
List
,
Optional
,
Tuple
from
pip._internal.index.package_finder
import
PackageFinder
from
pip._internal.operations.prepare
import
RequirementPreparer
from
pip._internal.req.req_install
import
InstallRequirement
from
pip._internal.req.req_set
import
RequirementSet
from
pip._internal.resolution.base
import
InstallRequirementProvider
class
Resolver
(
BaseResolver
):
def
__init__
(
self
,
preparer
,
# type: RequirementPreparer
finder
,
# type: PackageFinder
make_install_req
,
# type: InstallRequirementProvider
use_user_site
,
# type: bool
ignore_dependencies
,
# type: bool
ignore_installed
,
# type: bool
ignore_requires_python
,
# type: bool
force_reinstall
,
# type: bool
upgrade_strategy
,
# type: str
py_version_info
=
None
,
# type: Optional[Tuple[int, ...]]
):
super
(
Resolver
,
self
).
__init__
()
def
resolve
(
self
,
root_reqs
,
check_supported_wheels
):
# type: (List[InstallRequirement], bool) -> RequirementSet
raise
NotImplementedError
()
def
get_installation_order
(
self
,
req_set
):
# type: (RequirementSet) -> List[InstallRequirement]
raise
NotImplementedError
()
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录