Introduction to Poetry

SHIN·2023년 1월 25일
0

Poetry's advantage

  1. Easy to manage packages for eash projects. (in a deterministic way)
  2. Easy to build and package projects.
  3. Easy to publish work.
  4. Easy to check dependencies.

Project init

  • poetry init starts setting up Dependency(for production) interativly.
  • setting saved on pyproject.toml

    Able to set Development dependency seperatly.

    pyproject.toml

Poetry install

  • Activate virtual environment by poetry shell and poetry install to install libraries.
  • To add packages, poetry add <package name> installs package and add dependency in pyproject.tome automatically.

poetry.lock

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!

VScode

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).

profile
HAPPY the cat

1개의 댓글

comment-user-thumbnail
2025년 7월 16일

If you're someone who enjoys bold expression through words, attitude shayari is a great way to channel that vibe. It blends confidence with poetic flair, often leaving a lasting impression. Want to dive deeper into this unique style? Click to learn more about attitude shayari and how it captures powerful emotions with style.
https://attitudeshayar.com/

답글 달기