FEniCS / dolfinx

Next generation FEniCS problem solving environment
https://fenicsproject.org
GNU Lesser General Public License v3.0
699 stars 172 forks source link

Dockerfiles should use pyproject.toml to install optional dependencies #3135

Open jhale opened 2 months ago

jhale commented 2 months ago

Describe new/missing feature

We currently attempt to include optional dependencies in our pyproject.toml file

https://github.com/FEniCS/dolfinx/blob/main/python/pyproject.toml

But this remains untested as the CI image builds manually type optional dependencies

https://github.com/FEniCS/dolfinx/blob/main/docker/Dockerfile.test-env#L156

There is some discussion of this issue here with respect to adding e.g. --only-deps option to pip install: https://github.com/pypa/pip/issues/11440

Suggested user interface

Not applicable.

jhale commented 2 months ago

pip-tools seems to have support for creating requirements.txt files that can then be fed into pip.

https://github.com/jazzband/pip-tools

garth-wells commented 2 months ago

How about we slim down the images and let the CI runner install Python optional dependencies, documentation dependencies, etc. This makes testing, pinning and un-pinning versions much easier

francesco-ballarin commented 2 months ago

How about we slim down the images and let the CI runner install Python optional dependencies, documentation dependencies, etc. This makes testing, pinning and un-pinning versions much easier

:+1::+1::+1:

The only possible downside I see is that, if pinning was required, one would have to do that several times, for instance:

jhale commented 2 months ago

@francesco-ballarin The pyproject.toml would be the single source for specifying light Python optional requirements. We're already doing this in e.g. Basix and it works well see e.g. https://github.com/FEniCS/basix/blob/main/.github/workflows/pythonapp.yml#L42 https://github.com/FEniCS/basix/blob/main/pyproject.toml#L28

petsc4py, mpi4py and numpy and the other heavy packages will be built inside the Dockerfile as they are now.