1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6 fetchpatch,
7 pytestCheckHook,
8 pythonOlder,
9 setuptools,
10
11 packaging,
12 pandas,
13 pyogrio,
14 pyproj,
15 rtree,
16 shapely,
17
18 # optional-dependencies
19 folium,
20 geoalchemy2,
21 geopy,
22 mapclassify,
23 matplotlib,
24 psycopg,
25 pyarrow,
26 sqlalchemy,
27 xyzservices,
28}:
29
30buildPythonPackage rec {
31 pname = "geopandas";
32 version = "1.0.1";
33 pyproject = true;
34
35 disabled = pythonOlder "3.9";
36
37 src = fetchFromGitHub {
38 owner = "geopandas";
39 repo = "geopandas";
40 tag = "v${version}";
41 hash = "sha256-SZizjwkx8dsnaobDYpeQm9jeXZ4PlzYyjIScnQrH63Q=";
42 };
43
44 patches = [
45 (fetchpatch {
46 # Remove geom_almost_equals, because it broke with shapely 2.1.0 and is not being updated
47 url = "https://github.com/geopandas/geopandas/commit/0e1f871a02e9612206dcadd6817284131026f61c.patch";
48 excludes = [ "CHANGELOG.md" ];
49 hash = "sha256-n9AmmbjjNwV66lxDQV2hfkVVfxRgMfEGfHZT6bql684=";
50 })
51 ];
52
53 build-system = [ setuptools ];
54
55 dependencies = [
56 packaging
57 pandas
58 pyogrio
59 pyproj
60 shapely
61 ];
62
63 optional-dependencies = {
64 all = [
65 # prevent infinite recursion
66 (folium.overridePythonAttrs (prevAttrs: {
67 doCheck = false;
68 }))
69 geoalchemy2
70 geopy
71 # prevent infinite recursion
72 (mapclassify.overridePythonAttrs (prevAttrs: {
73 doCheck = false;
74 }))
75 matplotlib
76 psycopg
77 pyarrow
78 sqlalchemy
79 xyzservices
80 ];
81 };
82
83 nativeCheckInputs = [
84 pytestCheckHook
85 rtree
86 ]
87 ++ optional-dependencies.all;
88
89 preCheck = ''
90 export HOME=$(mktemp -d);
91 '';
92
93 disabledTests = [
94 # Requires network access
95 "test_read_file_url"
96 ];
97
98 enabledTestPaths = [ "geopandas" ];
99
100 pythonImportsCheck = [ "geopandas" ];
101
102 meta = with lib; {
103 description = "Python geospatial data analysis framework";
104 homepage = "https://geopandas.org";
105 changelog = "https://github.com/geopandas/geopandas/blob/v${version}/CHANGELOG.md";
106 license = licenses.bsd3;
107 teams = [ teams.geospatial ];
108 };
109}