poetry init
starts setting up Dependency(for production) interativly.poetry shell
and poetry install
to install libraries.poetry add <package name>
installs package and add dependency in pyproject.tome automatically.After installing packages with pyproject.toml
, poetry writes packages with exact version on poetry.lock
. With poetry.lock
's presence, poetry installs packages of the exact version when the lock is generated, preventing unexpected changes in dependencies. It is convenient to share poetry.lock
to sync dependencies with project co-workers!
Since poetry builds venv at home directory not in the project, vscode interpreter can not detect the venv python.
Thus, command
poetry config virtualenvs.in-project true
poetry config virtualenvs.path "./.venv"
And by re-installing venv with poetry install
will creat .venv
at the root directory (in-project).