From da06df3ad58790810afd83ccd8e9922327028b6b Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Tue, 15 Apr 2025 13:08:44 +0800 Subject: [PATCH] Bump minimum supported version to contextily>=1.5 --- .github/workflows/ci_tests_legacy.yaml | 2 +- environment.yml | 2 +- pygmt/datasets/tile_map.py | 15 +-------------- pygmt/src/tilemap.py | 4 ---- pyproject.toml | 2 +- 5 files changed, 4 insertions(+), 21 deletions(-) diff --git a/.github/workflows/ci_tests_legacy.yaml b/.github/workflows/ci_tests_legacy.yaml index 770c1263cc5..7841a9ac77a 100644 --- a/.github/workflows/ci_tests_legacy.yaml +++ b/.github/workflows/ci_tests_legacy.yaml @@ -66,7 +66,7 @@ jobs: xarray netCDF4 packaging - contextily + contextily=1.5 geopandas=1.0 ipython pyarrow-core diff --git a/environment.yml b/environment.yml index 5218db6f48e..be4b4841761 100644 --- a/environment.yml +++ b/environment.yml @@ -13,7 +13,7 @@ dependencies: - netCDF4 - packaging # Optional dependencies - - contextily + - contextily>=1.5 - geopandas>=1.0 - ipython - pyarrow-core diff --git a/pygmt/datasets/tile_map.py b/pygmt/datasets/tile_map.py index caa18dacd84..08520396099 100644 --- a/pygmt/datasets/tile_map.py +++ b/pygmt/datasets/tile_map.py @@ -6,8 +6,6 @@ from collections.abc import Sequence from typing import Literal -from packaging.version import Version - try: import contextily from rasterio.crs import CRS @@ -100,9 +98,6 @@ def load_tile_map( The amount to adjust a chosen zoom level if it is chosen automatically. Values outside of -1 to 1 are not recommended as they can lead to slow execution. - .. note:: - The ``zoom_adjust`` parameter requires ``contextily>=1.5.0``. - Returns ------- raster @@ -165,16 +160,8 @@ def load_tile_map( "ll": lonlat, "wait": wait, "max_retries": max_retries, + "zoom_adjust": zoom_adjust, } - # TODO(contextily>=1.5.0): Remove the check for the 'zoom_adjust' parameter. - if zoom_adjust is not None: - if Version(contextily.__version__) < Version("1.5.0"): - msg = ( - "The `zoom_adjust` parameter requires `contextily>=1.5.0` to work. " - "Please upgrade contextily, or manually set the `zoom` level instead." - ) - raise ValueError(msg) - contextily_kwargs["zoom_adjust"] = zoom_adjust west, east, south, north = region image, extent = contextily.bounds2img( diff --git a/pygmt/src/tilemap.py b/pygmt/src/tilemap.py index 0748c83a2c9..b2b727ea287 100644 --- a/pygmt/src/tilemap.py +++ b/pygmt/src/tilemap.py @@ -102,10 +102,6 @@ def tilemap( zoom_adjust The amount to adjust a chosen zoom level if it is chosen automatically. Values outside of -1 to 1 are not recommended as they can lead to slow execution. - - .. note:: - The ``zoom_adjust`` parameter requires ``contextily>=1.5.0``. - kwargs : dict Extra keyword arguments to pass to :meth:`pygmt.Figure.grdimage`. """ diff --git a/pyproject.toml b/pyproject.toml index 55fc8424163..53f968c9537 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -45,7 +45,7 @@ dynamic = ["version"] [project.optional-dependencies] all = [ - "contextily", + "contextily>=1.5", "geopandas>=1.0", "IPython", # 'ipython' is not the correct module name. "pyarrow",