ecmwf / fckit

A Fortran toolkit for interoperating Fortran with C/C++
https://confluence.ecmwf.int/display/fckit
Apache License 2.0
29 stars 15 forks source link

Install python virtual environment with contributed ruamel.yaml #39

Closed awnawab closed 3 months ago

awnawab commented 5 months ago

This PR contributes the installation of a python virtual environment that contains the contributed fypp and ruamel.yaml modules. A minimal fckit_yaml_reader module is also installed that creates an API consistent with the pyyaml yaml.safe_load and yaml.dump functions. The aim is to provide yaml parsing functionality for offline builds of the ifs-bundle and ecwam-bundle. Downstream projects will therefore rely on either pyyaml+fypp or fckit.

I have tested the fckit_yaml_reader with ecwam, as a bundle build and as an externally built or installed project. I have also run the downstream_fypp tests by compiling with eckit.

wdeconinck commented 5 months ago

It looks like we need to support CMake 3.18

awnawab commented 5 months ago

I've downgraded the minimum cmake to 3.17 and the minimum python to 3.6. This should fix the tests for everything except for the ubuntu gnu@ubuntu-22.04 tests. This runner seems to have a very barebones python installation:

  The virtual environment was not created successfully because ensurepip is not
  available.  On Debian/Ubuntu systems, you need to install the python3-venv
  package using the following command.

      apt install python3.10-venv

I think to fix this error we will have to update to the runner config.

awnawab commented 5 months ago

As discussed offline, I've made the build and installation of the python virtual environment optional. This defaults to off, and if left disabled then we just install the fypp runner script like we used to.

The python virtual environment can only be enabled if python >= 3.8 is found. For most of the downstream tests this wasn't the case. The gnu@fedora-37 runners did however have a more up-to-date python installation. If possible, it would be great to configure these CI tests with the option -DENABLE_FCKIT_VENV=ON to have CI test coverage of the virtual environment.

codecov-commenter commented 3 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 50.77%. Comparing base (f44d3f9) to head (a18d4f0). Report is 5 commits behind head on develop.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## develop #39 +/- ## =========================================== - Coverage 53.34% 50.77% -2.58% =========================================== Files 54 55 +1 Lines 4508 4739 +231 Branches 0 450 +450 =========================================== + Hits 2405 2406 +1 - Misses 2103 2333 +230 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.