Poetry

Python packaging and dependency management made easy.

# Install solution and dependencies
$ poetry install

# Install dependencies only
$ poetry install --no-root

# Add depencency
$ poetry add pendulum

# Update dependencies to latest versions
$ poetry update

# Run cmd in poetry virtual environment
$ poetry run python your_script.py
$ poetry run pytest

Notes:

Poetry will try to find a common version of a dependency across all specified Python versions.

EX: we put python=”*” in pyproject.py and it installed a very old version, presumably 2.7 compliant, of a depencency that wouldn’t work with our installed environment.

Edit pyproject.toml to enable pip install -e .

[build-system]
requires = ["poetry-core>=1.0.8"]
build-backend = "poetry.core.masonry.api"

References:

  1. Poetry - Docs

  2. Poetry - pyproject.toml

  3. Clarifying PEP 518 (a.k.a. pyproject.toml)

  4. What the heck is pyproject.toml?

  5. pip install -e . equivalent