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 透過其工具授權支持我們。