1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6
7 # build-system
8 setuptools,
9
10 # dependencies
11 matplotlib,
12 numpy,
13 pandas,
14 requests,
15 scikit-learn,
16 scipy,
17
18 # tests
19 astropy,
20 coverage,
21 mock,
22 plotly,
23 pytest-cov-stub,
24 pytestCheckHook,
25}:
26
27buildPythonPackage rec {
28 pname = "neurokit2";
29 version = "0.2.10";
30 pyproject = true;
31
32 src = fetchFromGitHub {
33 owner = "neuropsychology";
34 repo = "NeuroKit";
35 tag = "v${version}";
36 hash = "sha256-e/B1JvO6uYZ6iVskFvxZLSSXi0cPep9bBZ0JXZTVS28=";
37 };
38
39 postPatch = ''
40 substituteInPlace setup.py \
41 --replace-fail '"pytest-runner", ' ""
42 '';
43
44 build-system = [
45 setuptools
46 ];
47
48 dependencies = [
49 matplotlib
50 numpy
51 pandas
52 requests
53 scikit-learn
54 scipy
55 ];
56
57 nativeCheckInputs = [
58 pytest-cov-stub
59 mock
60 plotly
61 astropy
62 coverage
63 pytestCheckHook
64 ];
65
66 disabledTests = lib.optionals stdenv.hostPlatform.isDarwin [
67 # Crash in matplotlib (Fatal Python error: Aborted)
68 "test_events_plot"
69 ];
70
71 disabledTestPaths = [
72 # Required dependencies not available in nixpkgs
73 "tests/tests_bio.py"
74 "tests/tests_complexity.py"
75 "tests/tests_data.py"
76 "tests/tests_ecg.py"
77 "tests/tests_ecg_delineate.py"
78 "tests/tests_ecg_findpeaks.py"
79 "tests/tests_eda.py"
80 "tests/tests_eeg.py"
81 "tests/tests_emg.py"
82 "tests/tests_eog.py"
83 "tests/tests_epochs.py"
84 "tests/tests_hrv.py"
85 "tests/tests_ppg.py"
86 "tests/tests_rsp.py"
87 "tests/tests_signal.py"
88
89 # Dependency is broken `mne-python`
90 "tests/tests_microstates.py"
91 ];
92
93 pytestFlagsArray = [
94 # Otherwise, test collection fails with:
95 # AttributeError: module 'scipy.ndimage._delegators' has no attribute '@py_builtins_signature'. Did you mean: 'grey_dilation_signature'?
96 # https://github.com/scipy/scipy/issues/22236
97 "--assert=plain"
98 ];
99
100 pythonImportsCheck = [
101 "neurokit2"
102 ];
103
104 meta = {
105 description = "Python Toolbox for Neurophysiological Signal Processing";
106 homepage = "https://github.com/neuropsychology/NeuroKit";
107 changelog = "https://github.com/neuropsychology/NeuroKit/releases/tag/v${version}";
108 license = lib.licenses.mit;
109 maintainers = with lib.maintainers; [ genga898 ];
110 };
111}