1 year

Poetry as a dependency management system


Poetry is quite a novel approach to dependency and virtual environment management in Python. It is an open-source project that aims to provide a more predictable and convenient environment for working with the Python packaging ecosystem.

As Poetry is a package on PyPI, you can install it using pip:
$ pip install --user poetry

Poetry takes care of creating Python virtual environments so it should not be installed inside of a virtual 
environment itself. You can install it in either user site-packages or global site-packages although user ,site-packages is the recommended option.

Depending on your system configuration it will be either the global site-packages directory or the user site-packages directory. To avoid this ambiguity, the Poetry project creators recommend using an alternative bootstrapping method.

On macOS, Linux, and other POSIX-compatible systems Poetry can be installed using the curl utility:
$ curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python

On Windows it can be installed using PowerShell:
> (Invoke-WebRequest -Uri https://raw.githubusercontent.com/pythonpoetry/poetry/master/get-poetry.py -UseBasicParsing).Content | python -


Once installed, Poetry can be used to:
• Create new Python projects together with virtual environments
• Initialize existing projects with a virtual environment
• Manage project dependencies
• Package libraries

To create a completely new project with Poetry, you can use the poetry new command as in the following example:

$ poetry new project-test



name = "project-test"
version = "0.1.0"
description = ""
authors = ["Derya Cortuk <[email protected]>"]
python = "^3.9"
pytest = "^5.2"
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"



• [tool.poetry]: This is a set of basic project metadata like name, version 
description, and author. This information is necessary if you would like to 
publish your project as a package on PyPI.

• [tool.poetry.dependencies]: This is a list of project dependencies. On fresh 
projects, it lists only the Python version but can also include all package 
versions that normally would be described in the requirements.txt file.

• [tool.poetry.dev-dependencies]: This is a list of dependencies that require 
local development, like testing frameworks or productivity tools. It is 
common practice to have a separate list of such dependencies as they are 
usually not required in production environments.

• [build-system]: Describes Poetry as a build system used to manage the 

You can find more information about advanced usage of Poetry in 
the official documentation under https://python-poetry.org.