about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/mne-python/default.nix
blob: 4e93aaf3311caf885d9a4e0c1c2603ff42e34386 (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
88
89
90
91
92
93
{ lib
, buildPythonPackage
, fetchFromGitHub
, setuptools
, setuptools-scm
, numpy
, scipy
, pytestCheckHook
, pytest-timeout
, pytest-harvest
, matplotlib
, decorator
, jinja2
, pooch
, tqdm
, packaging
, importlib-resources
, lazy-loader
, h5io
, pymatreader
, pythonOlder
}:

buildPythonPackage rec {
  pname = "mne-python";
  version = "1.6.1";
  pyproject = true;

  disabled = pythonOlder "3.8";

  src = fetchFromGitHub {
    owner = "mne-tools";
    repo = "mne-python";
    rev = "refs/tags/v${version}";
    hash = "sha256-U1aMqcUZ3BcwqwOYh/qfG5PhacwBVioAgNc52uaoJL0";
  };

  postPatch = ''
    substituteInPlace pyproject.toml  \
      --replace "--cov-report=" ""  \
      --replace "--cov-branch" ""
  '';

  nativeBuildInputs = [
    setuptools
    setuptools-scm
  ];

  propagatedBuildInputs = [
    numpy
    scipy
    matplotlib
    tqdm
    pooch
    decorator
    packaging
    jinja2
    lazy-loader
  ] ++ lib.optionals (pythonOlder "3.9") [
    importlib-resources
  ];

  passthru.optional-dependencies = {
    hdf5 = [
      h5io
      pymatreader
    ];
  };

  nativeCheckInputs = [
    pytestCheckHook
    pytest-timeout
    pytest-harvest
  ] ++ lib.flatten (builtins.attrValues passthru.optional-dependencies);

  preCheck = ''
    export HOME=$(mktemp -d)
    export MNE_SKIP_TESTING_DATASET_TESTS=true
    export MNE_SKIP_NETWORK_TESTS=1
  '';

  pythonImportsCheck = [
    "mne"
  ];

  meta = with lib; {
    description = "Magnetoencephelography and electroencephalography in Python";
    homepage = "https://mne.tools";
    changelog = "https://mne.tools/stable/changes/v${version}.html";
    license = licenses.bsd3;
    maintainers = with maintainers; [ bcdarwin mbalatsko ];
  };
}