diff --git a/ci/envs/311-oldest.yaml b/ci/envs/311-oldest.yaml index 5130eccc..f01358fc 100644 --- a/ci/envs/311-oldest.yaml +++ b/ci/envs/311-oldest.yaml @@ -3,17 +3,17 @@ channels: - conda-forge dependencies: - python=3.11 - - geopandas=0.14 + - geopandas=1.0 - inequality - libpysal=4.12.0 - mapclassify - - networkx=3.2 - - numpy=1.25 + - networkx=3.3 + - numpy=2.0 - packaging - - pandas=2.0 + - pandas=2.2 - shapely=2.0 - - tqdm=4.65 - - numba=0.58 + - tqdm=4.67 + - numba=0.60 - fiona=1.10 # testing - codecov diff --git a/docs/install.rst b/docs/install.rst index b10697bb..5fbaaf8e 100644 --- a/docs/install.rst +++ b/docs/install.rst @@ -84,14 +84,14 @@ Dependencies Required dependencies: -- `geopandas`_ (>= 0.12.0) +- `geopandas`_ (>= 1.0) - `libpysal`_ (>= 4.12.0) - `networkx`_ - `tqdm`_ Some functions also depend on additional packages, which are optional: -- `mapclassify`_ (>= 2.4.2) +- `mapclassify`_ - `inequality`_ - `numba`_ - `esda`_ @@ -111,7 +111,7 @@ Some functions also depend on additional packages, which are optional: .. _numba: https://numba.pydata.org -.. _tqdm: http://networkx.github.io +.. _tqdm: https://tqdm.github.io .. _pysal: http://pysal.org diff --git a/momepy/diversity.py b/momepy/diversity.py index 9015bae3..1156be77 100644 --- a/momepy/diversity.py +++ b/momepy/diversity.py @@ -3,7 +3,6 @@ from libpysal.graph import Graph from libpysal.graph._utils import _percentile_filtration_grouper from numpy.typing import NDArray -from packaging.version import Version from pandas import DataFrame, Series try: @@ -162,9 +161,6 @@ def describe_agg( 6.0 652.432194 32.829824 """ # noqa: E501 - if Version(pd.__version__) <= Version("2.1.0"): - raise ImportError("pandas 2.1.0 or newer is required to use this function.") - # series indice needs renaming, since multiindices # without explicit names cannot be joined if isinstance(y, np.ndarray): @@ -289,9 +285,6 @@ def describe_reached_agg( 4 683.514930 NaN """ # noqa: E501 - if Version(pd.__version__) <= Version("2.1.0"): - raise ImportError("pandas 2.1.0 or newer is required to use this function.") - # series indice needs renaming, since multiindices # without explicit names cannot be joined if isinstance(y, np.ndarray): diff --git a/momepy/elements.py b/momepy/elements.py index c0abe3da..b3e34f90 100644 --- a/momepy/elements.py +++ b/momepy/elements.py @@ -13,7 +13,6 @@ from shapely.geometry.base import BaseGeometry from shapely.ops import polygonize -GPD_GE_10 = Version(gpd.__version__) >= Version("1.0dev") SHPLY_GE_210 = Version(shapely.__version__) >= Version("2.1.0") __all__ = [ @@ -127,7 +126,7 @@ def morphological_tessellation( ) if isinstance(clip, GeoSeries | GeoDataFrame): - clip = clip.union_all() if GPD_GE_10 else clip.unary_union + clip = clip.union_all() mt = voronoi_frames( geometry, @@ -772,11 +771,7 @@ def buffered_limit( elif not isinstance(buffer, int | float): raise ValueError("`buffer` must be either 'adaptive' or a number.") - return ( - gdf.buffer(buffer, **kwargs).union_all() - if GPD_GE_10 - else gdf.buffer(buffer, **kwargs).unary_union - ) + return gdf.buffer(buffer, **kwargs).union_all() def get_network_ratio(df, edges, initial_buffer=500): @@ -921,7 +916,7 @@ def enclosures( barriers = pd.concat([primary_barriers.geometry, limit_b.geometry]) else: barriers = primary_barriers - unioned = barriers.union_all() if GPD_GE_10 else barriers.unary_union + unioned = barriers.union_all() polygons = polygonize(unioned) enclosures = gpd.GeoSeries(list(polygons), crs=primary_barriers.crs) diff --git a/momepy/tests/test_diversity.py b/momepy/tests/test_diversity.py index 52016cc5..c8694cf3 100644 --- a/momepy/tests/test_diversity.py +++ b/momepy/tests/test_diversity.py @@ -3,15 +3,12 @@ import pandas as pd import pytest from libpysal.graph import Graph -from packaging.version import Version from pandas.testing import assert_frame_equal, assert_series_equal import momepy as mm from .conftest import assert_frame_result, assert_result -PD_210 = Version(pd.__version__) >= Version("2.1.0") - class TestDescribe: def setup_method(self): @@ -394,9 +391,6 @@ def test_unique(self): un_nan_drop, un_nan_drop_expected, self.df_tessellation, check_names=False ) - @pytest.mark.skipif( - not PD_210, reason="aggregation is different in previous pandas versions" - ) def test_describe_agg(self): df = mm.describe_agg( self.df_buildings["area"], @@ -469,9 +463,6 @@ def test_describe_agg(self): assert_result(df["sum"], expected_fl_area_sum, result_index) assert_result(df["mean"], expected_fl_area_mean, result_index) - @pytest.mark.skipif( - not PD_210, reason="aggregation is different in previous pandas versions" - ) def test_describe_cols(self): df = mm.describe_agg( self.df_buildings["area"], @@ -480,9 +471,6 @@ def test_describe_cols(self): ) assert list(df.columns) == ["min", "max"] - @pytest.mark.skipif( - not PD_210, reason="aggregation is different in previous pandas versions" - ) def test_describe_reached_agg(self): df_sw = mm.describe_reached_agg( self.df_buildings["fl_area"], self.df_buildings["nID"], graph=self.graph_sw @@ -512,9 +500,6 @@ def test_describe_reached_agg(self): filtered_df["count"], filtered_expected, self.df_streets, check_names=False ) - @pytest.mark.skipif( - not PD_210, reason="aggregation is different in previous pandas versions" - ) def test_describe_reached_input_equality(self): island_result_df = mm.describe_agg( self.df_buildings["area"], self.df_buildings["nID"] @@ -529,9 +514,6 @@ def test_describe_reached_input_equality(self): island_result_df.values, island_result_ndarray.values, equal_nan=True ) - @pytest.mark.skipif( - not PD_210, reason="aggregation is different in previous pandas versions" - ) def test_describe_reached_cols(self): df = mm.describe_reached_agg( self.df_buildings["fl_area"], @@ -542,9 +524,6 @@ def test_describe_reached_cols(self): ) assert list(df.columns) == ["min", "max"] - @pytest.mark.skipif( - not PD_210, reason="aggregation is different in previous pandas versions" - ) def test_na_results(self): nan_areas = self.df_buildings["area"] nan_areas.iloc[range(0, len(self.df_buildings), 3),] = np.nan @@ -614,9 +593,6 @@ def test_density(self): check_names=False, ) - @pytest.mark.skipif( - not PD_210, reason="aggregation is different in previous pandas versions" - ) def test_unweighted_percentile(self): perc = mm.percentile(self.df_tessellation["area"], self.diversity_graph) perc_expected = { @@ -662,9 +638,6 @@ def test_unweighted_percentile(self): perc = mm.percentile(self.df_tessellation["area"].iloc[:100], graph) assert perc.loc[0].isna().all() - @pytest.mark.skipif( - not PD_210, reason="aggregation is different in previous pandas versions" - ) def test_distance_decay_linearly_weighted_percentiles(self): # setup weight decay graph diff --git a/momepy/tests/test_intensity.py b/momepy/tests/test_intensity.py index 17d7e877..9d826db9 100644 --- a/momepy/tests/test_intensity.py +++ b/momepy/tests/test_intensity.py @@ -2,17 +2,13 @@ import networkx as nx import numpy as np import pandas as pd -import pytest from libpysal.graph import Graph -from packaging.version import Version from pandas.testing import assert_series_equal import momepy as mm from .conftest import assert_result -PD_210 = Version(pd.__version__) >= Version("2.1.0") - class TestIntensity: def setup_method(self): @@ -95,9 +91,6 @@ def test_node_density(self): assert_series_equal(alternative_density, density) assert_series_equal(alternative_weighted, weighted) - @pytest.mark.skipif( - not PD_210, reason="aggregation is different in previous pandas versions" - ) def test_area_ratio(self): def area_ratio(overlay, covering, agg_key): res = mm.describe_agg(covering, agg_key) diff --git a/pyproject.toml b/pyproject.toml index 969d8cda..8016be03 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,13 +34,14 @@ classifiers = [ ] requires-python = ">=3.11" dependencies = [ - "geopandas>=0.14.0", + "geopandas>=1.0", "libpysal>=4.12.0", - "networkx>=3.2", + "networkx>=3.3", + "numpy>=2.0", "packaging", - "pandas>=2.0", - "shapely>=2", - "tqdm>=4.65", + "pandas>=2.2", + "shapely>=2.0", + "tqdm>=4.67", ] [project.urls] @@ -49,7 +50,7 @@ Repository = "https://github.com/pysal/momepy" [project.optional-dependencies] plus = [ - "numba", + "numba>=0.60", "inequality", "mapclassify", "esda",