1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 pytestCheckHook,
6 pythonOlder,
7 stdenv,
8 testers,
9
10 affine,
11 attrs,
12 boto3,
13 certifi,
14 click,
15 click-plugins,
16 cligj,
17 cython,
18 fsspec,
19 gdal,
20 hypothesis,
21 ipython,
22 matplotlib,
23 numpy,
24 packaging,
25 pytest-randomly,
26 setuptools,
27 shapely,
28 snuggs,
29 wheel,
30
31 rasterio, # required to run version test
32}:
33
34buildPythonPackage rec {
35 pname = "rasterio";
36 version = "1.4.3";
37 format = "pyproject";
38
39 disabled = pythonOlder "3.8";
40
41 src = fetchFromGitHub {
42 owner = "rasterio";
43 repo = "rasterio";
44 tag = version;
45 hash = "sha256-InejYBRa4i0E2GxEWbtBpaErtcoYrhtypAlRtMlUoDk=";
46 };
47
48 nativeBuildInputs = [
49 cython
50 gdal
51 numpy
52 setuptools
53 wheel
54 ];
55
56 propagatedBuildInputs = [
57 affine
58 attrs
59 certifi
60 click
61 click-plugins
62 cligj
63 numpy
64 snuggs
65 ];
66
67 optional-dependencies = {
68 ipython = [ ipython ];
69 plot = [ matplotlib ];
70 s3 = [ boto3 ];
71 };
72
73 nativeCheckInputs = [
74 boto3
75 fsspec
76 hypothesis
77 packaging
78 pytestCheckHook
79 pytest-randomly
80 shapely
81 ];
82
83 preCheck = ''
84 rm -r rasterio # prevent importing local rasterio
85 '';
86
87 pytestFlagsArray = [ "-m 'not network'" ];
88
89 disabledTests = [
90 # flaky
91 "test_outer_boundless_pixel_fidelity"
92 # network access
93 "test_issue1982"
94 "test_opener_fsspec_http_fs"
95 "test_fsspec_http_msk_sidecar"
96 # expect specific magic numbers that our version of GDAL does not produce
97 "test_warp"
98 "test_warpedvrt"
99 "test_rio_warp"
100 ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ "test_reproject_error_propagation" ];
101
102 pythonImportsCheck = [ "rasterio" ];
103
104 passthru.tests.version = testers.testVersion {
105 package = rasterio;
106 version = version;
107 command = "${rasterio}/bin/rio --version";
108 };
109
110 meta = with lib; {
111 description = "Python package to read and write geospatial raster data";
112 mainProgram = "rio";
113 homepage = "https://rasterio.readthedocs.io/";
114 changelog = "https://github.com/rasterio/rasterio/blob/${version}/CHANGES.txt";
115 license = licenses.bsd3;
116 teams = [ teams.geospatial ];
117 };
118}