poetry
1.8.5
Poetry 可以帮助您声明、管理和安装 Python 项目的依赖项,确保您在任何地方都有正确的堆栈。
Poetry 使用简单的基于pyproject.toml
的项目格式替换了setup.py
、 requirements.txt
、 setup.cfg
、 MANIFEST.in
和Pipfile
。
[ tool . poetry ]
name = " my-package "
version = " 0.1.0 "
description = " The description of the package "
license = " MIT "
authors = [
" Sébastien Eustace <[email protected]> "
]
repository = " https://github.com/python-poetry/poetry "
homepage = " https://python-poetry.org "
# README file(s) are used as the package description
readme = [ " README.md " , " LICENSE " ]
# Keywords (translated to tags on the package index)
keywords = [ " packaging " , " poetry " ]
[ tool . poetry . dependencies ]
# Compatible Python versions
python = " >=3.8 "
# Standard dependency with semver constraints
aiohttp = " ^3.8.1 "
# Dependency with extras
requests = { version = " ^2.28 " , extras = [ " security " ] }
# Version-specific dependencies with prereleases allowed
tomli = { version = " ^2.0.1 " , python = " <3.11 " , allow-prereleases = true }
# Git dependencies
cleo = { git = " https://github.com/python-poetry/cleo.git " , branch = " main " }
# Optional dependencies (installed by extras)
pendulum = { version = " ^2.1.2 " , optional = true }
# Dependency groups are supported for organizing your dependencies
[ tool . poetry . group . dev . dependencies ]
pytest = " ^7.1.2 "
pytest-cov = " ^3.0 "
# ...and can be installed only when explicitly requested
[ tool . poetry . group . docs ]
optional = true
[ tool . poetry . group . docs . dependencies ]
Sphinx = " ^5.1.1 "
# Python-style entrypoints and scripts are easily expressed
[ tool . poetry . scripts ]
my-script = " my_package:main "
Poetry 支持多种安装方法,包括在 install.python-poetry.org 上找到的简单脚本。有关完整的安装说明,包括脚本的高级用法、备用安装方法和 CI 最佳实践,请参阅完整的安装文档。
当前版本的 Poetry(以及开发分支和最近停止支持的版本)的文档可从官方网站获取。
诗歌是一个庞大而复杂的项目,总是需要贡献者。对于该项目的新手,可以使用诗歌和诗歌核心中建议处理的问题列表。完整的贡献文档还提供了有用的指导。
感谢 JetBrains 通过其工具许可证支持我们。