Files
tldr/pages.zh/common/poetry.md

37 lines
883 B
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Poetry
> 管理 Python 包和依赖关系。
> 另见:`asdf`。
> 更多信息:<https://python-poetry.org/docs/cli/>。
- 在指定名称的目录中创建一个新的 Poetry 项目:
`poetry new {{project_name}}`
- 安装并将依赖项及其子依赖项添加到当前目录中的 `pyproject.toml` 文件:
`poetry add {{dependency}}`
- 使用当前目录中的 `pyproject.toml` 文件安装项目依赖项:
`poetry install`
- 交互式地将当前目录初始化为一个新的 Poetry 项目:
`poetry init`
- 获取所有依赖项的最新版本并更新 `poetry.lock`
`poetry update`
- 在项目的虚拟环境中执行命令:
`poetry run {{command}}`
-`pyproject.toml` 中提升项目的版本:
`poetry version {{patch|minor|major|prepatch|preminor|premajor|prerelease}}`
- 在项目的虚拟环境中打开一个 shell
`poetry shell`