1{
2 lib,
3 buildPythonPackage,
4 pythonOlder,
5 fetchPypi,
6 fetchpatch,
7 cython,
8 setuptools-scm,
9 geos,
10 proj,
11 matplotlib,
12 numpy,
13 pyproj,
14 pyshp,
15 shapely,
16 owslib,
17 pillow,
18 gdal,
19 scipy,
20 fontconfig,
21 pytest-mpl,
22 pytestCheckHook,
23}:
24
25buildPythonPackage rec {
26 pname = "cartopy";
27 version = "0.23.0";
28
29 disabled = pythonOlder "3.8";
30
31 format = "setuptools";
32
33 src = fetchPypi {
34 inherit version;
35 pname = "Cartopy";
36 hash = "sha256-Ix83s1cB8rox2UlZzKdebaBMLuo6fxTOHHXuOw6udnY=";
37 };
38
39 nativeBuildInputs = [
40 cython
41 geos # for geos-config
42 proj
43 setuptools-scm
44 ];
45
46 buildInputs = [
47 geos
48 proj
49 ];
50
51 propagatedBuildInputs = [
52 matplotlib
53 numpy
54 pyproj
55 pyshp
56 shapely
57 ];
58
59 passthru.optional-dependencies = {
60 ows = [
61 owslib
62 pillow
63 ];
64 plotting = [
65 gdal
66 pillow
67 scipy
68 ];
69 };
70
71 nativeCheckInputs = [
72 pytest-mpl
73 pytestCheckHook
74 ] ++ lib.flatten (lib.attrValues passthru.optional-dependencies);
75
76 preCheck = ''
77 export FONTCONFIG_FILE=${fontconfig.out}/etc/fonts/fonts.conf
78 export HOME=$TMPDIR
79 '';
80
81 pytestFlagsArray = [
82 "--pyargs"
83 "cartopy"
84 "-m"
85 "'not network and not natural_earth'"
86 ];
87
88 disabledTests = [ "test_gridliner_labels_bbox_style" ];
89
90 meta = with lib; {
91 description = "Process geospatial data to create maps and perform analyses";
92 mainProgram = "feature_download";
93 license = licenses.lgpl3Plus;
94 homepage = "https://scitools.org.uk/cartopy/docs/latest/";
95 maintainers = with maintainers; [ mredaelli ];
96 };
97}