Skip to content

Instantly share code, notes, and snippets.

@nilreml
Last active December 10, 2024 13:24
Show Gist options
  • Save nilreml/e00e589d3aee60e922f9d0db4f3b57b8 to your computer and use it in GitHub Desktop.
Save nilreml/e00e589d3aee60e922f9d0db4f3b57b8 to your computer and use it in GitHub Desktop.
Add bash completions:
mkdir -p ${XDG_DATA_HOME:-~/.local/share}/bash-completion/completions
poetry completions bash > ${XDG_DATA_HOME:-~/.local/share}/bash-completion/completions/poetry
Enter virtual environment:
poetry shell
Exit virtual environment:
exit
Add external source and packages using it:
poetry source add --priority=explicit [source-name] [url]
poetry add --source [source-name] [packages]
Install dependencies inside virtual environment, in sync with poetry.lock:
poetry install --sync
Sync poetry.lock with pyproject.toml:
poetry lock --no-update
Recreate virtual environment:
poetry env remove $(which python)
poetry install
Recreate dependency graph (poetry.lock):
rm poetry.lock
poetry lock
Show dependency graph:
poetry show --tree
Rename main module:
pyproject.toml -> tool.poetry -> name
poetry shell
poetry update
poetry install --sync
Install local dependency in editable-mode:
poetry add --editable ../my-package/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment