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