🤖

【Poetry】Code Snippet

2023/02/09に公開

Documentation RTFM

https://python-poetry.org/docs/

Install

curl -sSL https://install.python-poetry.org | python3 -

Remove

rm -rf ~/.local/share/pypoetry/

Start Poetry

poetry new <project-name>

Add Package

poetry add <package-name>

Run Python file

poetry shell
python <python-file>

remove package

poetry remove <package>

VENV

IF YOU WANT TO USE SPECIFIC VERSION IN POETRY BY USING PYENV, YOU NEED TO SET VENV BEFORE POETRY CREATE ONE.

python -m venv .venv 

Activation

source .venv/bin/activate

Create venv inside current project.

poetry config virtualenvs.in-project true

If venv has already exists. The venv has to be deleted before creating in inside.

poetry env list

-> poetry-xx-py3.6

poetry env remove poetry-xx-py3.6

Discussion