在运行poetry add package
时,poetry决定在没有我的要求下更新一些过时的依赖项:
$ poetry add -D ipython
Using version ^7.26.0 for ipython
Updating dependencies
Resolving dependencies... (6.8s)
Writing lock file
Package operations: 13 installs, 2 updates, 0 removals
• Installing ipython-genutils (0.2.0)
• Installing parso (0.8.2)
• Installing ptyprocess (0.7.0)
• Installing traitlets (5.0.5)
• Installing wcwidth (0.2.5)
• Installing appnope (0.1.2)
• Installing backcall (0.2.0)
• Updating connexion (2.8.0 -> 2.9.0) <---------- "I never asked for this"
• Installing jedi (0.18.0)
• Installing matplotlib-inline (0.1.2)
• Installing pexpect (4.8.0)
• Installing pickleshare (0.7.5)
• Installing prompt-toolkit (3.0.19)
• Installing ipython (7.26.0)
• Updating ramda (0.6.0 -> 0.6.1) <---------- "I never asked for this"
然而,当获得命令的帮助时,似乎没有任何东西表明可以禁用此行为:
$ poetry add --help
USAGE
poetry add [-D] [-E <...>] [--optional] [--python <...>]
[--platform <...>] [--source <...>] [--allow-prereleases]
[--dry-run] [--lock] <name1> ... [<nameN>]
ARGUMENTS
<name> The packages to add.
OPTIONS
-D (--dev) Add as a development dependency.
-E (--extras) Extras to activate for the dependency.
(multiple values allowed)
--optional Add as an optional dependency.
--python Python version for which the dependency must be
installed.
--platform Platforms for which the dependency must be
installed.
--source Name of the source to use to install the
package.
--allow-prereleases Accept prereleases.
--dry-run Output the operations but do not execute
anything (implicitly enables --verbose).
--lock Do not perform operations (only update the
lockfile).
GLOBAL OPTIONS
-h (--help) Display this help message
-q (--quiet) Do not output any message
-v (--verbose) Increase the verbosity of messages: "-v" for
normal output, "-vv" for more verbose output and
"-vvv" for debug
-V (--version) Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
-n (--no-interaction) Do not ask any interactive question
...
有没有办法只安装感兴趣的软件包?我宁愿不更新deps,即使颠簸是一个轻微的颠簸- dependabot已经存在的目的。
1条答案
按热度按时间sqserrrh1#
手动将依赖项添加到
pyproject.toml
,然后运行poetry lock --no-update
,以便将依赖项添加到您的锁文件,而无需根据当前版本规范更新其他软件包。您还可以将
pyproject.toml
中的所有版本规格锁定到一个确切的版本,即使用0.8.2
代替^0.8.2
。