1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 hatchling,
6 hatch-vcs,
7 numpy,
8 scipy,
9 pytestCheckHook,
10 pytest-timeout,
11 matplotlib,
12 decorator,
13 jinja2,
14 pooch,
15 tqdm,
16 packaging,
17 lazy-loader,
18 h5io,
19 pymatreader,
20 pythonOlder,
21}:
22
23buildPythonPackage rec {
24 pname = "mne-python";
25 version = "1.7.1";
26 pyproject = true;
27
28 disabled = pythonOlder "3.9";
29
30 src = fetchFromGitHub {
31 owner = "mne-tools";
32 repo = "mne-python";
33 rev = "refs/tags/v${version}";
34 hash = "sha256-piCFynpKh7gTWIGh2g0gJICLS+eg/0XAxaDkyu7v5vs=";
35 };
36
37 postPatch = ''
38 substituteInPlace pyproject.toml \
39 --replace-fail "--cov-report=" "" \
40 --replace-fail "--cov-branch" ""
41 '';
42
43 nativeBuildInputs = [
44 hatchling
45 hatch-vcs
46 ];
47
48 propagatedBuildInputs = [
49 numpy
50 scipy
51 matplotlib
52 tqdm
53 pooch
54 decorator
55 packaging
56 jinja2
57 lazy-loader
58 ];
59
60 passthru.optional-dependencies.hdf5 = [
61 h5io
62 pymatreader
63 ];
64
65 nativeCheckInputs = [
66 pytestCheckHook
67 pytest-timeout
68 ] ++ lib.flatten (builtins.attrValues passthru.optional-dependencies);
69
70 preCheck = ''
71 export HOME=$(mktemp -d)
72 export MNE_SKIP_TESTING_DATASET_TESTS=true
73 export MNE_SKIP_NETWORK_TESTS=1
74 '';
75
76 disabledTests = [
77 # Fails due to changes in Numpy types
78 "mne.stats._adjacency.combine_adjacency"
79 ];
80
81 pythonImportsCheck = [ "mne" ];
82
83 meta = with lib; {
84 description = "Magnetoencephelography and electroencephalography in Python";
85 mainProgram = "mne";
86 homepage = "https://mne.tools";
87 changelog = "https://mne.tools/stable/changes/v${version}.html";
88 license = licenses.bsd3;
89 maintainers = with maintainers; [
90 bcdarwin
91 mbalatsko
92 ];
93 };
94}