Python · Poetry Project Notes

Mar 22, 2025 | Tech Software

Some brief notes for quick reference.

Poetry project folder structure.

Contents in pyproject.toml, a project setup example.

  • It can be created manually or generated via poetry init, and updated by poetry add xyz or poetry version x.x.x.
  • For the difference between [tool.poetry] and [project], see this post.

Contents in my_hello.py, an in-project module and function import example.

Contents in my_math.py, a thirdparty module import path example.

Setup, configuration, packaging, and operation commands.

  • Note that poetry creates and activates a virtual environment with for example poetry install, if you also explicitly activate another virtual environment by virtualenv or so, you may get warnings saying that some dependencies are found both in system and virtual environment path.

Environment commands, see also Poetry's official virtual environment notes .

  • To deactivate a poetry virtual environment, just close the shell session and open a new one.