Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at gcc-offload 120 lines 2.2 kB view raw
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.2"; 37 format = "pyproject"; 38 39 disabled = pythonOlder "3.8"; 40 41 src = fetchFromGitHub { 42 owner = "rasterio"; 43 repo = "rasterio"; 44 rev = "refs/tags/${version}"; 45 hash = "sha256-YGSd0IG6TWnHmDiVEE3F2KNQ4dXJhkPqAJsIrWyuHos="; 46 }; 47 48 postPatch = '' 49 # relax numpy dependency 50 substituteInPlace pyproject.toml \ 51 --replace-fail "numpy>=2" "numpy" 52 ''; 53 54 nativeBuildInputs = [ 55 cython 56 gdal 57 numpy 58 setuptools 59 wheel 60 ]; 61 62 propagatedBuildInputs = [ 63 affine 64 attrs 65 certifi 66 click 67 click-plugins 68 cligj 69 numpy 70 snuggs 71 ]; 72 73 optional-dependencies = { 74 ipython = [ ipython ]; 75 plot = [ matplotlib ]; 76 s3 = [ boto3 ]; 77 }; 78 79 nativeCheckInputs = [ 80 boto3 81 fsspec 82 hypothesis 83 packaging 84 pytestCheckHook 85 pytest-randomly 86 shapely 87 ]; 88 89 preCheck = '' 90 rm -r rasterio # prevent importing local rasterio 91 ''; 92 93 pytestFlagsArray = [ "-m 'not network'" ]; 94 95 disabledTests = [ 96 # flaky 97 "test_outer_boundless_pixel_fidelity" 98 # network access 99 "test_issue1982" 100 "test_opener_fsspec_http_fs" 101 "test_fsspec_http_msk_sidecar" 102 ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ "test_reproject_error_propagation" ]; 103 104 pythonImportsCheck = [ "rasterio" ]; 105 106 passthru.tests.version = testers.testVersion { 107 package = rasterio; 108 version = version; 109 command = "${rasterio}/bin/rio --version"; 110 }; 111 112 meta = with lib; { 113 description = "Python package to read and write geospatial raster data"; 114 mainProgram = "rio"; 115 homepage = "https://rasterio.readthedocs.io/"; 116 changelog = "https://github.com/rasterio/rasterio/blob/${version}/CHANGES.txt"; 117 license = licenses.bsd3; 118 maintainers = teams.geospatial.members; 119 }; 120}