DEV Community

Discussion on: Trying Poetry, another Python Dependency Manager

Collapse
 
corentinbettiol profile image
Corentin Bettiol • Edited

Nice post!

Here are some commands that I use on a (nearly) daily basis:

I like to have my venvs in the same folder than my project, and so I use this config to update the default behavior of Poetry:

poetry config virtualenvs.in-project true
Enter fullscreen mode Exit fullscreen mode

For installing projects that uses poetry but that are not packages themselves, I use this command:

poetry install --no-root
Enter fullscreen mode Exit fullscreen mode

For deleting some annoying cache (in case poetry don't detect a new version of a package), I use:

poetry cache clear pypi
Enter fullscreen mode Exit fullscreen mode

For installing a package from github/gitlab (bonus if it's on a branch), I use:

poetry add git+https://github.com/user/package.git@branch_name
Enter fullscreen mode Exit fullscreen mode

For installing a particular version of a package (like django-treebeard, when the latest version broke django-cms), I use:

poetry add "django-treebeard>4.0,!=4.5.1"
Enter fullscreen mode Exit fullscreen mode
Collapse
 
dendihandian profile image
Dendi Handian

I was looking for that in-project env config ๐Ÿ˜…thanks for these tips