Subject: [bug#53402] Add python-mne

From: Vivien <[email-masked]>
Date: Thu, 20 Jan 2022 23:46:54 +0100

Dear guix,

I am trying to get python-mne package [1]. So far I’ve managed to get
all the advertised dependencies, but I can’t get the tests to pass.

For python-nitime, I get IndexError: tuple index out of range

For python-mne, I get TypeError: annotate_nan() missing 1 required
positional argument: 'raw'

Both errors seem to occur because a function with optional or keyword
arguments is called without enough arguments. However, I can disable
all tests that call the function, but the error stays there.

Can someone help me?

Best regards,

Vivien

[1]: https://mne.tools/stable/index.html
From fd3a98301780eb74322db87da641dcd2c41ad76a Mon Sep 17 00:00:00 2001
From: Vivien Kraus <[email-masked]>
Date: Thu, 20 Jan 2022 23:21:25 +0100
Subject: [PATCH 18/18] gnu: Add python-mne.

* gnu/packages/python-science.scm (python-mne): New variable.
---
 gnu/packages/python-science.scm | 48 +++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)

diff --git a/gnu/packages/python-science.scm b/gnu/packages/python-science.scm
index f893c63a82..adad5131df 100644
--- a/gnu/packages/python-science.scm
+++ b/gnu/packages/python-science.scm
@@ -39,6 +39,7 @@ (define-module (gnu packages python-science)
   #:use-module (gnu packages databases)
   #:use-module (gnu packages gcc)
   #:use-module (gnu packages image-processing)
+  #:use-module (gnu packages jupyter)
   #:use-module (gnu packages machine-learning)
   #:use-module (gnu packages maths)
   #:use-module (gnu packages mpi)
@@ -1207,3 +1208,50 @@ (define-public python-nitime
 to express with compact and semantically clear code.")
     (license license:bsd-3)))
 
+(define-public python-mne
+  (package
+    (name "python-mne")
+    (version "0.24.1")
+    (source (origin
+              (method url-fetch)
+              (uri (pypi-uri "mne" version))
+              (sha256
+               (base32
+                "039h0pwcvl4ywfa4ij7w6x61czd322csqr59yhzfil3a7b8gzjrq"))))
+    (build-system python-build-system)
+    (arguments
+     (list #:phases
+           #~(modify-phases %standard-phases
+               (add-before 'check 'set-home
+                 (lambda _
+                   (setenv "HOME"
+                           (getcwd)))))))
+    (propagated-inputs (list python-numpy python-scipy))
+    (native-inputs (list python-check-manifest
+                         python-codespell
+                         python-edflib
+                         python-eeglabio
+                         python-flake8
+                         python-flake8-array-spacing
+                         python-imageio-ffmpeg
+                         python-nbclient
+                         python-nitime
+                         python-numpydoc
+                         python-pooch
+                         python-pydocstyle
+                         python-pytest
+                         python-pytest-cov
+                         python-pytest-harvest
+                         python-pytest-timeout
+                         python-sphinx-gallery
+                         python-twine
+                         python-wheel))
+    (home-page "https://mne.tools/dev/")
+    (synopsis "MNE-Python project for MEG and EEG data analysis")
+    (description
+     "Open-source Python package for exploring, visualizing, and
+analyzing human neurophysiological data: MEG, EEG, sEEG, ECoG, NIRS, and
+more.")
+    (license license:bsd-3)))
+
+
-- 
2.34.0

From 403d8a97cb6abd6feda72167fabb2e6842eae847 Mon Sep 17 00:00:00 2001
From: Vivien Kraus <[email-masked]>
Date: Thu, 20 Jan 2022 23:00:37 +0100
Subject: [PATCH 17/18] gnu: python-pooch: Update to 1.5.2.

* gnu/packages/python-xyz.scm (python-pooch): Update to 1.5.2.
[native-inputs]: Add python-setuptools-scm.
---
 gnu/packages/python-xyz.scm | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 0f85efd085..b386bd93bf 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -22095,18 +22095,20 @@ (define-public pybind11
 (define-public python-pooch
   (package
     (name "python-pooch")
-    (version "1.3.0")
+    (version "1.5.2")
     (source
      (origin
        (method url-fetch)
        (uri (pypi-uri "pooch" version))
        (sha256
-        (base32 "1618adsg9r8fsv422sv35z1i723q3a1iir5v7dv2sklh4pl4im1h"))))
+        (base32 "109my6dwj2r6gxfzkw973ivy4dmmw02pwxijz5fl1p7vvvqv4sar"))))
     (build-system python-build-system)
     (arguments
      `(#:tests? #f)) ;requires online data
     (propagated-inputs
      (list python-appdirs python-packaging python-requests))
+    (native-inputs
+     (list python-setuptools-scm))
     (home-page "https://github.com/fatiando/pooch")
     (synopsis "Manage your Python library's sample data files")
     (description
-- 
2.34.0

From b5687abe6b2e7d03c1cb35c31f707f6b534ffca6 Mon Sep 17 00:00:00 2001
From: Vivien Kraus <[email-masked]>
Date: Thu, 20 Jan 2022 22:36:06 +0100
Subject: [PATCH 16/18] gnu: Add python-pytest-steps.

* gnu/packages/python-xyz.scm (python-pytest-steps): New variable.
---
 gnu/packages/python-xyz.scm | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 6d57192ccb..0f85efd085 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -28922,3 +28922,17 @@ (define-public python-pytest-harvest
                          python-tabulate
                          python-pandas))
     (propagated-inputs (list python-decopatch python-makefun python-six))))
+
+(define-public python-pytest-steps
+  (package
+    (inherit python-pytest-steps-minimal)
+    (name "python-pytest-steps")
+    (arguments
+     `(#:phases (modify-phases %standard-phases
+                  (add-after 'unpack 'move-pytests-plugins
+                    (lambda _
+                      (rename-file "pytest_steps/tests/conftest.py"
+                                   "conftest.py"))))))
+    (native-inputs (list python-pytest python-pytest-runner
+                         python-setuptools-scm python-pytest-cases
+                         python-pytest-harvest))))
-- 
2.34.0

From 828f5207b4e8a09a0e166ed89047a91617e84324 Mon Sep 17 00:00:00 2001
From: Vivien Kraus <[email-masked]>
Date: Thu, 20 Jan 2022 22:35:49 +0100
Subject: [PATCH 15/18] gnu: Add python-pytest-harvest.

* gnu/packages/python-xyz.scm (python-pytest-harvest): New variable.
---
 gnu/packages/python-xyz.scm | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index ea4de06935..6d57192ccb 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -28904,3 +28904,21 @@ (define-public python-pytest-cases
     (arguments
      '())
     (propagated-inputs (list python-decopatch python-makefun))))
+
+(define-public python-pytest-harvest
+  (package
+    (inherit python-pytest-harvest-minimal)
+    (name "python-pytest-harvest")
+    (arguments
+     `(#:phases (modify-phases %standard-phases
+                  (add-after 'unpack 'move-pytests-plugins
+                    (lambda _
+                      (rename-file "pytest_harvest/tests/conftest.py"
+                                   "conftest.py"))))))
+    (native-inputs (list python-pytest
+                         python-pytest-runner
+                         python-setuptools-scm
+                         python-pytest-cases
+                         python-tabulate
+                         python-pandas))
+    (propagated-inputs (list python-decopatch python-makefun python-six))))
-- 
2.34.0

From 0f7cf284984f10216cc68a9b4ad00efaec797d34 Mon Sep 17 00:00:00 2001
From: Vivien Kraus <[email-masked]>
Date: Thu, 20 Jan 2022 22:35:28 +0100
Subject: [PATCH 14/18] gnu: Add python-pytest-cases.

* gnu/packages/python-xyz.scm (python-pytest-cases): New variable.
---
 gnu/packages/python-xyz.scm | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index d735e62a80..ea4de06935 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -28896,3 +28896,11 @@ (define-public python-decopatch
     (native-inputs (list python-pytest python-pytest-runner
                          python-pytest-cases-minimal python-setuptools-scm
                          python-pytest-logging))))
+
+(define-public python-pytest-cases
+  (package
+    (inherit python-pytest-cases-minimal)
+    (name "python-pytest-cases")
+    (arguments
+     '())
+    (propagated-inputs (list python-decopatch python-makefun))))
-- 
2.34.0

From 00862d03e5a88685b28e1efa8c6356ba3e6f22bb Mon Sep 17 00:00:00 2001
From: Vivien Kraus <[email-masked]>
Date: Thu, 20 Jan 2022 22:35:02 +0100
Subject: [PATCH 13/18] gnu: Add python-decopatch.

* gnu/packages/python-xyz.scm (python-decopatch): New variable.
---
 gnu/packages/python-xyz.scm | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index cccd4e2b03..d735e62a80 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -28875,3 +28875,24 @@ (define python-pytest-cases-minimal
 possibilities such as using fixture references as parameter values in a test
 function.")
     (license license:bsd-3)))
+
+(define-public python-decopatch
+  (package
+    (inherit python-decopatch-minimal)
+    (name "python-decopatch")
+    (arguments
+     `(#:phases (modify-phases %standard-phases
+                  (add-after 'unpack 'disable-failing-tests
+                    (lambda _
+                      (delete-file "decopatch/tests/test_main2.py")
+                      (delete-file
+                       "decopatch/tests/test_main2_parametrizers.py")
+                      (delete-file "decopatch/tests/test_introspection.py")
+                      (delete-file
+                       "decopatch/tests/test_introspection_base.py")
+                      (substitute* "decopatch/tests/test_doc_advanced.py"
+                        (("'uses_introspection', \\[True, False\\]")
+                         "'uses_introspection', [False]")))))))
+    (native-inputs (list python-pytest python-pytest-runner
+                         python-pytest-cases-minimal python-setuptools-scm
+                         python-pytest-logging))))
-- 
2.34.0

From 588f0fa31e00c48e87a1a222e126ef7307eff5a6 Mon Sep 17 00:00:00 2001
From: Vivien Kraus <[email-masked]>
Date: Thu, 20 Jan 2022 22:34:36 +0100
Subject: [PATCH 12/18] gnu: Add a test-less python-pytest-cases.

* gnu/packages/python-xyz.scm (python-pytest-cases-minimal): New variable.
---
 gnu/packages/python-xyz.scm | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 57cc09ae18..cccd4e2b03 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -28844,3 +28844,34 @@ (define python-pytest-steps-minimal
     (synopsis "Create step-wise / incremental tests in pytest")
     (description "Create step-wise / incremental tests in pytest.")
     (license license:bsd-3)))
+
+(define python-pytest-cases-minimal
+  (package
+    (name "python-pytest-cases-minimal")
+    (version "3.6.8")
+    (source (origin
+              (method url-fetch)
+              (uri (pypi-uri "pytest-cases" version))
+              (sha256
+               (base32
+                "1g3lp4m19fk83kl2b4akwg7wqqaqlfzp4v6qcb0hq27161xyh8yl"))))
+    (build-system python-build-system)
+    (propagated-inputs (list python-decopatch-minimal python-makefun))
+    (native-inputs (list python-pytest
+                         python-pytest-runner
+                         python-setuptools-scm
+                         python-pytest-asyncio
+                         python-pytest-harvest-minimal
+                         python-pytest-steps-minimal))
+    (home-page "https://github.com/smarie/python-pytest-cases")
+    (synopsis "Separate test code from test cases in @samp{pytest}")
+    (description
+     "@samp{pytest-cases} leverages @samp{pytest} and its great
+@samp{@@pytest.mark.parametrize decorator}, so that you can @strong{separate
+your test cases from your test functions}.  In addition, @samp{pytest-cases}
+provides several useful goodies to empower @samp{pytest}.  In particular it
+improves the fixture mechanism to support \"fixture unions\".  This is a
+@strong{major change} in the internal @samp{pytest} engine, unlocking many
+possibilities such as using fixture references as parameter values in a test
+function.")
+    (license license:bsd-3)))
-- 
2.34.0

From 78a9c8f55f3c3cb010592050c5778922049e9cf8 Mon Sep 17 00:00:00 2001
From: Vivien Kraus <[email-masked]>
Date: Thu, 20 Jan 2022 22:34:06 +0100
Subject: [PATCH 11/18] gnu: Add a test-less python-pytest-steps.

* gnu/packages/python-xyz.scm (python-pytest-steps-minimal): New variable.
---
 gnu/packages/python-xyz.scm | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 15bd70fa8f..57cc09ae18 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -28822,3 +28822,25 @@ (define python-pytest-harvest-minimal
      "Store data created during your pytest tests execution, and retrieve it
 at the end of the session, e.g.  for applicative benchmarking purposes.")
     (license license:bsd-3)))
+
+(define python-pytest-steps-minimal
+  (package
+    (name "python-pytest-steps-minimal")
+    (version "1.8.0")
+    (source (origin
+              (method url-fetch)
+              (uri (pypi-uri "pytest-steps" version))
+              (sha256
+               (base32
+                "05r2ch7191saj7sw6d47bfa5vnyyj157dl8hvlcc78xx6jyxy46j"))))
+    (build-system python-build-system)
+    (arguments
+     `(#:tests? #f))
+    (propagated-inputs (list python-makefun python-wrapt python-tabulate
+                             python-pandas))
+    (native-inputs (list python-pytest python-pytest-runner
+                         python-setuptools-scm))
+    (home-page "https://github.com/smarie/python-pytest-steps")
+    (synopsis "Create step-wise / incremental tests in pytest")
+    (description "Create step-wise / incremental tests in pytest.")
+    (license license:bsd-3)))
-- 
2.34.0

From 98c7d608d0d364a4bb94e787bafb7a4d844818b5 Mon Sep 17 00:00:00 2001
From: Vivien Kraus <[email-masked]>
Date: Thu, 20 Jan 2022 22:33:32 +0100
Subject: [PATCH 10/18] gnu: Add a test-less python-pytest-harvest.

* gnu/packages/python-xyz.scm (python-pytest-harvest-minimal): New variable.
---
 gnu/packages/python-xyz.scm | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index d51deec454..15bd70fa8f 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -28798,3 +28798,27 @@ (define python-decopatch-minimal
 @samp{decopatch} provides a simple way to solve this issue so that writing
 decorators is simple and straightforward.")
     (license license:bsd-3)))
+
+(define python-pytest-harvest-minimal
+  (package
+    (name "python-pytest-harvest-minimal")
+    (version "1.10.3")
+    (source (origin
+              (method url-fetch)
+              (uri (pypi-uri "pytest-harvest" version))
+              (sha256
+               (base32
+                "092drlh96rhikwqqyfpwqhkzfzd7z8m5gbmjgky8npm81849jbsk"))))
+    (build-system python-build-system)
+    (arguments
+     `(#:tests? #f))
+    (propagated-inputs (list python-decopatch-minimal python-makefun
+                             python-six))
+    (native-inputs (list python-pytest python-pytest-runner
+                         python-setuptools-scm))
+    (home-page "https://github.com/smarie/python-pytest-harvest")
+    (synopsis "Store data created during your @samp{pytest} tests execution")
+    (description
+     "Store data created during your pytest tests execution, and retrieve it
+at the end of the session, e.g.  for applicative benchmarking purposes.")
+    (license license:bsd-3)))
-- 
2.34.0

From 295ef673a26d67b06f1d11e66dd49b1dc45de680 Mon Sep 17 00:00:00 2001
From: Vivien Kraus <[email-masked]>
Date: Thu, 20 Jan 2022 22:32:53 +0100
Subject: [PATCH 09/18] gnu: Add a test-less python-decopatch.

* gnu/packages/python-xyz.scm (python-decopatch-minimal): New variable.
---
 gnu/packages/python-xyz.scm | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 6522026717..d51deec454 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -28768,3 +28768,33 @@ (define-public python-pytest-logging
     (description
      "Configures logging and allows tweaking the log level with a py.test flag.")
     (license license:asl2.0)))
+
+;; decopatch requires the next pytest modules if tests are enabled. The pytest
+;; modules require each other for tests.
+
+(define python-decopatch-minimal
+  (package
+    (name "python-decopatch-minimal")
+    (version "1.4.8")
+    (source (origin
+              (method url-fetch)
+              (uri (pypi-uri "decopatch" version))
+              (sha256
+               (base32
+                "0i6i811s2j1z0cl6y177dwsbfxib8dvb5c2jpgklvc2xy4ahhsy6"))))
+    (build-system python-build-system)
+    (arguments
+     `(#:tests? #f))
+    (propagated-inputs (list python-makefun))
+    (native-inputs (list python-pytest python-pytest-runner
+                         python-setuptools-scm))
+    (home-page "https://github.com/smarie/python-decopatch")
+    (synopsis "Python decorators made easy")
+    (description
+     "Because of a tiny oddity in the python language, writing
+decorators without help can be a pain because you have to handle the
+no-parenthesis usage
+@url{https://smarie.github.io/python-decopatch/motivation, explicitly}.
+@samp{decopatch} provides a simple way to solve this issue so that writing
+decorators is simple and straightforward.")
+    (license license:bsd-3)))
-- 
2.34.0

From 1014887ed2f54ba2f856f8e5313b6427c4718753 Mon Sep 17 00:00:00 2001
From: Vivien Kraus <[email-masked]>
Date: Thu, 20 Jan 2022 22:32:09 +0100
Subject: [PATCH 08/18] gnu: Add python-pytest-logging.

* gnu/packages/python-xyz.scm (python-pytest-logging): New variable.
---
 gnu/packages/python-xyz.scm | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index f09f4abf57..6522026717 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -28749,3 +28749,22 @@ (define-public python-makefun
 the signature of your choice.  It was largely inspired by @samp{decorator} and
 @samp{functools}, and created mainly to cover some of their limitations.")
     (license license:bsd-3)))
+
+(define-public python-pytest-logging
+  (package
+    (name "python-pytest-logging")
+    (version "2015.11.4")
+    (source (origin
+              (method url-fetch)
+              (uri (pypi-uri "pytest-logging" version))
+              (sha256
+               (base32
+                "15n8fyxvvwmk982vj0m9yl76hn7pp4qqljfmxarbgahqrxgciiff"))))
+    (build-system python-build-system)
+    (propagated-inputs (list python-pytest))
+    (home-page "https://github.com/saltstack/pytest-logging")
+    (synopsis
+     "Configures logging and allows tweaking the log level with a py.test flag")
+    (description
+     "Configures logging and allows tweaking the log level with a py.test flag.")
+    (license license:asl2.0)))
-- 
2.34.0

From 832290c3306d4032a85cc715489c9015725f13da Mon Sep 17 00:00:00 2001
From: Vivien Kraus <[email-masked]>
Date: Thu, 20 Jan 2022 21:17:39 +0100
Subject: [PATCH 07/18] gnu: Add python-makefun.

* gnu/packages/python-xyz.scm (python-makefun): New variable.
---
 gnu/packages/python-xyz.scm | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index af05195513..f09f4abf57 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -28728,3 +28728,24 @@ (define-public python-flake8-array-spacing
     (synopsis "flake8 plugin to make exceptions for array-like variables")
     (description "Recast some E2XX errors as A2XX with exceptions for array-like variables.")
     (license license:bsd-3)))
+
+(define-public python-makefun
+  (package
+    (name "python-makefun")
+    (version "1.13.1")
+    (source (origin
+              (method url-fetch)
+              (uri (pypi-uri "makefun" version))
+              (sha256
+               (base32
+                "1gqnqvwzig9ym4nyzwy6dzra7sg6339rdaca59fvkfzzf2vbhnwq"))))
+    (build-system python-build-system)
+    (native-inputs (list python-pytest python-pytest-runner
+                         python-setuptools-scm))
+    (home-page "https://github.com/smarie/python-makefun")
+    (synopsis "Small library to dynamically create python functions")
+    (description
+     "@samp{makefun} helps you create functions dynamically, with
+the signature of your choice.  It was largely inspired by @samp{decorator} and
+@samp{functools}, and created mainly to cover some of their limitations.")
+    (license license:bsd-3)))
-- 
2.34.0

From d3a4b630edefa42976662f233736a0d4b3af4098 Mon Sep 17 00:00:00 2001
From: Vivien Kraus <[email-masked]>
Date: Thu, 20 Jan 2022 19:20:06 +0100
Subject: [PATCH 06/18] gnu: Add python-flake8-array-spacing.

* gnu/packages/python-science.scm (python-flake8-array-spacing): New variable.
---
 gnu/packages/python-science.scm |  1 +
 gnu/packages/python-xyz.scm     | 17 +++++++++++++++++
 2 files changed, 18 insertions(+)

diff --git a/gnu/packages/python-science.scm b/gnu/packages/python-science.scm
index fb14aff62f..f893c63a82 100644
--- a/gnu/packages/python-science.scm
+++ b/gnu/packages/python-science.scm
@@ -1206,3 +1206,4 @@ (define-public python-nitime
 level interface to the numerical machinery and make common analysis tasks easy
 to express with compact and semantically clear code.")
     (license license:bsd-3)))
+
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index c0b1fe9872..af05195513 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -28711,3 +28711,20 @@ (define-public python-imageio-ffmpeg
 publishing platform-specific wheels that include the binary @samp{ffmpeg}
 executables.")
     (license license:bsd-2)))
+
+(define-public python-flake8-array-spacing
+  (package
+    (name "python-flake8-array-spacing")
+    (version "0.2.0")
+    (source
+      (origin
+        (method url-fetch)
+        (uri (pypi-uri "flake8_array_spacing" version))
+        (sha256
+          (base32 "0nyp2x45hg5dkdrn0j2wcd336dnx6csizpfq5fwbk774wrb0lh6d"))))
+    (build-system python-build-system)
+    (propagated-inputs (list python-flake8 python-pycodestyle))
+    (home-page "https://github.com/larsoner/flake8-array-spacing")
+    (synopsis "flake8 plugin to make exceptions for array-like variables")
+    (description "Recast some E2XX errors as A2XX with exceptions for array-like variables.")
+    (license license:bsd-3)))
-- 
2.34.0

From d113d457d3777b924a5ff1c40b98ad4720c9b1f5 Mon Sep 17 00:00:00 2001
From: Vivien Kraus <[email-masked]>
Date: Thu, 20 Jan 2022 19:12:02 +0100
Subject: [PATCH 05/18] gnu: Add python-nitime.

* gnu/packages/python-science.scm (python-nitime): New variable.
---
 gnu/packages/python-science.scm | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/gnu/packages/python-science.scm b/gnu/packages/python-science.scm
index a79aacec03..fb14aff62f 100644
--- a/gnu/packages/python-science.scm
+++ b/gnu/packages/python-science.scm
@@ -1176,3 +1176,33 @@ (define-public python-nibabel
 limited support for @url{http://medical.nema.org/, DICOM}.  NiBabel is the
 successor of @url{http://niftilib.sourceforge.net/pynifti/, PyNIfTI}.")
     (license license:expat)))
+
+(define-public python-nitime
+  (package
+    (name "python-nitime")
+    (version "0.9")
+    (source (origin
+              (method url-fetch)
+              (uri (pypi-uri "nitime" version))
+              (sha256
+               (base32
+                "0x1q6ka8i330yhp5h0h6igfs2gp5dndiybyfkdi45a8zpfnr0zbf"))))
+    (build-system python-build-system)
+    (propagated-inputs (list python-matplotlib python-networkx python-nibabel
+                             python-numpy python-scipy))
+    (native-inputs (list python-cython))
+    (arguments
+     (list #:phases
+           #~(modify-phases %standard-phases
+               (add-after 'unpack 'delete-generated-cython
+                 (lambda _
+                   (delete-file "nitime/_utils.c"))))))
+    (home-page "http://nipy.org/nitime/")
+    (synopsis "Nitime: timeseries analysis for neuroscience data")
+    (description
+     "Nitime contains a core of numerical algorithms for
+time-series analysis both in the time and spectral domains, a set of container
+objects to represent time-series, and auxiliary objects that expose a high
+level interface to the numerical machinery and make common analysis tasks easy
+to express with compact and semantically clear code.")
+    (license license:bsd-3)))
-- 
2.34.0

From 7e59b85005be2e61979e216e070bed99de8cae02 Mon Sep 17 00:00:00 2001
From: Vivien Kraus <[email-masked]>
Date: Thu, 20 Jan 2022 17:38:47 +0100
Subject: [PATCH 04/18] gnu: Add python-nibabel.

* gnu/packages/python-science.scm (python-nibabel): New variable.
---
 gnu/packages/python-science.scm | 63 +++++++++++++++++++++++++++++++++
 1 file changed, 63 insertions(+)

diff --git a/gnu/packages/python-science.scm b/gnu/packages/python-science.scm
index e6a15ae27f..a79aacec03 100644
--- a/gnu/packages/python-science.scm
+++ b/gnu/packages/python-science.scm
@@ -54,6 +54,7 @@ (define-module (gnu packages python-science)
   #:use-module (gnu packages sphinx)
   #:use-module (gnu packages statistics)
   #:use-module (gnu packages time)
+  #:use-module (gnu packages version-control)
   #:use-module (gnu packages xdisorg)
   #:use-module (gnu packages xml)
   #:use-module (gnu packages xorg)
@@ -1113,3 +1114,65 @@ (define-public python-eeglabio
     (synopsis "I/O support for EEGLAB files in Python")
     (description "I/O support for EEGLAB files in Python.")
     (license license:bsd-3)))
+
+(define-public python-nibabel
+  (package
+    (name "python-nibabel")
+    (version "3.2.1")
+    (source (origin
+              (method url-fetch)
+              (uri (pypi-uri "nibabel" version))
+              (sha256
+               (base32
+                "17n23w7y0hiz2vma5si7wy184d59bp14zd8nr6hi203ldd1gjbsd"))))
+    (build-system python-build-system)
+    (arguments
+     (list #:phases
+           #~(modify-phases %standard-phases
+               (add-after 'unpack 'fix-tests
+                 (lambda _
+                   ;; Some tests have a setup function, but it is not called
+                   ;; (!)
+                   (for-each (lambda (fix)
+                               (let ((file (open-file (string-append
+                                                       "nibabel/streamlines/tests/test_"
+                                                       (car fix) ".py") "a")))
+                                 (format file "
+~a()"
+                                         (cdr fix))
+                                 (close-port file)))
+                             '(("array_sequence" . "setup_module")
+                               ("streamlines" . "setup")
+                               ("tck" . "setup_module")
+                               ("tractogram" . "setup_module")
+                               ("trk" . "setup_module"))))))))
+    (propagated-inputs (list python-numpy python-packaging))
+    (native-inputs (list python-coverage
+                         python-gitpython
+                         python-pytest
+                         python-pytest-cov
+                         python-pytest-doctestplus
+                         python-twine))
+    (home-page "https://nipy.org/nibabel/")
+    (synopsis "Access a multitude of neuroimaging data formats")
+    (description
+     "This package provides read +/- write access to some common
+medical and neuroimaging file formats, including:
+@url{http://www.grahamwideman.com/gw/brain/analyze/formatdoc.htm,
+ANALYZE} (plain, SPM99, SPM2 and later),
+@url{https://www.nitrc.org/projects/gifti, GIFTI},
+@url{http://nifti.nimh.nih.gov/nifti-1/, NIfTI1},
+@url{http://nifti.nimh.nih.gov/nifti-2/, NIfTI2},
+@url{https://www.nitrc.org/projects/cifti/, CIFTI-2},
+@url{https://en.wikibooks.org/wiki/MINC/Reference/MINC1_File_Format_Reference,
+MINC1},
+@url{https://en.wikibooks.org/wiki/MINC/Reference/MINC2.0_File_Format_Reference,
+MINC2}, @url{https://afni.nimh.nih.gov/pub/dist/src/README.attributes, AFNI
+BRIK/HEAD},
+@url{https://surfer.nmr.mgh.harvard.edu/fswiki/FsTutorial/MghFormat, MGH} and
+@url{http://xmedcon.sourceforge.net/Docs/Ecat, ECAT} as well as Philips
+PAR/REC.  We can read and write @url{https://surfer.nmr.mgh.harvard.edu/,
+FreeSurfer} geometry, annotation and morphometry files.  There is some very
+limited support for @url{http://medical.nema.org/, DICOM}.  NiBabel is the
+successor of @url{http://niftilib.sourceforge.net/pynifti/, PyNIfTI}.")
+    (license license:expat)))
-- 
2.34.0

From 9a21f7bba1ef895d664115a70c27cdd7769bb108 Mon Sep 17 00:00:00 2001
From: Vivien Kraus <[email-masked]>
Date: Thu, 20 Jan 2022 17:17:11 +0100
Subject: [PATCH 03/18] gnu: Add python-eeglabio.

* gnu/packages/python-science.scm (python-eeglabio): New variable.
---
 gnu/packages/python-science.scm | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/gnu/packages/python-science.scm b/gnu/packages/python-science.scm
index 47b142494e..e6a15ae27f 100644
--- a/gnu/packages/python-science.scm
+++ b/gnu/packages/python-science.scm
@@ -1084,3 +1084,32 @@ (define-public python-edflib
 @url{https://www.teuniz.net/edfbrowser/bdfplus%20format%20description.html,
 24-bit version} of EDF.")
     (license license:bsd-3)))
+
+(define-public python-eeglabio
+  (package
+    (name "python-eeglabio")
+    (version "0.0.1.post6")
+    (source (origin
+              (method url-fetch)
+              (uri (pypi-uri "eeglabio" version))
+              (sha256
+               (base32
+                "0k70s8lg9b9mcs883kq8jgnj9wmxvb96q54w23f3zw38jjxw46gs"))))
+    (build-system python-build-system)
+    (arguments
+     (list #:phases
+           #~(modify-phases %standard-phases
+               (add-after 'unpack 'restore-requirements.txt
+                 (lambda _
+                   ;; requirements.txt is not distributed, but it is in the
+                   ;; source
+                   (call-with-output-file "requirements.txt"
+                     (lambda (port)
+                       (format port "numpy
+scipy
+"))))))))
+    (propagated-inputs (list python-numpy python-scipy))
+    (home-page "https://github.com/jackz314/eeglabio")
+    (synopsis "I/O support for EEGLAB files in Python")
+    (description "I/O support for EEGLAB files in Python.")
+    (license license:bsd-3)))
-- 
2.34.0

From b1c4e71b7ce091e57b247c879d41a9e058054606 Mon Sep 17 00:00:00 2001
From: Vivien Kraus <[email-masked]>
Date: Thu, 20 Jan 2022 15:47:30 +0100
Subject: [PATCH 02/18] gnu: Add python-edflib.

* gnu/packages/python-science.scm (python-edflib): New variable.
---
 gnu/packages/python-science.scm | 51 ++++++++++++++++++++++++++++++++-
 1 file changed, 50 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/python-science.scm b/gnu/packages/python-science.scm
index 1cfc8e5869..47b142494e 100644
--- a/gnu/packages/python-science.scm
+++ b/gnu/packages/python-science.scm
@@ -61,7 +61,8 @@ (define-module (gnu packages python-science)
   #:use-module (guix download)
   #:use-module (guix git-download)
   #:use-module (guix utils)
-  #:use-module (guix build-system python))
+  #:use-module (guix build-system python)
+  #:use-module (guix gexp))
 
 (define-public python-scipy
   (package
@@ -1035,3 +1036,51 @@ (define-public python-modin
 libraries, Modin provides seamless integration and compatibility with existing
 pandas code.")
     (license license:asl2.0)))
+
+(define-public python-edflib
+  (package
+    (name "python-edflib")
+    (version "1.0.6")
+    (source (origin
+              (method url-fetch)
+              (uri (pypi-uri "EDFlib-Python" version))
+              (sha256
+               (base32
+                "1g069kyibskx5q2mc494xgjhvdspw5lvk2xhn0kqcgq1h37x5lfv"))))
+    (build-system python-build-system)
+    (arguments
+     (list #:tests? #f
+           #:phases
+           #~(modify-phases %standard-phases
+               ;; XXX: PEP 517 manual build copied from python-isort.
+               (replace 'build
+                 (lambda _
+                   (setenv "SOURCE_DATE_EPOCH" "315532800")
+                   (invoke "python"
+                           "-m"
+                           "build"
+                           "--wheel"
+                           "--no-isolation"
+                           ".")))
+               (replace 'install
+                 (lambda _
+                   (let ((whl (car (find-files "dist" "\\.whl$"))))
+                     (invoke "pip"
+                             "--no-cache-dir"
+                             "--no-input"
+                             "install"
+                             "--no-deps"
+                             "--prefix"
+                             #$output
+                             whl)))))))
+    (propagated-inputs (list python-numpy python-pypa-build))
+    (home-page "https://www.teuniz.net/edflib_python/")
+    (synopsis "Read and write EDF+/BDF+ files")
+    (description
+     "EDFlib for Python is a programming library to read and write EDF+ and
+BDF+ files.  It also reads old-type EDF/BDF files.  @dfn{EDF} means
+@url{https://www.teuniz.net/edfbrowser/edf%20format%20description.html,
+European Data Format}.  @dfn{BDF} is the
+@url{https://www.teuniz.net/edfbrowser/bdfplus%20format%20description.html,
+24-bit version} of EDF.")
+    (license license:bsd-3)))
-- 
2.34.0

From 5c8b341c7d39cc88d723788416865e4d9e26b331 Mon Sep 17 00:00:00 2001
From: Vivien Kraus <[email-masked]>
Date: Thu, 20 Jan 2022 15:39:12 +0100
Subject: [PATCH 01/18] gnu: Add python-imageio-ffmpeg.

* gnu/packages/python-xyz.scm (python-imageio-ffmpeg): New variable.
---
 gnu/packages/python-xyz.scm | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index eff1c4259b..c0b1fe9872 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -28678,3 +28678,36 @@ (define-public python-reedsolo
 but not binary streams.")
     (license license:public-domain)))
 
+(define-public python-imageio-ffmpeg
+  (package
+    (name "python-imageio-ffmpeg")
+    (version "0.4.5")
+    (source (origin
+              (method url-fetch)
+              (uri (pypi-uri "imageio-ffmpeg" version))
+              (sha256
+               (base32
+                "0ff14079izsyxwf6ki68k9a7w5krjlal7lwqvzg2bbddl92l5spj"))))
+    (build-system python-build-system)
+    (arguments
+     `(#:phases (modify-phases %standard-phases
+                  (add-after 'unpack 'set-ffmpeg-exe
+                    (lambda* (#:key inputs #:allow-other-keys)
+                      ;; There are different strategies to find ffmpeg, we
+                      ;; only fix the last resort, "system ffmpeg command"
+                      (substitute* "imageio_ffmpeg/_utils.py"
+                        (("exe = \"ffmpeg\"")
+                         (format #f "exe = ~s"
+                                 (search-input-file
+                                  inputs "/bin/ffmpeg")))))))))
+    (inputs (list ffmpeg))
+    (home-page "https://github.com/imageio/imageio-ffmpeg")
+    (synopsis "@samp{ffmpeg} wrapper for Python")
+    (description
+     "The purpose of this project is to provide a simple and reliable
+@samp{ffmpeg} wrapper for working with video files.  It implements two simple
+generator functions for reading and writing data from/to ffmpeg, which
+reliably terminate the ffmpeg process when done.  It also takes care of
+publishing platform-specific wheels that include the binary @samp{ffmpeg}
+executables.")
+    (license license:bsd-2)))
-- 
2.34.0