1{ lib 2, buildPythonPackage 3, fetchPypi 4, pythonOlder 5, hatchling 6, hatch-vcs 7, numpy 8, packaging 9, importlib-resources 10, pydicom 11, pillow 12, h5py 13, scipy 14, git 15, pytest-doctestplus 16, pytest-httpserver 17, pytest-xdist 18, pytestCheckHook 19}: 20 21buildPythonPackage rec { 22 pname = "nibabel"; 23 version = "5.1.0"; 24 format = "pyproject"; 25 26 disabled = pythonOlder "3.8"; 27 28 src = fetchPypi { 29 inherit pname version; 30 hash = "sha256-znPKXpVyCechmiI8tx93I1yd8qz00/J/hhujjpSBrFM="; 31 }; 32 33 nativeBuildInputs = [ 34 hatchling 35 hatch-vcs 36 ]; 37 38 propagatedBuildInputs = [ 39 numpy 40 packaging 41 ] ++ lib.optionals (pythonOlder "3.9") [ 42 importlib-resources 43 ]; 44 45 passthru.optional-dependencies = rec { 46 all = dicom 47 ++ dicomfs 48 ++ minc2 49 ++ spm 50 ++ zstd; 51 dicom = [ 52 pydicom 53 ]; 54 dicomfs = [ 55 pillow 56 ] ++ dicom; 57 minc2 = [ 58 h5py 59 ]; 60 spm = [ 61 scipy 62 ]; 63 zstd = [ 64 # TODO: pyzstd 65 ]; 66 }; 67 68 nativeCheckInputs = [ 69 git 70 pytest-doctestplus 71 pytest-httpserver 72 pytest-xdist 73 pytestCheckHook 74 ] ++ passthru.optional-dependencies.all; 75 76 preCheck = '' 77 export PATH=$out/bin:$PATH 78 ''; 79 80 disabledTests = [ 81 # https://github.com/nipy/nibabel/issues/951 82 "test_filenames" 83 ]; 84 85 meta = with lib; { 86 homepage = "https://nipy.org/nibabel"; 87 description = "Access a multitude of neuroimaging data formats"; 88 license = licenses.mit; 89 maintainers = with maintainers; [ ashgillman ]; 90 }; 91}