Poetry is a powerful tool for dependency management and packaging in Python projects. It offers a comprehensive solution for managing project dependencies, virtual environments, and package distribution.

Useful Commands

CommandDescription
poetry new <project_name>Create a new project
poetry initInitialize a Poetry project on the current folder
poetry shellActivate virtual environment
poetry add <package_name>Add a dependency
poetry add <package_name> --group devAdd a development dependency
poetry remove <package_name>Remove a dependency
poetry show -treeShow dependency tree
poetry updateUpdate dependencies
poetry install --only mainInstall dependencies
poetry env listList all Poetry virtual environments
poetry env infoGet information about currently active environment
poetry env remove <env_name>Delete virtual environment
poetry buildBuilds the project into a distributable format
poetry publishPublish the project
exitClose the current active environment