DEV Community

Beginner Guide on “Poetry”, New Python dependency management tool

Yuki Nagae on April 20, 2019

Why I write this post? Once I wrote a blog post about “pipenv”, which is one of the Python package management tools, Dylan gave me a co...
Collapse
 
mcepl profile image
Matěj Cepl

This is so beautiful example of xkcd.com/927/ !

Collapse
 
jweberdj profile image
Joshua Weber

Poetry is great! Does anyone know how to run a python script with poetry and use a python option?

Ideally, need to invoke a python script as so: python3 -u script.py

Collapse
 
forfdev profile image
Andrew Spittlemeister

You can use poetry run <your commands here> to run anything within the virtual environment described by the pyproject.toml file. So poetry run python3 -u script.py.

Collapse
 
helpermethod profile image
Oliver Weiler

I'm baffled that dependency management is still an unsolved problem in the Python community :/.

Collapse
 
anwar_nairi profile image
Anwar • Edited

So true... It is not like they do not have any inspiration (npm, composer, ...).

Also, they really should get rid of that environement in favor of local files. I wonder if poetry make a virtual environnement or not.

Collapse
 
yukinagae profile image
Yuki Nagae • Edited

Poetry uses or creates a virtual environment according to the below doc. Maybe we cannot escape from virtual environments when we use Python...

Poetry will check if it's currently inside a virtualenv and, if not, will use an existing one or create a brand new one for you to always work isolated from your global Python installation.

see: poetry.eustace.io/docs/basic-usage...

Collapse
 
pdina profile image
Paolo E Basta

Well, about requirements.txt here it is github.com/python-poetry/poetry/is...