Poetry Commands
Python dependency management and packaging.All Poetry pages
- poetry add --group dev pytest: add a development dependencypoetry add --group dev pytest records a development-only dependency; Poetry 2 writes it to [dependency-groups]. poetry install --without dev leaves it out.
- poetry lock: update poetry.lock without upgrading dependenciesIn Poetry 2, poetry lock updates poetry.lock and keeps locked versions; --regenerate rebuilds it. Catch a stale lock file with poetry check --lock in CI.
- poetry new: create a new Python project with Poetry (and poetry init)poetry new demo-app creates a project with pyproject.toml, a src-layout package, tests and README. Options like --flat and --name, poetry init and next steps.
- poetry show --tree: show the dependency tree of a Poetry projectpoetry show --tree prints each direct dependency with the constraints of what it requires, from poetry.lock. Flat list, --top-level, --why, --outdated and (!).