GNU bug report logs - #31449
[PATCH 1/3] gnu: Add guile-simple-zmq.

Previous Next

Package: guix-patches;

Reported by: Rouby Pierre-Antoine <pierre-antoine.rouby <at> inria.fr>

Date: Mon, 14 May 2018 09:09:02 UTC

Severity: normal

Tags: patch

Done: ludo <at> gnu.org (Ludovic Courtès)

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 31449 in the body.
You can then email your comments to 31449 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#31449; Package guix-patches. (Mon, 14 May 2018 09:09:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Rouby Pierre-Antoine <pierre-antoine.rouby <at> inria.fr>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Mon, 14 May 2018 09:09:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Rouby Pierre-Antoine <pierre-antoine.rouby <at> inria.fr>
To: guix-patches <at> gnu.org
Cc: Rouby Pierre-Antoine <pierre-antoine.rouby <at> inria.fr>
Subject: [PATCH 1/3] gnu: Add guile-simple-zmq.
Date: Mon, 14 May 2018 11:07:51 +0200
* gnu/package/guile.scm (guile-simple-zmq): New variable.
---
 gnu/packages/guile.scm | 87 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 87 insertions(+)

diff --git a/gnu/packages/guile.scm b/gnu/packages/guile.scm
index 2af6f875e..9df59ba1d 100644
--- a/gnu/packages/guile.scm
+++ b/gnu/packages/guile.scm
@@ -66,6 +66,8 @@
   #:use-module (gnu packages version-control)
   #:use-module (gnu packages xdisorg)
   #:use-module (gnu packages xorg)
+  #:use-module (gnu packages networking)
+  #:use-module (gnu packages tls)
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix git-download)
@@ -2093,4 +2095,89 @@ It has a nice, simple s-expression based syntax.")
      "Guile-colorized provides you with a colorized REPL for GNU Guile.")
     (license license:gpl3+)))
 
+(define-public guile-simple-zmq
+  (package
+    (name "guile-simple-zmq")
+    (version "0.0.1")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/jerry40/guile-simple-zmq")
+             (commit "d76657aeb1cd10ef8136edc06bb90999914c7c3c")))
+       (sha256
+        (base32
+         "1w73dy5gpyv33jn34dqlkqpwh9w4y8wm6hgvbpb3wbp6xsa2mk4z"))))
+    (build-system trivial-build-system)
+    (arguments
+     `(#:modules ((guix build utils))
+       #:builder
+       (begin
+         (use-modules (guix build utils)
+                      (srfi srfi-26)
+                      (ice-9 match)
+                      (ice-9 popen)
+                      (ice-9 rdelim))
+
+         (let* ((out (assoc-ref %outputs "out"))
+                (guile (assoc-ref %build-inputs "guile"))
+                (effective (read-line
+                            (open-pipe* OPEN_READ
+                                        (string-append guile "/bin/guile")
+                                        "-c" "(display (effective-version))")))
+                (module-dir (string-append out "/share/guile/site/"
+                                           effective))
+                (go-dir     (string-append out "/lib/guile/"
+                                           effective "/site-ccache/"))
+                (source     (string-append (assoc-ref %build-inputs "source")
+                                           "/src"))
+                (scm-file "simple-zmq.scm")
+                (guild (string-append (assoc-ref %build-inputs "guile")
+                                      "/bin/guild"))
+                (zmq  (assoc-ref %build-inputs "zeromq"))
+                (deps (list zmq))
+                (path (string-join
+                       (map (cut string-append <>
+                                 "/lib/")
+                            deps)
+                       ":")))
+           ;; Make installation directories.
+           (mkdir-p module-dir)
+           (mkdir-p go-dir)
+
+           ;; Compile .scm files and install.
+           (chdir source)
+           (setenv "GUILE_AUTO_COMPILE" "0")
+           (for-each (lambda (file)
+                       (let* ((dest-file (string-append module-dir "/"
+                                                        file))
+                              (go-file (match (string-split file #\.)
+                                         ((base _)
+                                          (string-append go-dir "/"
+                                                         base ".go")))))
+                         ;; Install source module.
+                         (copy-file file dest-file)
+                         (substitute* dest-file
+                           (("\\(dynamic-link \"libzmq\"\\)")
+                            (format #f "(dynamic-link \"~a/lib/libzmq.so\")"
+                                    (assoc-ref %build-inputs "zeromq"))))
+
+                         ;; Install and compile module.
+                         (unless (zero? (system* guild "compile"
+                                                 "-L" source
+                                                 "-o" go-file
+                                                 dest-file))
+                           (error (format #f "Failed to compile ~s to ~s!"
+                                          file go-file)))))
+                     (list scm-file))
+           #t))))
+    (propagated-inputs
+     `(("guile" ,guile-2.2)
+       ("zeromq" ,zeromq)))
+    (home-page "https://github.com/jerry40/guile-simple-zmq")
+    (synopsis "Guile wrapper over ZeroMQ library")
+    (description
+     "This package is Guile wrapper over ZeroMQ library.")
+    (license license:gpl3+)))
+
 ;;; guile.scm ends here
-- 
2.17.0





Information forwarded to guix-patches <at> gnu.org:
bug#31449; Package guix-patches. (Mon, 14 May 2018 09:11:02 GMT) Full text and rfc822 format available.

Message #8 received at 31449 <at> debbugs.gnu.org (full text, mbox):

From: Rouby Pierre-Antoine <pierre-antoine.rouby <at> inria.fr>
To: 31449 <at> debbugs.gnu.org
Cc: Rouby Pierre-Antoine <pierre-antoine.rouby <at> inria.fr>
Subject: [PATCH 2/3] gnu: Add jupyter-guile-kernel.
Date: Mon, 14 May 2018 11:10:14 +0200
* gnu/package/guile.scm (jupyter-guile-kernel): New variable.
---
 gnu/packages/guile.scm | 127 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 127 insertions(+)

diff --git a/gnu/packages/guile.scm b/gnu/packages/guile.scm
index 9df59ba1d..bcd26461c 100644
--- a/gnu/packages/guile.scm
+++ b/gnu/packages/guile.scm
@@ -2180,4 +2180,131 @@ It has a nice, simple s-expression based syntax.")
      "This package is Guile wrapper over ZeroMQ library.")
     (license license:gpl3+)))
 
+(define-public jupyter-guile-kernel
+  (package
+    (name "jupyter-guile-kernel")
+    (version "0.0.1")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/jerry40/guile-kernel")
+             (commit "b751d80730f3d64a4b38df1902c3e36672d46b2b")))
+       (sha256
+        (base32
+         "0mah16mjg84l6fc52caqzk5b3m4lfi7f4fki96nbwmrgcxz9hy4g"))))
+    (build-system trivial-build-system)
+    (arguments
+     `(#:modules ((guix build utils))
+       #:builder
+       (begin
+         (use-modules (guix build utils)
+                      (srfi srfi-26)
+                      (ice-9 match)
+                      (ice-9 popen)
+                      (ice-9 rdelim))
+
+         (let* ((out (assoc-ref %outputs "out"))
+                (guile (assoc-ref %build-inputs "guile"))
+                (effective (read-line
+                            (open-pipe* OPEN_READ
+                                        (string-append guile "/bin/guile")
+                                        "-c" "(display (effective-version))")))
+                (module-dir (string-append out "/share/guile/site/"
+                                           effective))
+                (kernel-dir (string-append out "/share/jupyter/kernels/guile"))
+                (go-dir     (string-append out "/lib/guile/"
+                                           effective
+                                           "/site-ccache"))
+                (source     (string-append (assoc-ref %build-inputs "source")
+                                           "/src"))
+                (scm-files '("hmac.scm"
+                             "tools.scm"
+                             "main.scm"))
+                (kernel-file "kernel.json")
+                (guild  (string-append (assoc-ref %build-inputs "guile")
+                                       "/bin/guild"))
+                (zmq    (string-append (assoc-ref %build-inputs "zeromq")
+                                       "/lib"))
+                (g-szmq (assoc-ref %build-inputs "guile-simple-zmq"))
+                (json   (assoc-ref %build-inputs "guile-json"))
+                (deps   (list g-szmq json))
+                (path   (string-join
+                         (map (cut string-append <>
+                                   "/share/guile/site/"
+                                   effective)
+                              deps)
+                         ":"))
+                (gopath (string-join
+                         (map (cut string-append <>
+                                   "/lib/guile/" effective
+                                   "/site-ccache/")
+                              deps)
+                         ":"))
+                (guile-env    (if (not (eq? (getenv "GUILE_LOAD_PATH")
+                                            #f))
+                                  (string-append
+                                   (getenv "GUILE_LOAD_PATH") ":")
+                                  ""))
+                (guile-go-env (if (not (eq? (getenv "GUILE_LOAD_COMPILED_PATH")
+                                            #f))
+                                  (string-append
+                                   (getenv "GUILE_LOAD_COMPILED_PATH") ":")
+                                  "")))
+           ;; Make installation directories.
+           (mkdir-p module-dir)
+           (mkdir-p kernel-dir)
+           (mkdir-p go-dir)
+
+           ;; Compile .scm files and install.
+           (chdir source)
+           (setenv "GUILE_AUTO_COMPILE" "0")
+           (setenv "GUILE_LOAD_PATH" (string-append guile-env path))
+           (setenv "GUILE_LOAD_COMPILED_PATH" (string-append guile-go-env
+                                                             gopath))
+
+           (for-each (lambda (file)
+                       (let* ((dest-file (string-append module-dir "/"
+                                                        file))
+                              (go-file (match (string-split file #\.)
+                                         ((base _)
+                                          (string-append go-dir "/"
+                                                         base ".go")))))
+                         ;; Install source module.
+                         (copy-file file dest-file)
+                         ;; Install compiled module.
+                         (unless (zero? (system* guild "compile"
+                                                 "-L" source
+                                                 "-o" go-file
+                                                 file))
+                           (error (format #f "Failed to compile ~s to ~s!"
+                                          file go-file)))))
+                     scm-files)
+
+           ;; Install kernel
+           (copy-file kernel-file (string-append kernel-dir "/"
+                                                 kernel-file))
+           ;; Sed kernel file
+           (substitute* (string-append kernel-dir "/"
+                                       kernel-file)
+             (("/home/jerry/.local/share/jupyter/kernels/guile/main.scm")
+              (string-append module-dir "/main.scm")))
+           (substitute* (string-append kernel-dir "/"
+                                       kernel-file)
+             (("-s")
+              (string-append "--no-auto-compile\", \"-s")))
+           #t))))
+    (propagated-inputs
+     `(("guile" ,guile-2.2)
+       ("zeromq" ,zeromq)
+       ("openssl", openssl)
+       ("guile-json" ,guile-json)
+       ("guile-simple-zmq" ,guile-simple-zmq)))
+    (synopsis "Guile kernel for jupyter")
+    (description
+     "This package is Guile kernel for Jupyter Notebook.  This software is
+write for GNU Guile 2.0.")
+    (home-page "https://github.com/jerry40/guile-kernel")
+    (license license:gpl3+)))
+
 ;;; guile.scm ends here
-- 
2.17.0





Information forwarded to guix-patches <at> gnu.org:
bug#31449; Package guix-patches. (Mon, 14 May 2018 09:12:02 GMT) Full text and rfc822 format available.

Message #11 received at 31449 <at> debbugs.gnu.org (full text, mbox):

From: Rouby Pierre-Antoine <pierre-antoine.rouby <at> inria.fr>
To: 31449 <at> debbugs.gnu.org
Cc: Rouby Pierre-Antoine <pierre-antoine.rouby <at> inria.fr>
Subject: [PATCH 3/3] gnu: jupyter: Add search path.
Date: Mon, 14 May 2018 11:10:50 +0200
* gnu/package/python.scm (jupyter)[native-search-paths]: Add it.
---
 gnu/packages/python.scm | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index a5d533b1c..c56a5be86 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -6805,6 +6805,12 @@ Jupyter kernels such as IJulia and IRKernel.")
        ("python-jupyter-console" ,python-jupyter-console)
        ("python-nbconvert" ,python-nbconvert)
        ("python-notebook" ,python-notebook)))
+
+    (native-search-paths
+     (list (search-path-specification
+            (variable "JUPYTER_PATH")
+            (files '("share/jupyter/")))))
+
     (home-page "http://jupyter.org")
     (synopsis "Web application for interactive documents")
     (description
-- 
2.17.0





Information forwarded to guix-patches <at> gnu.org:
bug#31449; Package guix-patches. (Mon, 14 May 2018 12:56:02 GMT) Full text and rfc822 format available.

Message #14 received at 31449 <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Rouby Pierre-Antoine <pierre-antoine.rouby <at> inria.fr>
Cc: 31449 <at> debbugs.gnu.org
Subject: Re: [bug#31449] [PATCH 1/3] gnu: Add guile-simple-zmq.
Date: Mon, 14 May 2018 14:55:01 +0200
Hello!

Rouby Pierre-Antoine <pierre-antoine.rouby <at> inria.fr> skribis:

> * gnu/package/guile.scm (guile-simple-zmq): New variable.

[...]

> +(define-public guile-simple-zmq
> +  (package
> +    (name "guile-simple-zmq")
> +    (version "0.0.1")
> +    (source
> +     (origin
> +       (method git-fetch)
> +       (uri (git-reference
> +             (url "https://github.com/jerry40/guile-simple-zmq")
> +             (commit "d76657aeb1cd10ef8136edc06bb90999914c7c3c")))

Nitpick: since there’s no release, I think the version number should be
like:

  (string-append "0-" (string-take commit 7))

along the lines of what the manual suggests (info "(guix) Version
Numbers").

> +    (description
> +     "This package is Guile wrapper over ZeroMQ library.")

What about:

  "This package provides a Guile programming interface to the ZeroMQ
  messaging library."

?

Could you send an updated patch?

Thanks,
Ludo’.




Information forwarded to guix-patches <at> gnu.org:
bug#31449; Package guix-patches. (Mon, 14 May 2018 13:07:01 GMT) Full text and rfc822 format available.

Message #17 received at 31449 <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Rouby Pierre-Antoine <pierre-antoine.rouby <at> inria.fr>
Cc: 31449 <at> debbugs.gnu.org
Subject: Re: [bug#31449] [PATCH 2/3] gnu: Add jupyter-guile-kernel.
Date: Mon, 14 May 2018 15:06:23 +0200
Rouby Pierre-Antoine <pierre-antoine.rouby <at> inria.fr> skribis:

> * gnu/package/guile.scm (jupyter-guile-kernel): New variable.

[...]

> +                (scm-files '("hmac.scm"
> +                             "tools.scm"
> +                             "main.scm"))

Maybe (find-files "." "\\.scm$") would work?

> +                (guile-env    (if (not (eq? (getenv "GUILE_LOAD_PATH")
> +                                            #f))
> +                                  (string-append
> +                                   (getenv "GUILE_LOAD_PATH") ":")
> +                                  ""))
> +                (guile-go-env (if (not (eq? (getenv "GUILE_LOAD_COMPILED_PATH")
> +                                            #f))
> +                                  (string-append
> +                                   (getenv "GUILE_LOAD_COMPILED_PATH") ":")
> +                                  "")))

(not (eq? foo #f)) can be simplified to (not foo).

Also (getenv "GUILE_LOAD_PATH") and (getenv "GUILE_LOAD_COMPILED_PATH")
are always true in this case, I think, so perhaps you can remove these
two variables altogether?

> +           ;; Sed kernel file
> +           (substitute* (string-append kernel-dir "/"
> +                                       kernel-file)
> +             (("/home/jerry/.local/share/jupyter/kernels/guile/main.scm")
> +              (string-append module-dir "/main.scm")))

Maybe the comment could be, IIUC:

  ;; Fix hard-coded file name in the kernel.

> +    (synopsis "Guile kernel for jupyter")
                                   ^
“Guile kernel for the Jupyter Notebook”

> +    (description
> +     "This package is Guile kernel for Jupyter Notebook.  This software is
> +write for GNU Guile 2.0.")

What about:

  “This package provides a Guile 2.x kernel for the Jupyter Notebook.
  It allows users to interact with the Guile REPL through Jupyter.”

Could you send an updated patch?

Thanks!

Ludo’.




Information forwarded to guix-patches <at> gnu.org:
bug#31449; Package guix-patches. (Mon, 14 May 2018 13:09:01 GMT) Full text and rfc822 format available.

Message #20 received at 31449 <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Rouby Pierre-Antoine <pierre-antoine.rouby <at> inria.fr>
Cc: 31449 <at> debbugs.gnu.org
Subject: Re: [bug#31449] [PATCH 3/3] gnu: jupyter: Add search path.
Date: Mon, 14 May 2018 15:07:49 +0200
Rouby Pierre-Antoine <pierre-antoine.rouby <at> inria.fr> skribis:

> * gnu/package/python.scm (jupyter)[native-search-paths]: Add it.

LGTM, thank you!




Information forwarded to guix-patches <at> gnu.org:
bug#31449; Package guix-patches. (Tue, 15 May 2018 09:23:01 GMT) Full text and rfc822 format available.

Message #23 received at 31449 <at> debbugs.gnu.org (full text, mbox):

From: Rouby Pierre-Antoine <pierre-antoine.rouby <at> inria.fr>
To: ludo <at> gnu.org
Cc: 31449 <at> debbugs.gnu.org, Rouby Pierre-Antoine <pierre-antoine.rouby <at> inria.fr>
Subject: [PATCH 1/3] gnu: Add guile-simple-zmq.
Date: Tue, 15 May 2018 11:22:04 +0200
* gnu/package/guile.scm (guile-simple-zmq): New variable.
---
 gnu/packages/guile.scm | 91 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 91 insertions(+)

diff --git a/gnu/packages/guile.scm b/gnu/packages/guile.scm
index 2af6f875e..3a0158944 100644
--- a/gnu/packages/guile.scm
+++ b/gnu/packages/guile.scm
@@ -17,6 +17,7 @@
 ;;; Copyright © 2017 Nils Gillmann <ng0 <at> n0.is>
 ;;; Copyright © 2017 Tobias Geerinckx-Rice <me <at> tobias.gr>
 ;;; Copyright © 2018 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
+;;; Copyright © 2018 Pierre-Antoine Rouby <pierre-antoine.rouby <at> inria.fr>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -66,6 +67,8 @@
   #:use-module (gnu packages version-control)
   #:use-module (gnu packages xdisorg)
   #:use-module (gnu packages xorg)
+  #:use-module (gnu packages networking)
+  #:use-module (gnu packages tls)
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix git-download)
@@ -2093,4 +2096,92 @@ It has a nice, simple s-expression based syntax.")
      "Guile-colorized provides you with a colorized REPL for GNU Guile.")
     (license license:gpl3+)))
 
+(define-public guile-simple-zmq
+  (let ((commit "d76657aeb1cd10ef8136edc06bb90999914c7c3c")
+        (revision "0"))
+    (package
+      (name "guile-simple-zmq")
+      (version (git-version "0.0.0" revision commit))
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               (url "https://github.com/jerry40/guile-simple-zmq")
+               (commit commit)))
+         (sha256
+          (base32
+           "1w73dy5gpyv33jn34dqlkqpwh9w4y8wm6hgvbpb3wbp6xsa2mk4z"))))
+      (build-system trivial-build-system)
+      (arguments
+       `(#:modules ((guix build utils))
+         #:builder
+         (begin
+           (use-modules (guix build utils)
+                        (srfi srfi-26)
+                        (ice-9 match)
+                        (ice-9 popen)
+                        (ice-9 rdelim))
+
+           (let* ((out (assoc-ref %outputs "out"))
+                  (guile (assoc-ref %build-inputs "guile"))
+                  (effective (read-line
+                              (open-pipe* OPEN_READ
+                                          (string-append guile "/bin/guile")
+                                          "-c" "(display (effective-version))")))
+                  (module-dir (string-append out "/share/guile/site/"
+                                             effective))
+                  (go-dir     (string-append out "/lib/guile/"
+                                             effective "/site-ccache/"))
+                  (source     (string-append (assoc-ref %build-inputs "source")
+                                             "/src"))
+                  (scm-file "simple-zmq.scm")
+                  (guild (string-append (assoc-ref %build-inputs "guile")
+                                        "/bin/guild"))
+                  (zmq  (assoc-ref %build-inputs "zeromq"))
+                  (deps (list zmq))
+                  (path (string-join
+                         (map (cut string-append <>
+                                   "/lib/")
+                              deps)
+                         ":")))
+             ;; Make installation directories.
+             (mkdir-p module-dir)
+             (mkdir-p go-dir)
+
+             ;; Compile .scm files and install.
+             (chdir source)
+             (setenv "GUILE_AUTO_COMPILE" "0")
+             (for-each (lambda (file)
+                         (let* ((dest-file (string-append module-dir "/"
+                                                          file))
+                                (go-file (match (string-split file #\.)
+                                           ((base _)
+                                            (string-append go-dir "/"
+                                                           base ".go")))))
+                           ;; Install source module.
+                           (copy-file file dest-file)
+                           (substitute* dest-file
+                             (("\\(dynamic-link \"libzmq\"\\)")
+                              (format #f "(dynamic-link \"~a/lib/libzmq.so\")"
+                                      (assoc-ref %build-inputs "zeromq"))))
+
+                           ;; Install and compile module.
+                           (unless (zero? (system* guild "compile"
+                                                   "-L" source
+                                                   "-o" go-file
+                                                   dest-file))
+                             (error (format #f "Failed to compile ~s to ~s!"
+                                            file go-file)))))
+                       (list scm-file))
+             #t))))
+      (propagated-inputs
+       `(("guile" ,guile-2.2)
+         ("zeromq" ,zeromq)))
+      (home-page "https://github.com/jerry40/guile-simple-zmq")
+      (synopsis "Guile wrapper over ZeroMQ library")
+      (description
+       "This package provides a Guile programming interface to the ZeroMQ
+messaging library.")
+      (license license:gpl3+))))
+
 ;;; guile.scm ends here
-- 
2.17.0





Information forwarded to guix-patches <at> gnu.org:
bug#31449; Package guix-patches. (Tue, 15 May 2018 09:25:01 GMT) Full text and rfc822 format available.

Message #26 received at 31449 <at> debbugs.gnu.org (full text, mbox):

From: Rouby Pierre-Antoine <pierre-antoine.rouby <at> inria.fr>
To: ludo <at> gnu.org
Cc: 31449 <at> debbugs.gnu.org, Rouby Pierre-Antoine <pierre-antoine.rouby <at> inria.fr>
Subject: [PATCH 2/3] gnu: Add jupyter-guile-kernel.
Date: Tue, 15 May 2018 11:24:01 +0200
* gnu/package/guile.scm (jupyter-guile-kernel): New variable.
---
 gnu/packages/guile.scm | 126 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 126 insertions(+)

diff --git a/gnu/packages/guile.scm b/gnu/packages/guile.scm
index 3a0158944..a6a0ada8c 100644
--- a/gnu/packages/guile.scm
+++ b/gnu/packages/guile.scm
@@ -2184,4 +2184,130 @@ It has a nice, simple s-expression based syntax.")
 messaging library.")
       (license license:gpl3+))))
 
+(define-public jupyter-guile-kernel
+  (let ((commit "b751d80730f3d64a4b38df1902c3e36672d46b2b")
+        (revision "0"))
+    (package
+      (name "jupyter-guile-kernel")
+      (version (git-version "0.0.0" revision commit))
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               (url "https://github.com/jerry40/guile-kernel")
+               (commit commit)))
+         (sha256
+          (base32
+           "0mah16mjg84l6fc52caqzk5b3m4lfi7f4fki96nbwmrgcxz9hy4g"))))
+      (build-system trivial-build-system)
+      (arguments
+       `(#:modules ((guix build utils))
+         #:builder
+         (begin
+           (use-modules (guix build utils)
+                        (srfi srfi-26)
+                        (ice-9 match)
+                        (ice-9 popen)
+                        (ice-9 rdelim))
+
+           (let* ((out (assoc-ref %outputs "out"))
+                  (guile (assoc-ref %build-inputs "guile"))
+                  (effective (read-line
+                              (open-pipe* OPEN_READ
+                                          (string-append guile "/bin/guile")
+                                          "-c" "(display (effective-version))")))
+                  (module-dir (string-append out "/share/guile/site/"
+                                             effective))
+                  (kernel-dir (string-append out "/share/jupyter/kernels/guile"))
+                  (go-dir     (string-append out "/lib/guile/"
+                                             effective
+                                             "/site-ccache"))
+                  (source     (string-append (assoc-ref %build-inputs "source")
+                                             "/src"))
+                  (scm-files '("hmac.scm"
+                               "tools.scm"
+                               "main.scm"))
+                  (kernel-file "kernel.json")
+                  (guild  (string-append (assoc-ref %build-inputs "guile")
+                                         "/bin/guild"))
+                  (zmq    (string-append (assoc-ref %build-inputs "zeromq")
+                                         "/lib"))
+                  (g-szmq (assoc-ref %build-inputs "guile-simple-zmq"))
+                  (json   (assoc-ref %build-inputs "guile-json"))
+                  (deps   (list g-szmq json))
+                  (path   (string-join
+                           (map (cut string-append <>
+                                     "/share/guile/site/"
+                                     effective)
+                                deps)
+                           ":"))
+                  (gopath (string-join
+                           (map (cut string-append <>
+                                     "/lib/guile/" effective
+                                     "/site-ccache/")
+                                deps)
+                           ":")))
+           
+             ;; Make installation directories.
+             (mkdir-p module-dir)
+             (mkdir-p kernel-dir)
+             (mkdir-p go-dir)
+
+             ;; Compile .scm files and install.
+             (chdir source)
+             (setenv "GUILE_AUTO_COMPILE" "0")
+             (setenv "GUILE_LOAD_PATH" path)
+             (setenv "GUILE_LOAD_COMPILED_PATH" gopath)
+           
+             (for-each (lambda (file)
+                         (let* ((dest-file (string-append module-dir "/"
+                                                          file))
+                                (go-file (match (string-split file #\.)
+                                           ((base _)
+                                            (string-append go-dir "/"
+                                                           base ".go")))))
+                           ;; Install source module.
+                           (copy-file file dest-file)
+                         
+                           ;; Install compiled module.
+                           (unless (zero? (system* guild "compile"
+                                                   "-L" source
+                                                   "-o" go-file
+                                                   file))
+                             (error (format #f "Failed to compile ~s to ~s!"
+                                            file go-file)))))
+                       scm-files)
+
+             ;; Fix executable file name
+             (rename-file (string-append module-dir "/main.scm")
+                          (string-append module-dir "/guile-jupyter-kernel.scm"))
+             (rename-file (string-append go-dir "/main.go")
+                          (string-append go-dir "/guile-jupyter-kernel.go"))
+
+             ;; Install kernel
+             (copy-file kernel-file (string-append kernel-dir "/"
+                                                   kernel-file))
+             ;; Fix hard-coded file name in the kernel
+             (substitute* (string-append kernel-dir "/"
+                                         kernel-file)
+               (("/home/jerry/.local/share/jupyter/kernels/guile/main.scm")
+                (string-append module-dir "/guile-jupyter-kernel.scm")))
+             (substitute* (string-append kernel-dir "/"
+                                         kernel-file)
+               (("-s")
+                (string-append "--no-auto-compile\", \"-s")))
+             #t))))
+      (propagated-inputs
+       `(("guile" ,guile-2.2)
+         ("zeromq" ,zeromq)
+         ("openssl" ,openssl)
+         ("guile-json" ,guile-json)
+         ("guile-simple-zmq" ,guile-simple-zmq)))
+      (synopsis "Guile kernel for the Jupyter Notebook")
+      (description
+       "This package provides a Guile 2.x kernel for the Jupyter Notebook.  It
+allows users to interact with the Guile REPL through Jupyter.")
+      (home-page "https://github.com/jerry40/guile-kernel")
+      (license license:gpl3+))))
+
 ;;; guile.scm ends here
-- 
2.17.0





Information forwarded to guix-patches <at> gnu.org:
bug#31449; Package guix-patches. (Tue, 15 May 2018 09:28:02 GMT) Full text and rfc822 format available.

Message #29 received at 31449 <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Rouby Pierre-Antoine <pierre-antoine.rouby <at> inria.fr>
Cc: 31449 <at> debbugs.gnu.org
Subject: Re: [bug#31449] [PATCH 1/3] gnu: Add guile-simple-zmq.
Date: Tue, 15 May 2018 11:27:48 +0200
[Message part 1 (text/plain, inline)]
Rouby Pierre-Antoine <pierre-antoine.rouby <at> inria.fr> skribis:

> * gnu/package/guile.scm (guile-simple-zmq): New variable.

Applied with the changes below, thanks!

Ludo’.

[Message part 2 (text/x-patch, inline)]
diff --git a/gnu/packages/guile.scm b/gnu/packages/guile.scm
index f473a1cc9..9e24e90c2 100644
--- a/gnu/packages/guile.scm
+++ b/gnu/packages/guile.scm
@@ -69,7 +69,6 @@
   #:use-module (gnu packages xdisorg)
   #:use-module (gnu packages xorg)
   #:use-module (gnu packages networking)
-  #:use-module (gnu packages tls)
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix git-download)
@@ -2133,7 +2132,8 @@ It has a nice, simple s-expression based syntax.")
                (commit commit)))
          (sha256
           (base32
-           "1w73dy5gpyv33jn34dqlkqpwh9w4y8wm6hgvbpb3wbp6xsa2mk4z"))))
+           "1w73dy5gpyv33jn34dqlkqpwh9w4y8wm6hgvbpb3wbp6xsa2mk4z"))
+         (file-name (git-file-name name version))))
       (build-system trivial-build-system)
       (arguments
        `(#:modules ((guix build utils))

Information forwarded to guix-patches <at> gnu.org:
bug#31449; Package guix-patches. (Tue, 15 May 2018 11:34:02 GMT) Full text and rfc822 format available.

Message #32 received at 31449 <at> debbugs.gnu.org (full text, mbox):

From: Rouby Pierre-Antoine <pierre-antoine.rouby <at> inria.fr>
To: ludo <at> gnu.org
Cc: 31449 <at> debbugs.gnu.org, Rouby Pierre-Antoine <pierre-antoine.rouby <at> inria.fr>
Subject: [PATCH 2/3] gnu: Add jupyter-guile-kernel.
Date: Tue, 15 May 2018 13:33:15 +0200
* gnu/package/guile.scm (jupyter-guile-kernel): New variable.
---
 gnu/packages/guile.scm | 121 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 121 insertions(+)

diff --git a/gnu/packages/guile.scm b/gnu/packages/guile.scm
index 3a0158944..b39dcea9e 100644
--- a/gnu/packages/guile.scm
+++ b/gnu/packages/guile.scm
@@ -2184,4 +2184,125 @@ It has a nice, simple s-expression based syntax.")
 messaging library.")
       (license license:gpl3+))))
 
+(define-public jupyter-guile-kernel
+  (let ((commit "a5c5f3ea3215b65e770bcb62f71117b0ec4575ed")
+        (revision "0"))
+    (package
+      (name "jupyter-guile-kernel")
+      (version (git-version "0.0.0" revision commit))
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               (url "https://github.com/jerry40/guile-kernel")
+               (commit commit)))
+         (sha256
+          (base32
+           "0y5jr0f0dyskvsawqbf6n0bpg8jirw4mhqbarf2a6p9lxhqha9s9"))))
+      (build-system trivial-build-system)
+      (arguments
+       `(#:modules ((guix build utils))
+         #:builder
+         (begin
+           (use-modules (guix build utils)
+                        (srfi srfi-26)
+                        (ice-9 match)
+                        (ice-9 popen)
+                        (ice-9 rdelim))
+
+           (let* ((out (assoc-ref %outputs "out"))
+                  (guile (assoc-ref %build-inputs "guile"))
+                  (effective (read-line
+                              (open-pipe* OPEN_READ
+                                          (string-append guile "/bin/guile")
+                                          "-c" "(display (effective-version))")))
+                  (module-dir (string-append out "/share/guile/site/"
+                                             effective))
+                  (kernel-dir (string-append out "/share/jupyter/kernels/guile"))
+                  (go-dir     (string-append out "/lib/guile/"
+                                             effective
+                                             "/site-ccache"))
+                  (source     (string-append (assoc-ref %build-inputs "source")
+                                             "/src"))
+                  (scm-files '("hmac.scm"
+                               "tools.scm"
+                               "guile-jupyter-kernel.scm"))
+                  (kernel-file "kernel.json")
+                  (guild  (string-append (assoc-ref %build-inputs "guile")
+                                         "/bin/guild"))
+                  (zmq    (string-append (assoc-ref %build-inputs "zeromq")
+                                         "/lib"))
+                  (g-szmq (assoc-ref %build-inputs "guile-simple-zmq"))
+                  (json   (assoc-ref %build-inputs "guile-json"))
+                  (deps   (list g-szmq json))
+                  (path   (string-join
+                           (map (cut string-append <>
+                                     "/share/guile/site/"
+                                     effective)
+                                deps)
+                           ":"))
+                  (gopath (string-join
+                           (map (cut string-append <>
+                                     "/lib/guile/" effective
+                                     "/site-ccache/")
+                                deps)
+                           ":")))
+           
+             ;; Make installation directories.
+             (mkdir-p module-dir)
+             (mkdir-p kernel-dir)
+             (mkdir-p go-dir)
+
+             ;; Compile .scm files and install.
+             (chdir source)
+             (setenv "GUILE_AUTO_COMPILE" "0")
+             (setenv "GUILE_LOAD_PATH" path)
+             (setenv "GUILE_LOAD_COMPILED_PATH" gopath)
+           
+             (for-each (lambda (file)
+                         (let* ((dest-file (string-append module-dir "/"
+                                                          file))
+                                (go-file (match (string-split file #\.)
+                                           ((base _)
+                                            (string-append go-dir "/"
+                                                           base ".go")))))
+                           ;; Install source module.
+                           (copy-file file dest-file)
+                         
+                           ;; Install compiled module.
+                           (unless (zero? (system* guild "compile"
+                                                   "-L" source
+                                                   "-o" go-file
+                                                   file))
+                             (error (format #f "Failed to compile ~s to ~s!"
+                                            file go-file)))))
+                       scm-files)
+             
+             ;; Install kernel
+             (copy-file kernel-file (string-append kernel-dir "/"
+                                                   kernel-file))
+             ;; Fix hard-coded file name in the kernel
+             (substitute* (string-append kernel-dir "/"
+                                         kernel-file)
+               (("/home/jerry/.local/share/jupyter/kernels/guile/guile-jupyter-kernel.scm")
+                (string-append module-dir "/guile-jupyter-kernel.scm")))
+             (substitute* (string-append kernel-dir "/"
+                                         kernel-file)
+               (("-s")
+                (string-append "--no-auto-compile\", \"-s")))
+             #t))))
+      (inputs
+       `(("zeromq" ,zeromq)))
+      (propagated-inputs
+       `(("guile-json" ,guile-json)
+         ("guile-simple-zmq" ,guile-simple-zmq)
+         ("guile" ,guile-2.2)
+         ("openssl" ,openssl)))
+      (synopsis "Guile kernel for the Jupyter Notebook")
+      (description
+       "This package provides a Guile 2.x kernel for the Jupyter Notebook.  It
+allows users to interact with the Guile REPL through Jupyter.")
+      (home-page "https://github.com/jerry40/guile-kernel")
+      (license license:gpl3+))))
+
 ;;; guile.scm ends here
-- 
2.17.0





Information forwarded to guix-patches <at> gnu.org:
bug#31449; Package guix-patches. (Thu, 17 May 2018 09:43:01 GMT) Full text and rfc822 format available.

Message #35 received at 31449 <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Rouby Pierre-Antoine <pierre-antoine.rouby <at> inria.fr>
Cc: 31449 <at> debbugs.gnu.org
Subject: Re: [bug#31449] [PATCH 2/3] gnu: Add jupyter-guile-kernel.
Date: Thu, 17 May 2018 11:42:35 +0200
[Message part 1 (text/plain, inline)]
Rouby Pierre-Antoine <pierre-antoine.rouby <at> inria.fr> skribis:

> * gnu/package/guile.scm (jupyter-guile-kernel): New variable.

Applied with the changes below, to avoid propagated inputs.

Thanks!

Ludo’.

[Message part 2 (text/x-patch, inline)]
diff --git a/gnu/packages/guile.scm b/gnu/packages/guile.scm
index a4a0f87c0..84f46d1cc 100644
--- a/gnu/packages/guile.scm
+++ b/gnu/packages/guile.scm
@@ -61,6 +61,7 @@
   #:use-module (gnu packages gettext)
   #:use-module (gnu packages databases)
   #:use-module (gnu packages python)
+  #:use-module (gnu packages tls)
   #:use-module (gnu packages gl)
   #:use-module (gnu packages sdl)
   #:use-module (gnu packages maths)
@@ -2253,8 +2254,6 @@ messaging library.")
                   (kernel-file "kernel.json")
                   (guild  (string-append (assoc-ref %build-inputs "guile")
                                          "/bin/guild"))
-                  (zmq    (string-append (assoc-ref %build-inputs "zeromq")
-                                         "/lib"))
                   (g-szmq (assoc-ref %build-inputs "guile-simple-zmq"))
                   (json   (assoc-ref %build-inputs "guile-json"))
                   (deps   (list g-szmq json))
@@ -2270,18 +2269,26 @@ messaging library.")
                                      "/site-ccache/")
                                 deps)
                            ":")))
-           
+
              ;; Make installation directories.
              (mkdir-p module-dir)
              (mkdir-p kernel-dir)
              (mkdir-p go-dir)
 
+             ;; Make a writable copy of SOURCE.
+             (copy-recursively source ".")
+
+             ;; Record the absolute file name of the 'openssl' command.
+             (substitute* "hmac.scm"
+               (("openssl")
+                (string-append (assoc-ref %build-inputs "openssl")
+                               "/bin/openssl")))
+
              ;; Compile .scm files and install.
-             (chdir source)
              (setenv "GUILE_AUTO_COMPILE" "0")
              (setenv "GUILE_LOAD_PATH" path)
              (setenv "GUILE_LOAD_COMPILED_PATH" gopath)
-           
+
              (for-each (lambda (file)
                          (let* ((dest-file (string-append module-dir "/"
                                                           file))
@@ -2291,7 +2298,7 @@ messaging library.")
                                                            base ".go")))))
                            ;; Install source module.
                            (copy-file file dest-file)
-                         
+
                            ;; Install compiled module.
                            (unless (zero? (system* guild "compile"
                                                    "-L" source
@@ -2300,7 +2307,7 @@ messaging library.")
                              (error (format #f "Failed to compile ~s to ~s!"
                                             file go-file)))))
                        scm-files)
-             
+
              ;; Install kernel
              (copy-file kernel-file (string-append kernel-dir "/"
                                                    kernel-file))
@@ -2308,19 +2315,20 @@ messaging library.")
              (substitute* (string-append kernel-dir "/"
                                          kernel-file)
                (("/home/jerry/.local/share/jupyter/kernels/guile/guile-jupyter-kernel.scm")
-                (string-append module-dir "/guile-jupyter-kernel.scm")))
-             (substitute* (string-append kernel-dir "/"
-                                         kernel-file)
+                (string-append module-dir "/guile-jupyter-kernel.scm"))
+               (("\"guile\"")
+                (string-append "\"" (assoc-ref %build-inputs "guile")
+                               "/bin/guile\""))
                (("-s")
                 (string-append "--no-auto-compile\", \"-s")))
+
              #t))))
       (inputs
-       `(("zeromq" ,zeromq)))
+       `(("openssl" ,openssl)
+         ("guile" ,guile-2.2)))
       (propagated-inputs
        `(("guile-json" ,guile-json)
-         ("guile-simple-zmq" ,guile-simple-zmq)
-         ("guile" ,guile-2.2)
-         ("openssl" ,openssl)))
+         ("guile-simple-zmq" ,guile-simple-zmq)))
       (synopsis "Guile kernel for the Jupyter Notebook")
       (description
        "This package provides a Guile 2.x kernel for the Jupyter Notebook.  It

Reply sent to ludo <at> gnu.org (Ludovic Courtès):
You have taken responsibility. (Thu, 17 May 2018 11:19:02 GMT) Full text and rfc822 format available.

Notification sent to Rouby Pierre-Antoine <pierre-antoine.rouby <at> inria.fr>:
bug acknowledged by developer. (Thu, 17 May 2018 11:19:05 GMT) Full text and rfc822 format available.

Message #40 received at 31449-done <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Rouby Pierre-Antoine <pierre-antoine.rouby <at> inria.fr>
Cc: 31449-done <at> debbugs.gnu.org
Subject: Re: [bug#31449] [PATCH 3/3] gnu: jupyter: Add search path.
Date: Thu, 17 May 2018 13:18:20 +0200
Rouby Pierre-Antoine <pierre-antoine.rouby <at> inria.fr> skribis:

> * gnu/package/python.scm (jupyter)[native-search-paths]: Add it.

Applied as well!

So to run the Jupyter Notebook (web UI), you can do:

  guix environment --ad-hoc jupyter jupyter-guile-kernel -- jupyter notebook

And from there, point your browser to http://localhost:8888, select
New -> Guile, and you get a REPL.

Thank you!

Ludo’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 14 Jun 2018 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 7 years and 9 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.