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