Skip to content

Commit 8f41204

Browse files
authored
remove support for Python 3.10 - #691 (#694)
* remove support for Python 3.10 - #691 * SPEC000 * remove outdated version checks
1 parent 03641ad commit 8f41204

20 files changed

+50
-230
lines changed

.github/workflows/tests.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ jobs:
3131
matrix:
3232
os: [ubuntu-latest]
3333
environment-file:
34-
- ci/envs/310-oldest.yaml
35-
- ci/envs/310-latest.yaml
34+
- ci/envs/311-oldest.yaml
3635
- ci/envs/311-latest.yaml
3736
- ci/envs/312-latest.yaml
3837
- ci/envs/313-latest.yaml

ci/envs/310-latest.yaml

Lines changed: 0 additions & 22 deletions
This file was deleted.

ci/envs/310-oldest.yaml renamed to ci/envs/311-oldest.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@ name: test
22
channels:
33
- conda-forge
44
dependencies:
5-
- python=3.10
6-
- geopandas=0.12
5+
- python=3.11
6+
- geopandas=0.14
77
- inequality
88
- libpysal=4.12.0
99
- mapclassify
10-
- networkx=2.8
11-
- numpy=1.24
10+
- networkx=3.2
11+
- numpy=1.25
1212
- packaging
13-
- pandas>=1.5.1,<2
13+
- pandas=2.0
1414
- shapely=2.0
15-
- tqdm=4.63.0
16-
- numba=0.57
17-
- fiona<1.10
15+
- tqdm=4.65
16+
- numba=0.58
17+
- fiona=1.10
1818
# testing
1919
- codecov
2020
- pytest

docs/environment.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ dependencies:
55
- python=3.13
66
- geopandas
77
- inequality
8-
- libpysal>=4.12.0
8+
- libpysal
99
- mapclassify
1010
- networkx
1111
- osmnx
1212
- packaging
13-
- pandas!=1.5.0
14-
- shapely>=2
13+
- pandas
14+
- shapely
1515
- esda
1616
- tqdm
1717
- numba

environment.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@ channels:
33
- conda-forge
44
dependencies:
55
- python
6-
- geopandas>=0.12.0
6+
- geopandas>=0.14.0
77
- inequality
88
- jupyter
99
- libpysal>=4.12.0
1010
- mapclassify
1111
- matplotlib
12-
- networkx>=2.8
12+
- networkx>=3.2
1313
- osmnx
14-
- pandas>=1.5.1
14+
- pandas>=2.0
1515
- shapely>=2
16-
- tqdm>=4.63.0
16+
- tqdm>=4.65
1717
- numba
1818
- esda

momepy/distribution.py

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,10 @@
66
import os
77
import warnings
88

9-
import geopandas as gpd
109
import networkx as nx
1110
import numpy as np
1211
import pandas as pd
1312
import shapely
14-
from packaging.version import Version
1513
from tqdm.auto import tqdm # progress bar
1614

1715
from .utils import _azimuth, deprecated, removed
@@ -30,8 +28,6 @@
3028
"Neighbors",
3129
]
3230

33-
GPD_GE_013 = Version(gpd.__version__) >= Version("0.13.0")
34-
3531

3632
@deprecated("orientation")
3733
class Orientation:
@@ -155,10 +151,7 @@ def __init__(self, gdf):
155151
)
156152
self.gdf = gdf
157153

158-
if GPD_GE_013:
159-
inp, res = gdf.sindex.query(gdf.geometry, predicate="intersects")
160-
else:
161-
inp, res = gdf.sindex.query_bulk(gdf.geometry, predicate="intersects")
154+
inp, res = gdf.sindex.query(gdf.geometry, predicate="intersects")
162155
left = gdf.geometry.take(inp).reset_index(drop=True)
163156
right = gdf.geometry.take(res).reset_index(drop=True)
164157
intersections = left.intersection(right).length
@@ -718,10 +711,7 @@ def __init__(self, gdf):
718711
self.gdf = gdf
719712
self.orientation = gdf.geometry.apply(self._orient)
720713

721-
if GPD_GE_013:
722-
inp, res = gdf.sindex.query(gdf.geometry, predicate="intersects")
723-
else:
724-
inp, res = gdf.sindex.query_bulk(gdf.geometry, predicate="intersects")
714+
inp, res = gdf.sindex.query(gdf.geometry, predicate="intersects")
725715
itself = inp == res
726716
inp = inp[~itself]
727717
res = res[~itself]

momepy/diversity.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import numpy as np
99
import pandas as pd
1010
import scipy as sp
11-
from numpy.lib import NumpyVersion
1211
from tqdm.auto import tqdm # progress bar
1312

1413
from .utils import deprecated, removed
@@ -902,10 +901,7 @@ def __init__(
902901
elif weighted is None:
903902
data = data.set_index(unique_id)[values]
904903

905-
if NumpyVersion(np.__version__) >= "1.22.0":
906-
method = {"method": interpolation}
907-
else:
908-
method = {"interpolation": interpolation}
904+
method = {"method": interpolation}
909905

910906
for index in tqdm(data.index, total=data.shape[0], disable=not verbose):
911907
if index in spatial_weights.neighbors:

momepy/elements.py

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
"get_network_ratio",
2828
]
2929

30-
GPD_GE_013 = Version(gpd.__version__) >= Version("0.13.0")
3130
GPD_GE_10 = Version(gpd.__version__) >= Version("1.0dev")
3231

3332

@@ -443,14 +442,7 @@ def _enclosed_tessellation(
443442
enclosures["position"] = range(len(enclosures))
444443

445444
# determine which polygons should be split
446-
if GPD_GE_013:
447-
inp, res = buildings.sindex.query(
448-
enclosures.geometry, predicate="intersects"
449-
)
450-
else:
451-
inp, res = buildings.sindex.query_bulk(
452-
enclosures.geometry, predicate="intersects"
453-
)
445+
inp, res = buildings.sindex.query(enclosures.geometry, predicate="intersects")
454446
unique, counts = np.unique(inp, return_counts=True)
455447
splits = unique[counts > 1]
456448
single = unique[counts == 1]
@@ -1003,14 +995,7 @@ def enclosures(
1003995
)
1004996
additional = pd.concat([gdf.geometry for gdf in additional_barriers])
1005997

1006-
if GPD_GE_013:
1007-
inp, res = enclosures.sindex.query(
1008-
additional.geometry, predicate="intersects"
1009-
)
1010-
else:
1011-
inp, res = enclosures.sindex.query_bulk(
1012-
additional.geometry, predicate="intersects"
1013-
)
998+
inp, res = enclosures.sindex.query(additional.geometry, predicate="intersects")
1014999
unique = np.unique(res)
10151000

10161001
new = []
@@ -1053,14 +1038,9 @@ def enclosures(
10531038
"`limit` requires a GeoDataFrame or GeoSeries with Polygon or "
10541039
"MultiPolygon geometry to be used with `clip=True`."
10551040
)
1056-
if GPD_GE_013:
1057-
_, encl_index = final_enclosures.representative_point().sindex.query(
1058-
limit.geometry, predicate="contains"
1059-
)
1060-
else:
1061-
_, encl_index = final_enclosures.representative_point().sindex.query_bulk(
1062-
limit.geometry, predicate="contains"
1063-
)
1041+
_, encl_index = final_enclosures.representative_point().sindex.query(
1042+
limit.geometry, predicate="contains"
1043+
)
10641044
keep = np.unique(encl_index)
10651045
return final_enclosures.iloc[keep]
10661046

momepy/functional/_distribution.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
import geopandas as gpd
21
import numpy as np
32
import shapely
43
from geopandas import GeoDataFrame, GeoSeries
54
from libpysal.graph import Graph
65
from numpy.typing import NDArray
7-
from packaging.version import Version
86
from pandas import Series
97
from scipy import sparse
108

@@ -20,8 +18,6 @@
2018
"cell_alignment",
2119
]
2220

23-
GPD_GE_013 = Version(gpd.__version__) >= Version("0.13.0")
24-
2521

2622
def orientation(geometry: GeoDataFrame | GeoSeries) -> Series:
2723
"""Calculate the orientation of objects.
@@ -140,10 +136,7 @@ def shared_walls(
140136
geometry = geometry.buffer(tolerance)
141137
predicate = "intersects"
142138

143-
if GPD_GE_013:
144-
inp, res = geometry.sindex.query(geometry.geometry, predicate=predicate)
145-
else:
146-
inp, res = geometry.sindex.query_bulk(geometry.geometry, predicate=predicate)
139+
inp, res = geometry.sindex.query(geometry.geometry, predicate=predicate)
147140

148141
mask = inp != res
149142
inp, res = inp[mask], res[mask]

momepy/functional/_elements.py

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import warnings
22

33
import geopandas as gpd
4-
import libpysal
54
import numpy as np
65
import pandas as pd
76
import shapely
@@ -12,9 +11,7 @@
1211
from packaging.version import Version
1312
from pandas import MultiIndex, Series
1413

15-
GPD_GE_013 = Version(gpd.__version__) >= Version("0.13.0")
1614
GPD_GE_10 = Version(gpd.__version__) >= Version("1.0dev")
17-
LPS_GE_411 = Version(libpysal.__version__) >= Version("4.11.dev")
1815
SHPLY_GE_210 = Version(shapely.__version__) >= Version("2.1.0")
1916

2017
__all__ = [
@@ -260,12 +257,7 @@ def enclosed_tessellation(
260257
enclosures[index_name] = enclosures.index
261258

262259
# figure out which enlosures contain which buildings
263-
if GPD_GE_013:
264-
inp, res = geometry.sindex.query(enclosures.geometry, predicate="intersects")
265-
else:
266-
inp, res = geometry.sindex.query_bulk(
267-
enclosures.geometry, predicate="intersects"
268-
)
260+
inp, res = geometry.sindex.query(enclosures.geometry, predicate="intersects")
269261

270262
# find out which enclosures contain one and multiple buildings
271263
unique, counts = np.unique(inp, return_counts=True)
@@ -752,10 +744,6 @@ def buffered_limit(
752744
<class 'shapely.geometry.polygon.Polygon'>
753745
"""
754746
if buffer == "adaptive":
755-
if not LPS_GE_411:
756-
raise ImportError(
757-
"Adaptive buffer requires libpysal 4.11 or higher."
758-
) # because https://github.com/pysal/libpysal/pull/709
759747
gabriel = Graph.build_triangulation(gdf.centroid, "gabriel", kernel="identity")
760748
max_dist = gabriel.aggregate("max")
761749
buffer = np.clip(max_dist / 2 + max_dist * 0.1, min_buffer, max_buffer).values

0 commit comments

Comments
 (0)