1{
2 lib,
3 buildPythonPackage,
4 pythonOlder,
5 fetchpatch,
6 fetchPypi,
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 patches = [
40 # Some tests in the 0.23.0 release are failing due to missing network markers. Revisit after update.
41 (fetchpatch {
42 name = "mnt-add-missing-needs-network-markers.patch";
43 url = "https://github.com/SciTools/cartopy/commit/2403847ea69c3d95e899ad5d0cab32ac6017df0e.patch";
44 hash = "sha256-aGBUX4jFn7GgoqmHVC51DmS+ga3GcQGKfkut++x67Q0=";
45 })
46 ];
47
48 nativeBuildInputs = [
49 cython
50 geos # for geos-config
51 proj
52 setuptools-scm
53 ];
54
55 buildInputs = [
56 geos
57 proj
58 ];
59
60 propagatedBuildInputs = [
61 matplotlib
62 numpy
63 pyproj
64 pyshp
65 shapely
66 ];
67
68 passthru.optional-dependencies = {
69 ows = [
70 owslib
71 pillow
72 ];
73 plotting = [
74 gdal
75 pillow
76 scipy
77 ];
78 };
79
80 nativeCheckInputs = [
81 pytest-mpl
82 pytestCheckHook
83 ] ++ lib.flatten (lib.attrValues passthru.optional-dependencies);
84
85 preCheck = ''
86 export FONTCONFIG_FILE=${fontconfig.out}/etc/fonts/fonts.conf
87 export HOME=$TMPDIR
88 '';
89
90 pytestFlagsArray = [
91 "--pyargs"
92 "cartopy"
93 "-m"
94 "'not network and not natural_earth'"
95 ];
96
97 disabledTests = [
98 "test_gridliner_constrained_adjust_datalim"
99 "test_gridliner_labels_bbox_style"
100 ];
101
102 meta = with lib; {
103 description = "Process geospatial data to create maps and perform analyses";
104 mainProgram = "feature_download";
105 license = licenses.lgpl3Plus;
106 homepage = "https://scitools.org.uk/cartopy/docs/latest/";
107 maintainers = with maintainers; [ mredaelli ];
108 };
109}