Pin numpy<2 in ci_tests_legacy.yaml #3641
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of proposed changes
The
ci_test_legacy.yamlGitHub workflow has been failing since last month with a TypeError, e.g. at https://github.com/GenericMappingTools/pygmt/actions/runs/11450983970/job/31859442362#step:6:1474:___________________ test_geopandas_plot3d_non_default_circle ___________________ args = (), kwargs = {} def wrapper(*args, **kwargs): > store.return_value[test_name] = obj(*args, **kwargs) ../../../../micromamba/envs/pygmt/lib/python3.10/site-packages/pytest_mpl/plugin.py:125: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../pygmt/tests/test_geopandas.py:145: in test_geopandas_plot3d_non_default_circle multipoint = shapely.geometry.MultiPoint([(0.5, 0.5, 0.5), (1.5, 1.5, 1.5)]) ../../../../micromamba/envs/pygmt/lib/python3.10/site-packages/shapely/geometry/multipoint.py:62: in __new__ return shapely.multipoints(subs) ../../../../micromamba/envs/pygmt/lib/python3.10/site-packages/shapely/decorators.py:77: in wrapped return func(*args, **kwargs) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ geometries = array([<POINT Z (0.5 0.5 0.5)>, <POINT Z (1.5 1.5 1.5)>], dtype=object) indices = None, out = None, kwargs = {}, typ = <GeometryType.MULTIPOINT: 4> @multithreading_enabled def multipoints(geometries, indices=None, out=None, **kwargs): """Create multipoints from arrays of points Parameters ---------- geometries : array_like An array of points or coordinates (see points). indices : array_like, optional Indices into the target array where input geometries belong. If provided, both geometries and indices should be 1D and have matching sizes. Indices should be in increasing order. Missing indices result in a ValueError unless ``out`` is provided, in which case the original value in ``out`` is kept. out : ndarray, optional An array (with dtype object) to output the geometries into. **kwargs See :ref:`NumPy ufunc docs <ufuncs.kwargs>` for other keyword arguments. Ignored if ``indices`` is provided. Examples -------- Multipoints are constructed from points: >>> point_1 = points([1, 1]) >>> point_2 = points([2, 2]) >>> multipoints([point_1, point_2]) <MULTIPOINT (1 1, 2 2)> >>> multipoints([[point_1, point_2], [point_2, None]]).tolist() [<MULTIPOINT (1 1, 2 2)>, <MULTIPOINT (2 2)>] Or from coordinates directly: >>> multipoints([[0, 0], [2, 2], [3, 3]]) <MULTIPOINT (0 0, 2 2, 3 3)> Multiple multipoints of different sizes can be constructed efficiently using the ``indices`` keyword argument: >>> multipoints([point_1, point_2, point_2], indices=[0, 0, 1]).tolist() [<MULTIPOINT (1 1, 2 2)>, <MULTIPOINT (2 2)>] Missing input values (``None``) are ignored and may result in an empty multipoint: >>> multipoints([None]) <MULTIPOINT EMPTY> >>> multipoints([point_1, None], indices=[0, 0]).tolist() [<MULTIPOINT (1 1)>] >>> multipoints([point_1, None], indices=[0, 1]).tolist() [<MULTIPOINT (1 1)>, <MULTIPOINT EMPTY>] """ typ = GeometryType.MULTIPOINT geometries = np.asarray(geometries) if not isinstance(geometries, Geometry) and np.issubdtype( geometries.dtype, np.number ): geometries = points(geometries) if indices is None: > return lib.create_collection(geometries, typ, out=out, **kwargs) E TypeError: ufunc 'create_collection' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''The solution upstream at shapely shapely/shapely#2098 is to upgrade to shapely 2.0.6 to deal with the incompatibilty with numpy 2.1. But I think we should just test on
numpy<2since the legacy tests are meant to test old versions.Also, I've cherry-picked commit 1263075 from #3639 here so that the terminal outputs for the legacy tests are colored (as per #3330).
Fixes #
Preview:
Reminders
make formatandmake checkto make sure the code follows the style guide.doc/api/index.rst.Slash Commands
You can write slash commands (
/command) in the first line of a comment to performspecific operations. Supported slash command is:
/format: automatically format and lint the code