1{ lib
2, stdenv
3, buildPythonPackage
4, fetchFromGitHub
5, pythonOlder
6
7# build time
8, cython
9, gdal
10
11# runtime
12, affine
13, attrs
14, boto3
15, click
16, click-plugins
17, cligj
18, matplotlib
19, numpy
20, snuggs
21, setuptools
22
23# tests
24, hypothesis
25, packaging
26, pytest-randomly
27, pytestCheckHook
28, shapely
29}:
30
31buildPythonPackage rec {
32 pname = "rasterio";
33 version = "1.3.0"; # not x.y[ab]z, those are alpha/beta versions
34 format = "pyproject";
35 disabled = pythonOlder "3.6";
36
37 # Pypi doesn't ship the tests, so we fetch directly from GitHub
38 src = fetchFromGitHub {
39 owner = "rasterio";
40 repo = "rasterio";
41 rev = "refs/tags/${version}";
42 hash = "sha256-CBnG1zNMOL3rAmnErv7XZZ2Cu9W+DnRPcjtKdmYXHUA=";
43 };
44
45 nativeBuildInputs = [
46 cython
47 gdal
48 ];
49
50 propagatedBuildInputs = [
51 affine
52 attrs
53 boto3
54 click
55 click-plugins
56 cligj
57 matplotlib
58 numpy
59 snuggs
60 setuptools # needs pkg_resources at runtime
61 ];
62
63 preCheck = ''
64 rm -rf rasterio
65 '';
66
67 checkInputs = [
68 pytest-randomly
69 pytestCheckHook
70 packaging
71 hypothesis
72 shapely
73 ];
74
75 pytestFlagsArray = [
76 "-m 'not network'"
77 ];
78
79 disabledTests = lib.optionals stdenv.isDarwin [
80 "test_reproject_error_propagation"
81 ];
82
83 pythonImportsCheck = [
84 "rasterio"
85 ];
86
87 doInstallCheck = true;
88 installCheckPhase = ''
89 $out/bin/rio --version | grep ${version} > /dev/null
90 '';
91
92 meta = with lib; {
93 description = "Python package to read and write geospatial raster data";
94 homepage = "https://rasterio.readthedocs.io/en/latest/";
95 license = licenses.bsd3;
96 maintainers = with maintainers; [ mredaelli ];
97 };
98}