SH | Diensttagebuch

In the middle of the desert you can say anything you want

23 Nov 2021

211123-2348 poetry for package management

poetry new packagename creates a poetry project

From within the folder with the package:

  • poetry install == pip3 install -r requierements.txt
  • poetry shell == source .venv/bin/activate
  • exit == deactivate

Basic usage | Documentation | Poetry - Python dependency management and packaging made easy:

  • venvs live in {cache-dir}/virtualenvs, which on my box is /home/me/.cache/pypoetry/virtualenvs/ptest-eeSDLvcF-py3.6/bin/activate
  • poetry.lock caches the resolved packages once we install things once.
    • Must mach pyproject.toml, a warning will be shown otherwise
    • It’s important to commit it to a VCS! It has the exact versions it resolves, beneficial for everyone to use them
  • poetry update updates everything to the latest versions, overwriting poetry.lock
  • poetry init initializes a project and creates a pyproject.toml interactively, allowing even to search for packages etc!

Adding packages:

  • poetry add yaml adds a package
  • poetry search yaml looks for packages in remote repos! Will tell you that you actually want pyyaml
Nel mezzo del deserto posso dire tutto quello che voglio.