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