about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/nibabel/default.nix
blob: 7d8e021fd0cfbeccd8d3ef9eb46c48d3f420340b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
{ lib
, buildPythonPackage
, fetchPypi
, pythonOlder
, hatchling
, hatch-vcs
, numpy
, packaging
, importlib-resources
, pydicom
, pillow
, h5py
, scipy
, git
, pytest-doctestplus
, pytest-httpserver
, pytest-xdist
, pytestCheckHook
}:

buildPythonPackage rec {
  pname = "nibabel";
  version = "5.2.1";
  pyproject = true;

  disabled = pythonOlder "3.8";

  src = fetchPypi {
    inherit pname version;
    hash = "sha256-tsgLLnKOS8K2XxFC2bjSKHqRAqi/hHfhFe8NgzRVmXU=";
  };

  nativeBuildInputs = [
    hatchling
    hatch-vcs
  ];

  propagatedBuildInputs = [
    numpy
    packaging
  ] ++ lib.optionals (pythonOlder "3.9") [
    importlib-resources
  ];

  passthru.optional-dependencies = rec {
    all = dicom
      ++ dicomfs
      ++ minc2
      ++ spm
      ++ zstd;
    dicom = [
      pydicom
    ];
    dicomfs = [
      pillow
    ] ++ dicom;
    minc2 = [
      h5py
    ];
    spm = [
      scipy
    ];
    zstd = [
      # TODO: pyzstd
    ];
  };

  nativeCheckInputs = [
    git
    pytest-doctestplus
    pytest-httpserver
    pytest-xdist
    pytestCheckHook
  ] ++ passthru.optional-dependencies.all;

  preCheck = ''
    export PATH=$out/bin:$PATH
  '';

  meta = with lib; {
    homepage = "https://nipy.org/nibabel";
    changelog = "https://github.com/nipy/nibabel/blob/${version}/Changelog";
    description = "Access a multitude of neuroimaging data formats";
    license = licenses.mit;
    maintainers = with maintainers; [ ashgillman ];
  };
}