1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 setuptools,
6 setuptools-scm,
7 numpy,
8 scipy,
9 pytestCheckHook,
10 pytest-timeout,
11 pytest-harvest,
12 matplotlib,
13 decorator,
14 jinja2,
15 pooch,
16 tqdm,
17 packaging,
18 importlib-resources,
19 lazy-loader,
20 h5io,
21 pymatreader,
22 pythonOlder,
23}:
24
25buildPythonPackage rec {
26 pname = "mne-python";
27 version = "1.6.1";
28 pyproject = true;
29
30 disabled = pythonOlder "3.8";
31
32 src = fetchFromGitHub {
33 owner = "mne-tools";
34 repo = "mne-python";
35 rev = "refs/tags/v${version}";
36 hash = "sha256-U1aMqcUZ3BcwqwOYh/qfG5PhacwBVioAgNc52uaoJL0";
37 };
38
39 postPatch = ''
40 substituteInPlace pyproject.toml \
41 --replace "--cov-report=" "" \
42 --replace "--cov-branch" ""
43 '';
44
45 nativeBuildInputs = [
46 setuptools
47 setuptools-scm
48 ];
49
50 propagatedBuildInputs = [
51 numpy
52 scipy
53 matplotlib
54 tqdm
55 pooch
56 decorator
57 packaging
58 jinja2
59 lazy-loader
60 ] ++ lib.optionals (pythonOlder "3.9") [ importlib-resources ];
61
62 passthru.optional-dependencies = {
63 hdf5 = [
64 h5io
65 pymatreader
66 ];
67 };
68
69 nativeCheckInputs = [
70 pytestCheckHook
71 pytest-timeout
72 pytest-harvest
73 ] ++ lib.flatten (builtins.attrValues passthru.optional-dependencies);
74
75 preCheck = ''
76 export HOME=$(mktemp -d)
77 export MNE_SKIP_TESTING_DATASET_TESTS=true
78 export MNE_SKIP_NETWORK_TESTS=1
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}