summary refs log tree commit diff
diff options
context:
space:
mode:
authorLars-Dominik Braun <lars@6xq.net>2021-07-21 11:48:07 +0200
committerLars-Dominik Braun <lars@6xq.net>2021-07-21 13:36:08 +0200
commitd57c34d26b8b5a7d17a5b8811742c5f291567209 (patch)
treef627f4d7bc311a5e3216c0be0fbbea50cda739ac
parent73830b5da3f71d4418e07e28544207dad2d0809f (diff)
downloadguix-d57c34d26b8b5a7d17a5b8811742c5f291567209.tar.gz
gnu: Add python-bash-kernel.
* gnu/packages/jupyter.scm (python-bash-kernel): New variable.
-rw-r--r--gnu/packages/jupyter.scm41
1 files changed, 41 insertions, 0 deletions
diff --git a/gnu/packages/jupyter.scm b/gnu/packages/jupyter.scm
index 2fb0b0375a..ede22363c3 100644
--- a/gnu/packages/jupyter.scm
+++ b/gnu/packages/jupyter.scm
@@ -25,6 +25,7 @@
   #:use-module (guix git-download)
   #:use-module (guix build-system cmake)
   #:use-module (guix build-system python)
+  #:use-module (gnu packages bash)
   #:use-module (gnu packages check)
   #:use-module (gnu packages cpp)
   #:use-module (gnu packages linux)
@@ -382,3 +383,43 @@ used to explore a repository locally by building and executing the constructed
 image of the repository, or as a means of building images that are pushed to a
 Docker registry.")
     (license license:bsd-3)))
+
+(define-public python-bash-kernel
+  (package
+   (name "python-bash-kernel")
+   (version "0.7.2")
+   (source (origin
+            (method url-fetch)
+            (uri (pypi-uri "bash_kernel" version))
+            (sha256
+             (base32
+              "0w0nbr3iqqsgpk83rgd0f5b02462bkyj2n0h6i9dwyc1vpnq9350"))))
+   (build-system python-build-system)
+   (arguments
+    `(#:tests? #f
+      #:phases
+      (modify-phases %standard-phases
+        (add-after 'unpack 'bash-references
+          (lambda* (#:key inputs #:allow-other-keys)
+             (substitute* "bash_kernel/kernel.py"
+               (("\"bash\"")
+                (string-append "\"" (assoc-ref inputs "bash") "/bin/bash\""))
+               (("\\['bash', ")
+                (string-append "['" (assoc-ref inputs "bash") "/bin/bash', ")))
+             #t))
+        (add-after 'install 'install-kernelspec
+          (lambda* (#:key outputs #:allow-other-keys)
+            (let ((out (assoc-ref outputs "out")))
+              (setenv "HOME" "/tmp")
+              (invoke "python" "-m" "bash_kernel.install" "--prefix" out)
+              #t))))))
+   (inputs
+     `(("bash" ,bash)))
+   (propagated-inputs
+     `(("python-pexpect" ,python-pexpect)
+       ("python-ipykernel" ,python-ipykernel)
+       ("python-jupyter-client" ,python-jupyter-client)))
+   (home-page "https://github.com/takluyver/bash_kernel")
+   (synopsis "Jupyter kernel for Bash")
+   (description "A bash shell kernel for Jupyter.")
+   (license license:expat)))