Managing Python Dependencies

The pyproject.toml file is the standard for configuring python projects.

Your codebase is already setup to manage dependencies using a pyproject.toml, which is used to generate the requirements.txt file using pip-tools. To update python dependencies:

  1. Update pyproject.toml file
  2. Generate requirements.txt file

Update pyproject.toml

  • Open the pyproject.toml file
  • Add new libraries to the dependencies section.

Update requirements.txt

You can generate requirements.txt file using a helper script or by using pip-compile directly

./scripts/upgrade.sh

Rebuild Images

After updating the requirements.txt file, remember to rebuild your images.

Rebuild dev images

phi ws up --env dev --config docker --type image

Rebuild production images

phi ws up --env prd --config docker --type image