pygmt icon indicating copy to clipboard operation
pygmt copied to clipboard

Allow brave users to run PyGMT with old GMT versions?

Open seisman opened this issue 3 years ago • 5 comments

Currently, the minimum required GMT version is 6.3.0 and it's likely that we will bump the minimum required GMT to 6.4.0 in the next few days (#1989).

After bumping to GMT>=6.4.0, users who use old GMT versions (e.g., GMT 6.3.0) won't be able to use future PyGMT versions unless they upgrade their GMT. Since most PyGMT functions still work with GMT 6.3.0, perhaps we should still allow users to run PyGMT with old GMT versions?

Currently, we raise an error and destroy the session:

https://github.com/GenericMappingTools/pygmt/blob/edee1c4f9eec0594ce2a8efd749400e7768329e4/pygmt/clib/session.py#L191-L196

Instead, we can raise a warning like

PyGMT requires GMT 6.4.0 but you're using GMT x.x.x. Some functions may not work as expected. It's recommended to upgrade your GMT to >=6.4.0. Otherwise, use it at your own risk.

seisman avatar Jul 05 '22 15:07 seisman

Ping @GenericMappingTools/pygmt-maintainers for thoughts on this.

seisman avatar Jul 11 '22 05:07 seisman

I agree with raising a warning rather than an error for most non-supported versions. However, we should raise an error if the version is truly not compatible (e.g., GMT 5).

maxrjones avatar Jul 11 '22 14:07 maxrjones

Yes, I think the GMT 6.x series has gotten stable and reliable enough since 6.3.0, so we could allow for the next PyGMT version to run 6.3.0/6.4.0+ (though we did say we'll drop 6.3.0 in https://forum.generic-mapping-tools.org/t/pygmt-v0-7-0-released/3085, but hopefully nobody notices).

Just to clarify, this means that our CI will be using 6.4.0+, and there won't be any support or testing on GMT 6.3.0 correct?

weiji14 avatar Jul 11 '22 17:07 weiji14

this means that our CI will be using 6.4.0+,

Yes.

and there won't be any support or testing on GMT 6.3.0 correct?

I think we still need to test old GMT versions like GMT 6.3.0. We definitely can't run the full tests, because baselines images may change a lot among different GMT versions due to tiny upstream changes in gridlines or frames. Instead, we should at least test the core clib functions test_clib_*.py to make sure that loading the GMT library and passing data (vectors, matrix, strings) to GMT API still work as expected for old versions.

seisman avatar Jul 15 '22 08:07 seisman

I think we still need to test old GMT versions like GMT 6.3.0. We definitely can't run the full tests, because baselines images may change a lot among different GMT versions due to tiny upstream changes in gridlines or frames. Instead, we should at least test the core clib functions test_clib_*.py to make sure that loading the GMT library and passing data (vectors, matrix, strings) to GMT API still work as expected for old versions.

PYGMT_USE_EXTERNAL_DISPLAY="false" pytest -m "not mpl_image_compare" pygmt

Using pytest -m "not mpl_image_compare" can skip all tests that have the @pytest.mark.mpl_image_compare decorator. Perhaps this is a better option to test old GMT versions.

seisman avatar Jul 16 '22 10:07 seisman

Another simple way is running pytest without the --mpl option. In this way, all images are still generated (so we know they don't crash), but pytest doesn't do the image comparisons.

seisman avatar Aug 23 '22 15:08 seisman