backend/python
poetry usage
seul chan
2020. 1. 14. 18:54
Poetry usage
Install
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python
Enable tab completion
# Bash
poetry completions bash > /etc/bash_completion.d/poetry.bash-completion
# Bash (macOS/Homebrew)
poetry completions bash > $(brew --prefix)/etc/bash_completion.d/poetry.bash-completion
# Fish
poetry completions fish > ~/.config/fish/completions/poetry.fish
# Zsh
poetry completions zsh > ~/.zfunc/_poetry
# Oh-My-Zsh
mkdir $ZSH/plugins/poetry
poetry completions zsh > $ZSH/plugins/poetry/_poetry
For oh-my-zsh
, enable plugin
plugins(
poetry
...
)
Start project
# will create directory and env
poetry new
# create env in current dir
poetry init
- You can install packages during installing env
Add and install packages
# Add package
poetry add <package_name>
# Add package to dev
poetry add <package_name> -D
# Install package
poetry install <package_name>
# Remove package
poetry remove <package_name>