Skip to content

poetry

the official docs and project description might be a better resource if you want to get started. this page is more like a quick cheat sheet

creating a project

create new project:

poetry new project-name

use poetry in an existing project:

poetry init

package management

install packages defined in pyproject.toml:

poetry install

add package:

poetry add feedparser

delete / remove package:

poetry remove pendulum

update packages:

poetry update

use poetry virtualenv

depending on your config, the virtual environment poetry creates is automatically activated, if not, do this:

poetry shell

if the above doesn't work for some reason, that's how I got it working otherwise:

source `poetry env info --path`/bin/activate

run scripts

poetry run python your_script.py

if a package you've added comes with an executable CLI tool, you can run them like this:

poetry run black
poetry run pytest