Skip to content

Refactor python package installation

What does this MR do?

This MR is a refactor of the CMake function dune_python_install_package. The function has many responsibilities that conflict with the initial intention of the function but are needed to properly configure the python bindings. So in this MR we (@andreas.dedner, @samuel.burbulla, and @santiago.ospina) identify such responsibilities and split them into separate functions. That is:

  • dune_python_configure_dependencies: Installs dependencies at configure time for a project with a setup.py file. This is done by extracting a requirements file and installing them explicitely.
  • dune_link_dune_py: Create the metadata in the python package. This function effectively glues a python package with the dune-py project running the bindings. Additionally, it provides a setup.py if none is given (a typical use case of dune bindings).
  • dune_python_configure_package: Configures dependencies (with dune_python_configure_dependencies) and installs a project having a setup.py at configure time (notice that we opted to include !1103 (closed) directly here). Package installation is done without internet since the package is available locally and dependencies have been already fulfilled.
  • dune_python_configure_bindings: Combines dune_python_configure_package and dune_link_dune_py for easy set-up of the dune python bindings.
  • dune_python_install_package: Legacy command for installing packages. Should be deprecated in favor of dune_python_configure_package and dune_python_configure_bindings.

What does this MR solves?

With the current state, only one python package can be configured/installed with this function, namely, the dune python bindings. This was not the initial intention of the function and conflicts with other use cases on downstream projects before Dune 2.8. So, this refactor, allows to pick the correct use-case of the python package and keep both intended uses available.

  • Add CHANGELOG entry

Closes #310 (closed)

Edited by Santiago Ospina De Los Ríos

Merge request reports