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.8.0";
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-WPRTX8yB4oP/L5DjSq9M6WOmHJDpQv0sAbuosp7ZGVw=";
35 };
36
37 postPatch = ''
38 substituteInPlace pyproject.toml \
39 --replace-fail "--cov-report=" "" \
40 --replace-fail "--cov-branch" ""
41 '';
42
43 build-system = [
44 hatchling
45 hatch-vcs
46 ];
47
48 dependencies = [
49 numpy
50 scipy
51 matplotlib
52 tqdm
53 pooch
54 decorator
55 packaging
56 jinja2
57 lazy-loader
58 ];
59
60 optional-dependencies.hdf5 = [
61 h5io
62 pymatreader
63 ];
64
65 nativeCheckInputs = [
66 pytestCheckHook
67 pytest-timeout
68 ] ++ lib.flatten (builtins.attrValues 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 # requires qtbot which is unmaintained/not in Nixpkgs:
78 "test_plotting_scalebars"
79 # tries to write a datetime object to hdf5, which fails:
80 "test_hitachi_basic"
81 ];
82
83 pythonImportsCheck = [ "mne" ];
84
85 meta = with lib; {
86 description = "Magnetoencephelography and electroencephalography in Python";
87 mainProgram = "mne";
88 homepage = "https://mne.tools";
89 changelog = "https://mne.tools/stable/changes/v${version}.html";
90 license = licenses.bsd3;
91 maintainers = with maintainers; [
92 bcdarwin
93 mbalatsko
94 ];
95 };
96}