1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 hatchling,
6 hatch-vcs,
7 numpy,
8 scipy,
9 flaky,
10 pandas,
11 pytestCheckHook,
12 pytest-cov-stub,
13 pytest-timeout,
14 writableTmpDirAsHomeHook,
15 matplotlib,
16 decorator,
17 jinja2,
18 pooch,
19 tqdm,
20 packaging,
21 lazy-loader,
22 h5io,
23 pymatreader,
24 pythonOlder,
25 procps,
26 optipng,
27}:
28
29buildPythonPackage rec {
30 pname = "mne";
31 version = "1.10.1";
32 pyproject = true;
33
34 disabled = pythonOlder "3.10";
35
36 src = fetchFromGitHub {
37 owner = "mne-tools";
38 repo = "mne-python";
39 tag = "v${version}";
40 hash = "sha256-xxkv+8RAkpRyMWznUMpwc6E72mb9DUPW6O5hFHiNz98=";
41 };
42
43 postPatch = ''
44 substituteInPlace doc/conf.py \
45 --replace-fail '"optipng"' '"${lib.getExe optipng}"'
46 substituteInPlace mne/utils/config.py \
47 --replace-fail '"free"' '"${lib.getExe' procps "free"}"' \
48 --replace-fail '"sysctl"' '"${lib.getExe' procps "sysctl"}"'
49 '';
50
51 build-system = [
52 hatchling
53 hatch-vcs
54 ];
55
56 dependencies = [
57 numpy
58 scipy
59 matplotlib
60 tqdm
61 pooch
62 decorator
63 packaging
64 jinja2
65 lazy-loader
66 ];
67
68 optional-dependencies.hdf5 = [
69 h5io
70 pymatreader
71 ];
72
73 nativeCheckInputs = [
74 flaky
75 pandas
76 pytestCheckHook
77 pytest-cov-stub
78 pytest-timeout
79 writableTmpDirAsHomeHook
80 ]
81 ++ lib.flatten (builtins.attrValues optional-dependencies);
82
83 preCheck = ''
84 export MNE_SKIP_TESTING_DATASET_TESTS=true
85 export MNE_SKIP_NETWORK_TESTS=1
86 '';
87
88 disabledTests = [
89 # requires qtbot which is unmaintained/not in Nixpkgs:
90 "test_plotting_scalebars"
91 # tries to write a datetime object to hdf5, which fails:
92 "test_hitachi_basic"
93 # flaky
94 "test_fine_cal_systems"
95 "test_simulate_raw_bem"
96 ];
97
98 pytestFlag = [
99 # removes 700k lines from pytest log, remove this when scipy is at v1.17.0
100 "--disable-warnings"
101 ];
102
103 disabledTestMarks = [
104 "slowtest"
105 "ultraslowtest"
106 "pgtest"
107 ];
108
109 pythonImportsCheck = [ "mne" ];
110
111 meta = {
112 description = "Magnetoencephelography and electroencephalography in Python";
113 mainProgram = "mne";
114 homepage = "https://mne.tools";
115 changelog = "https://mne.tools/stable/changes/v${lib.versions.majorMinor version}.html";
116 license = lib.licenses.bsd3;
117 maintainers = with lib.maintainers; [
118 bcdarwin
119 mbalatsko
120 ];
121 };
122}