python-bindings icon indicating copy to clipboard operation
python-bindings copied to clipboard

Check installed version of preCICE when import precice (python bindings)

Open BenjaminRodenberg opened this issue 2 years ago • 3 comments

I think it would be helpful to raise a warning, if the version of the python bindings does not match the installed preCICE version. Example: User updates preCICE from version 2.3 to version 2.5 but forgets to run pip3 install --upgrade pyprecice. This works, but might lead to strange errors, because the API is not up-to-date.

We could to the following:

>> import precice
<stdin>:1: UserWarning: You are using pyprecice 2.3.0.0, but it looks like you are using preCICE version 2.5.0. Please upgrade your python bindings by running pip3 install --upgrade pyprecice.

BenjaminRodenberg avatar Feb 16 '23 13:02 BenjaminRodenberg

Good idea! Although I think we should do such checks carefully. In principle pyprecice v2.3.0.0 should work with preCICE v2.5.0 as it is only a difference of minor versions. The API should not break between v2.3.0.0 and v2.5.0 right?

IshaanDesai avatar Feb 16 '23 14:02 IshaanDesai

You can use python bindings v2.3.0.0 with preCICE v2.5.0, but you will miss some features that might exist in preCICE v2.5.0 if there was no corresponding API already in python bindings v2.3.0.0. For example, the waveform API was only introduced in v2.5.0.2 (see #167). This leads to confusing errors, if a user has upgraded to preCICE v2.5.0 and wants to use a feature from that version but there is no support in the python bindings. Therefore, a warning, not an error :smirk:

BenjaminRodenberg avatar Feb 17 '23 07:02 BenjaminRodenberg