Learn Poetry

Python Poetry (https://python-poetry.org/) is a Python dependency and package management tool. It replaces PIP and removes the friction from creating a python project suitable for repackaging.

Install

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

Create a Project

poetry new learn-poetry

Add a dependency

poetry add geopandas

This updates pyproject.toml:

[tool.poetry.dependencies]
python = "^3.9"
geopandas = "^0.9.0"

Install dependencies (after cloning a repo)

poetry install 

Add Python Files

learn_poetry/geospatial.py

import geopandas

path_to_data = geopandas.datasets.get_path("nybb")
gdf = geopandas.read_file(path_to_data)

gdf["area"] = gdf.area

print(gdf[["BoroName", "area"]])

Run a Poetry Project

poetry run python learn_poetry/geospatial.py

Run Pytest Tests

poetry run pytest