Poetry is a modern Python dependency and packaging manager, maintained by its open-source community, ranking #31 in usage among developer tools at roughly 9%. It replaces the old pip + requirements.txt + setup.py combo with a single tool that handles virtual environments, lockfiles, and publishing to PyPI. It's popular for both application development and building distributable Python libraries.
Poetry stores dependencies and project metadata in pyproject.toml, and locks exact versions in poetry.lock.
# add a real HTTP library to the project
poetry add requests
# resulting pyproject.toml
[tool.poetry]
name = "my-app"
version = "0.1.0"
description = ""
[tool.poetry.dependencies]
python = "^3.11"
requests = "^2.31.0"
Install Poetry with its official installer script, then initialize or install dependencies inside a project directory.
# official install script (macOS/Linux)
curl -sSL https://install.python-poetry.org | python3 -
# create a new project or install existing dependencies
poetry new my-app
poetry install