Setting up Poetry for Dependency Management

Setting up Poetry for Dependency Management

Poetry is python packaging and dependency management made easy.

Poetry Install Script

$ curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python3

Sample Project

Create Sample Project

$ poetry new how-long

Creating virtual environment

NOTE: This is done only once.

$ poetry config virtualenvs.in-project true
$ poetry install

Launch virtual environment

$ poetry shell 

Uninstall virtual environment

$ poetry env remove 3.x

Existing Project

  1. Switch to master branch (if not already on)
  2. git status
  3. git pull
  4. git checkout -b new_branch_name

NOTE: Assume that poetry config virtualenvs.in-project true has been run.

$ poetry install
$ poetry shell 

Check python environment.

Previous
Next