Skip to content

Commit

Permalink
Update minimum package dependencies (geopandas#3001)
Browse files Browse the repository at this point in the history
Co-authored-by: Joris Van den Bossche <jorisvandenbossche@gmail.com>
  • Loading branch information
2 people authored and JohnMoutafis committed Nov 16, 2023
1 parent 6ba2d4d commit 5d80d0d
Show file tree
Hide file tree
Showing 29 changed files with 83 additions and 183 deletions.
19 changes: 10 additions & 9 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,33 +35,33 @@ jobs:
postgis: [false]
dev: [false]
env:
- ci/envs/38-minimal.yaml
- ci/envs/39-minimal.yaml
- ci/envs/39-no-optional-deps.yaml
# - ci/envs/38-pd12-defaults.yaml
# - ci/envs/38-latest-defaults.yaml
- ci/envs/38-latest-conda-forge.yaml
- ci/envs/39-pd13-conda-forge.yaml
- ci/envs/39-pd15-defaults.yaml
- ci/envs/39-latest-defaults.yaml
- ci/envs/39-latest-conda-forge.yaml
- ci/envs/39-latest-conda-forge_no_fiona.yaml
- ci/envs/310-pd20-conda-forge.yaml
- ci/envs/310-latest-conda-forge.yaml
- ci/envs/311-latest-conda-forge.yaml
include:
- env: ci/envs/38-latest-conda-forge.yaml
- env: ci/envs/39-latest-conda-forge_no_fiona.yaml
os: macos-latest
postgis: false
dev: false
- env: ci/envs/39-latest-conda-forge.yaml
os: macos-latest
postgis: false
dev: false
- env: ci/envs/38-latest-conda-forge.yaml
- env: ci/envs/39-latest-conda-forge_no_fiona.yaml
os: windows-latest
postgis: false
dev: false
- env: ci/envs/39-latest-conda-forge.yaml
os: windows-latest
postgis: false
dev: false
- env: ci/envs/310-dev.yaml
- env: ci/envs/311-dev.yaml
os: ubuntu-latest
dev: true

Expand Down Expand Up @@ -104,7 +104,8 @@ jobs:
pytest -v -r a -n auto --color=yes --cov=geopandas --cov-append --cov-report term-missing --cov-report xml geopandas/
- name: Test with PostGIS
if: (contains(matrix.env, '39-pd13-conda-forge.yaml') || contains(matrix.env, '311-latest-conda-forge.yaml')) && contains(matrix.os, 'ubuntu')
if: (contains(matrix.env, '310-pd20-conda-forge.yaml') || contains(matrix.env, '311-latest-conda-forge.yaml'))
&& contains(matrix.os, 'ubuntu')
env:
PGUSER: postgres
PGPASSWORD: postgres
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ Bug fixes:
data in the geometry column (#2959)
- Properly infer schema for np.int32 and pd.Int32Dtype columns (#2950)

Notes on (optional) dependencies:

- GeoPandas 0.14 drops support for Python 3.8 and pandas 1.3 and below (the minimum
supported pandas version is now 1.4). Further, the minimum required versions for the
listed dependencies have now changed to shapely 1.8.0, fiona 1.8.21, pyproj 3.3.0 and
matplotlib 3.5.0 (#3001)

## Version 0.13.2 (Jun 6, 2023)

Bug fix:
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ is a great way to get started if you'd like to make a contribution.
Style
-----

- GeoPandas supports Python 3.8+ only. The last version of GeoPandas
- GeoPandas supports Python 3.9+ only. The last version of GeoPandas
supporting Python 2 is 0.6.

- GeoPandas follows [the PEP 8
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ name: test
channels:
- conda-forge
dependencies:
- python=3.9
- python=3.10
# required
- pandas=1.3
- numpy=1.21 # released 1 month before pandas 1.3
- pandas=2.0
- numpy=1.24 # released 4 months before pandas 2.0
- shapely
- fiona
- pyproj
Expand Down
2 changes: 1 addition & 1 deletion ci/envs/310-dev.yaml → ci/envs/311-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: test
channels:
- conda-forge
dependencies:
- python=3.10
- python=3.11
- cython
# required
- numpy
Expand Down
2 changes: 1 addition & 1 deletion ci/envs/39-latest-conda-forge.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ channels:
dependencies:
- python=3.9
# required
- pandas=1.4
- pandas=1.5
- shapely=2
- geos
- cython
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: test
channels:
- conda-forge
dependencies:
- python=3.8
- python=3.9
# required
- pandas
- shapely
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ name: test
channels:
- defaults
dependencies:
- python=3.8
- python=3.9
# required
- numpy
- pandas
- shapely
- fiona
- pyproj>=3
- pyproj>=3.3.0
- geos
- packaging
# testing
Expand Down
14 changes: 7 additions & 7 deletions ci/envs/38-minimal.yaml → ci/envs/39-minimal.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ name: test
channels:
- conda-forge
dependencies:
- python=3.8
- python=3.9
# required
- numpy=1.20
- pandas=1.1
- shapely=1.7.1
- fiona=1.8.18
- pyproj=3.0.1
- numpy=1.22
- pandas=1.4
- shapely=1.8.0
- fiona=1.8.21
- pyproj=3.3.0
- packaging
# testing
- pytest
Expand All @@ -17,7 +17,7 @@ dependencies:
- fsspec
# optional
- rtree
- matplotlib=3.3.4
- matplotlib=3.5.0
- mapclassify=2.4.0
- geopy
- SQLalchemy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@ name: test
channels:
- defaults
dependencies:
- python=3.8
- python=3.9
# required
- pandas=1.2
- pandas=1.5
- shapely
- fiona
- numpy=<1.22
- pyproj=3.1.0
#- pyproj
- numpy=1.23
- pyproj>=3.3.0
- geos
- packaging
# testing
Expand Down
2 changes: 1 addition & 1 deletion doc/source/community/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ In particular, when submitting a pull request:
imports when possible, and explicit relative imports for local
imports when necessary in tests.

- GeoPandas supports Python 3.8+ only. The last version of GeoPandas
- GeoPandas supports Python 3.9+ only. The last version of GeoPandas
supporting Python 2 is 0.6.

- Unless your PR implements minor changes or internal work only, make sure
Expand Down
10 changes: 5 additions & 5 deletions doc/source/getting_started/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,10 @@ Dependencies
Required dependencies:

- `numpy`_
- `pandas`_ (version 1.1 or later)
- `shapely`_ (interface to `GEOS`_; version 1.7.1 or later)
- `fiona`_ (interface to `GDAL`_; version 1.8.19 or later)
- `pyproj`_ (interface to `PROJ`_; version 3.0.1 or later)
- `pandas`_ (version 1.4 or later)
- `shapely`_ (interface to `GEOS`_; version 1.8.0 or later)
- `fiona`_ (interface to `GDAL`_; version 1.8.21 or later)
- `pyproj`_ (interface to `PROJ`_; version 3.3.0 or later)
- `packaging`_

Further, optional dependencies are:
Expand All @@ -155,7 +155,7 @@ Further, optional dependencies are:

For plotting, these additional packages may be used:

- `matplotlib`_ (>= 3.3.4)
- `matplotlib`_ (>= 3.5.0)
- `mapclassify`_ (>= 2.4.0)


Expand Down
10 changes: 5 additions & 5 deletions environment-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ channels:
dependencies:
- python
# required
- fiona>=1.8.19
- pandas>=1.1.0
- fiona>=1.8.21
- pandas>=1.3.0
- pygeos
- pyproj>=3.0.1
- shapely>=1.7.1
- pyproj>=3.3.0
- shapely>=1.8.0
- packaging

# testing
Expand Down Expand Up @@ -36,7 +36,7 @@ dependencies:
- psycopg2>=2.8.0
- SQLAlchemy>=1.3
# plotting
- matplotlib>=3.2
- matplotlib>=3.5
- mapclassify
# spatial access methods
- rtree>=0.9
Expand Down
8 changes: 0 additions & 8 deletions geopandas/_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

import numpy as np
import pandas as pd
import pyproj
import shapely
import shapely.geos

Expand All @@ -15,9 +14,6 @@
# pandas compat
# -----------------------------------------------------------------------------

PANDAS_GE_115 = Version(pd.__version__) >= Version("1.1.5")
PANDAS_GE_12 = Version(pd.__version__) >= Version("1.2.0")
PANDAS_GE_13 = Version(pd.__version__) >= Version("1.3.0")
PANDAS_GE_14 = Version(pd.__version__) >= Version("1.4.0rc0")
PANDAS_GE_15 = Version(pd.__version__) >= Version("1.5.0")
PANDAS_GE_20 = Version(pd.__version__) >= Version("2.0.0")
Expand All @@ -29,7 +25,6 @@
# -----------------------------------------------------------------------------


SHAPELY_GE_18 = Version(shapely.__version__) >= Version("1.8")
SHAPELY_GE_182 = Version(shapely.__version__) >= Version("1.8.2")
SHAPELY_GE_20 = Version(shapely.__version__) >= Version("2.0.0.dev0")
SHAPELY_G_20a1 = Version(shapely.__version__) > Version("2.0a1")
Expand Down Expand Up @@ -253,6 +248,3 @@ def import_optional_dependency(name: str, extra: str = ""):
# -----------------------------------------------------------------------------
# pyproj compat
# -----------------------------------------------------------------------------

PYPROJ_GE_31 = Version(pyproj.__version__) >= Version("3.1")
PYPROJ_GE_32 = Version(pyproj.__version__) >= Version("3.2")
13 changes: 1 addition & 12 deletions geopandas/_vectorized.py
Original file line number Diff line number Diff line change
Expand Up @@ -1110,16 +1110,10 @@ def normalize(data):
return shapely.normalize(data)
elif compat.USE_PYGEOS:
return pygeos.normalize(data)
elif compat.SHAPELY_GE_18:
out = np.empty(len(data), dtype=object)
with compat.ignore_shapely2_warnings():
out[:] = [geom.normalize() if geom is not None else None for geom in data]
else:
out = np.empty(len(data), dtype=object)
with compat.ignore_shapely2_warnings():
out[:] = [
_shapely_normalize(geom) if geom is not None else None for geom in data
]
out[:] = [geom.normalize() if geom is not None else None for geom in data]
return out


Expand All @@ -1128,11 +1122,6 @@ def make_valid(data):
return shapely.make_valid(data)
elif compat.USE_PYGEOS:
return pygeos.make_valid(data)
elif not compat.SHAPELY_GE_18:
raise NotImplementedError(
f"shapely >= 1.8 or PyGEOS is required, "
f"version {shapely.__version__} is installed"
)
else:
out = np.empty(len(data), dtype=object)
with compat.ignore_shapely2_warnings():
Expand Down
42 changes: 16 additions & 26 deletions geopandas/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
import shapely.ops
import shapely.wkt
from pyproj import CRS, Transformer
from pyproj.aoi import AreaOfInterest
from pyproj.database import query_utm_crs_info

try:
import pygeos
Expand Down Expand Up @@ -894,11 +896,6 @@ def estimate_utm_crs(self, datum_name="WGS 84"):
- Ellipsoid: WGS 84
- Prime Meridian: Greenwich
"""
try:
from pyproj.aoi import AreaOfInterest
from pyproj.database import query_utm_crs_info
except ImportError:
raise RuntimeError("pyproj 3+ required for estimate_utm_crs.")

if not self.crs:
raise RuntimeError("crs must be set to estimate UTM CRS.")
Expand All @@ -910,28 +907,21 @@ def estimate_utm_crs(self, datum_name="WGS 84"):
# ensure using geographic coordinates
else:
transformer = TransformerFromCRS(self.crs, "EPSG:4326", always_xy=True)
if compat.PYPROJ_GE_31:
minx, miny, maxx, maxy = transformer.transform_bounds(
minx, miny, maxx, maxy
)
y_center = np.mean([miny, maxy])
# crossed the antimeridian
if minx > maxx:
# shift maxx from [-180,180] to [0,360]
# so both numbers are positive for center calculation
# Example: -175 to 185
maxx += 360
x_center = np.mean([minx, maxx])
# shift back to [-180,180]
x_center = ((x_center + 180) % 360) - 180
else:
x_center = np.mean([minx, maxx])
minx, miny, maxx, maxy = transformer.transform_bounds(
minx, miny, maxx, maxy
)
y_center = np.mean([miny, maxy])
# crossed the antimeridian
if minx > maxx:
# shift maxx from [-180,180] to [0,360]
# so both numbers are positive for center calculation
# Example: -175 to 185
maxx += 360
x_center = np.mean([minx, maxx])
# shift back to [-180,180]
x_center = ((x_center + 180) % 360) - 180
else:
lon, lat = transformer.transform(
(minx, maxx, minx, maxx), (miny, miny, maxy, maxy)
)
x_center = np.mean(lon)
y_center = np.mean(lat)
x_center = np.mean([minx, maxx])

utm_crs_list = query_utm_crs_info(
datum_name=datum_name,
Expand Down
9 changes: 1 addition & 8 deletions geopandas/geodataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@
from . import _compat as compat
from ._decorator import doc

if compat.SHAPELY_GE_18:
geometry_type_error = shapely.errors.GeometryTypeError
else:
geometry_type_error = ValueError


def _geodataframe_constructor_with_fallback(*args, **kwargs):
"""
Expand Down Expand Up @@ -1437,8 +1432,6 @@ def estimate_utm_crs(self, datum_name="WGS 84"):
.. versionadded:: 0.9
.. note:: Requires pyproj 3+
Parameters
----------
datum_name : str, optional
Expand Down Expand Up @@ -1622,7 +1615,7 @@ def apply(self, func, axis=0, raw=False, result_type=None, args=(), **kwargs):
# not enough info about func to preserve CRS
result = _ensure_geometry(result)

except (TypeError, geometry_type_error):
except (TypeError, shapely.errors.GeometryTypeError):
pass

return result
Expand Down

0 comments on commit 5d80d0d

Please sign in to comment.