Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
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 gdal, 19 hypothesis, 20 ipython, 21 matplotlib, 22 numpy, 23 packaging, 24 pytest-randomly, 25 setuptools, 26 shapely, 27 snuggs, 28 wheel, 29 30 rasterio, # required to run version test 31}: 32 33buildPythonPackage rec { 34 pname = "rasterio"; 35 version = "1.3.10"; 36 format = "pyproject"; 37 38 disabled = pythonOlder "3.8"; 39 40 src = fetchFromGitHub { 41 owner = "rasterio"; 42 repo = "rasterio"; 43 rev = "refs/tags/${version}"; 44 hash = "sha256-FidUaSpbTR8X1/Cqy/IwApkOOl2RRtPqYJaSISRPThI="; 45 }; 46 47 postPatch = '' 48 # remove useless import statement requiring distutils to be present at the runtime 49 substituteInPlace rasterio/rio/calc.py \ 50 --replace-fail "from distutils.version import LooseVersion" "" 51 52 # relax dependency on yet non-packaged, RC version of numpy 53 substituteInPlace pyproject.toml \ 54 --replace-fail "numpy==2.0.0rc1" "numpy" 55 ''; 56 57 nativeBuildInputs = [ 58 cython 59 gdal 60 numpy 61 setuptools 62 wheel 63 ]; 64 65 propagatedBuildInputs = [ 66 affine 67 attrs 68 certifi 69 click 70 click-plugins 71 cligj 72 numpy 73 snuggs 74 ]; 75 76 passthru.optional-dependencies = { 77 ipython = [ ipython ]; 78 plot = [ matplotlib ]; 79 s3 = [ boto3 ]; 80 }; 81 82 nativeCheckInputs = [ 83 boto3 84 hypothesis 85 packaging 86 pytestCheckHook 87 pytest-randomly 88 shapely 89 ]; 90 91 doCheck = true; 92 93 preCheck = '' 94 rm -r rasterio # prevent importing local rasterio 95 ''; 96 97 pytestFlagsArray = [ "-m 'not network'" ]; 98 99 disabledTests = [ 100 # flaky 101 "test_outer_boundless_pixel_fidelity" 102 103 # Failing with GDAL 3.9. 104 # Fixed in https://github.com/rasterio/rasterio/commit/24d0845e576158217f6541c3c81b163d873a994d 105 # Re-enable in next rasterio update. 106 "test_create_sidecar_mask" 107 "test_update_tags" 108 ] ++ lib.optionals stdenv.isDarwin [ "test_reproject_error_propagation" ]; 109 110 pythonImportsCheck = [ "rasterio" ]; 111 112 passthru.tests.version = testers.testVersion { 113 package = rasterio; 114 version = version; 115 command = "${rasterio}/bin/rio --version"; 116 }; 117 118 meta = with lib; { 119 description = "Python package to read and write geospatial raster data"; 120 mainProgram = "rio"; 121 homepage = "https://rasterio.readthedocs.io/"; 122 changelog = "https://github.com/rasterio/rasterio/blob/${version}/CHANGES.txt"; 123 license = licenses.bsd3; 124 maintainers = teams.geospatial.members; 125 }; 126}