Dependency Management

Note

You only have to work with Poetry commands if you want to change Python dependencies. The Nix development shell provides a working Python interpreter with all needed packages.

Python dependencies are managed by Poetry. We use poetry2nix to integrate Poetry with our Nix automation code. Changes in the Poetry dependencies specification are picked up by Nix on the next run. If you use the Lorri daemon, adding, updating or removing packages automatically rebuilds the development shell which provides a Python interpreter with the wanted Python packages.

Python package names and version constraints are listed in the [tool.poetry.dependencies] and [tool.poetry.dev-dependencies] sections of pyproject.toml.

Common Python packages for all applications are provided by ekklesia-common. To see what’s available, use poetry show ekklesia-common or have a look at pyproject.toml.

poetry show lists all packages that are pulled in directly or are dependencies of dependencies:

ekklesia-common is a Git dependency, so Poetry shows the version and the short Git commit id.

poetry update updates dependencies to their latest versions allowed by the version constraints.

poetry add <package> and poetry remove <package> should work as expected.

After changing dependencies, it’s a good idea to run nix-build to see if everything builds with Nix. Using lorri daemon also helps finding problems. Some “exotic” packages need further help to build with Nix. Problems can be caused by build dependencies that are not recognized automatically by poetry2nix. In this case, the overrides in deps.nix must be changed. We already have some examples of doing that. Poetry2nix provides a lot of common overrides so most popular packages should just work.