1. 13 Sep, 2019 2 commits
    • Ludovic Courtès's avatar
      kernels: 'reply-html' replies to the message sender. · aa902cec
      Ludovic Courtès authored
      * jupyter/kernels.scm (reply-html): Pass #:recipient to 'send-message'.
      aa902cec
    • Ludovic Courtès's avatar
      Rewrite proxy to use 'serve-kernels'. · 1726ccb3
      Ludovic Courtès authored
      * jupyter/kernels.scm (generate-key): New procedure.
      (relay-message): Remove.
      * jupyter/messages.scm (<message>): Use 'define-immutable-record-type'
      and define 'set-message-content'.
      * guix-jupyter-container.scm (local-eval): Rewrite in terms of
      'send-message'.
      (reply-html-to-kernel): Remove.
      (general-handler): Copy from *-kernel.scm.
      (execute-request-sans-magic): New procedure.
      (ignore-request, reply-execute-request, shutdown): Adjust to new calling
      convention.
      (%main-kernel, %main-kernel-id): New variables.
      <top level>: Use 'serve-kernels'.
      * guix-jupyter-kernel.scm (%main-kernel, %main-kernel-id): New
      variables.
      (general-handler): Check whether we're talking to %MAIN-KERNEL.
      (reply-kernel-info-request, reply-execute-request, shutdown): Add 'kind'
      parameter.
      (new-container-connect): Remove.
      (start-container): Return a <kernel>.
      <top level>: Pass both the "default" container kernel and our client to
      'server-kernels'.  Set %MAIN-KERNEL.
      1726ccb3
  2. 12 Sep, 2019 4 commits
    • Ludovic Courtès's avatar
      Add (guix jupyter logging). · 82363869
      Ludovic Courtès authored
      * guix/jupyter/logging.scm: New file.
      * Makefile.am (SOURCES): Add it.
      82363869
    • Ludovic Courtès's avatar
      guix-jupyter-kernel: Use 'serve-kernels'. · 6446ff08
      Ludovic Courtès authored
      * guix-jupyter-kernel.scm (heartbeat-handler, start-kernel): Remove.
      (general-handler): Adjust prototype to match what 'serve-kernels'
      expects.
      <top level>: Use 'serve-kernels'.
      6446ff08
    • Ludovic Courtès's avatar
      kernels: Allow for OS-allocated TCP port numbers. · 150c006f
      Ludovic Courtès authored
      * jupyter/kernels.scm (allocate-connection): #:first-port defaults to #f.
      [allocate-port]: New procedure
      [try-connect]: New procedure.
      Use it in lieu of 'test-bind', and remove the extra 'zmq-connect'
      calls.
      (test-bind): Remove.
      150c006f
    • Ludovic Courtès's avatar
      servers: Add 'serve-kernels'. · fe70f6da
      Ludovic Courtès authored
      * jupyter/kernels.scm (kernel-socket-kind): New procedure.
      (zmq-poll*, allocate-connection): Export.
      * jupyter/servers.scm (%server-scheduler-prompt, %server-exit-prompt):
      New variables.
      * jupyter/servers.scm (monitor-client, leave-server-loop)
      (serve-kernels): New procedures.
      * tests/servers.scm: New file.
      fe70f6da
  3. 09 Sep, 2019 27 commits
    • Ludovic Courtès's avatar
      kernels: Catch EINTR on 'zmq-poll' calls. · 5093a6ea
      Ludovic Courtès authored
      * jupyter/kernels.scm (EINTR-safe): New procedure.
      (read-message): Use it.
      5093a6ea
    • Ludovic Courtès's avatar
      kernels: 'read-message' no longer calls a non-existent procedure. · baaad11b
      Ludovic Courtès authored
      * jupyter/kernels.scm (read-message): Remove call to non-existent
      'zmq-get-msg-bytevector'.
      baaad11b
    • Ludovic Courtès's avatar
      servers: Take <connection> records. · 60fa602b
      Ludovic Courtès authored
      * jupyter/servers.scm (connection-file->kernel): Rename to...
      (connection->kernel): ... this, and take a CONNECTION instead of a
      PORT.
      (connection-file->kernel): Rewrite as a composition.
      60fa602b
    • Ludovic Courtès's avatar
      kernels: Define <connection> record type and use it. · 3edceba2
      Ludovic Courtès authored
      * jupyter/kernels.scm (<kernel>): Use 'define-immutable-record-type'.
      Add 'set-kernel-name' and 'set-kernel-pid'.
      (find-kernel-by-name): Rename to...
      (find-kernel-specs-file): ... this.
      (find-kernel-specs): New procedure.
      (<connection>): New record type.
      (new-connection-file, kernel-arguments, exec-kernel): Remove.
      (allocate-connection, spawn-kernel): New procedure.
      (run-kernel): Rewrite to take a <kernel-spec> and to use
      'allocate-connection'.
      * tests/kernels.scm (%python3-specs): New variable.
      ("run-kernel python3"): Adjust accordingly.
      * guix-jupyter-container.scm (reply-execute-request): Likewise.
      3edceba2
    • Ludovic Courtès's avatar
      environ: Don't require a specific Guile version. · 825da79e
      Ludovic Courtès authored
      * guix-kernel/environ.scm (guile-current-version->path): Don't require a
      specific Guile version.
      825da79e
    • Ludovic Courtès's avatar
      json: Work around bug for (scm->json '()). · 8a5bb9d5
      Ludovic Courtès authored
      * jupyter/json.scm <top level>: Override (@@ (json builder) json-build).
      8a5bb9d5
    • Ludovic Courtès's avatar
      json: Add support for record-to-json conversion. · a1fabc65
      Ludovic Courtès authored
      * jupyter/json.scm (define-json-writer): New macro.
      (define-json-mapping): Add support for defining writers.
      a1fabc65
    • Ludovic Courtès's avatar
      kernels: Make "kernel_info_request" test more robust. · 42aea28f
      Ludovic Courtès authored
      * tests/kernels.scm ("kernel_info_request"): Rewrite to remove assumptions
      about ordering, and to account for all the replies.
      42aea28f
    • Ludovic Courtès's avatar
      kernels: Define <kernel-specs>. · 4c8895dd
      Ludovic Courtès authored
      * jupyter/kernels.scm (<kernel-specs>): New record type.
      (kernel-arguments): Use 'json->kernel-specs' and 'kernel-specs-arguments'.
      4c8895dd
    • Ludovic Courtès's avatar
      Add (jupyter json). · e581457e
      Ludovic Courtès authored
      Code taken from (guix swh) as of Guix commit
      81c3dc32244a17241d74eea9fa265edfcb326f6d.
      
      * jupyter/json.scm: New file.
      * Makefile.am (SOURCES): Add it.
      e581457e
    • Ludovic Courtès's avatar
      messaging: Make "execute_request" more robust. · 0841118f
      Ludovic Courtès authored
      * tests/kernels.scm ("execute_request"): Rewrite to remove assumptions
      about ordering, and to account for all the replies.
      0841118f
    • Ludovic Courtès's avatar
      Add (jupyter servers). · 3c2884bc
      Ludovic Courtès authored
      * guix-kernel/jupyter-client.scm: Rename to...
      * jupyter/servers.scm: ... this.
      (KERNEL-INFO, guile-version): Remove.
      (json->kernel): Rename to...
      (connection-file->kernel): ... this.
      * guix-jupyter-container.scm: Adjust accordingly.
      * guix-jupyter-kernel.scm (KERNEL-INFO): New variable.
      (kernel): Use new 'connection-file->kernel' name.
      * Makefile.am (SOURCES): Adjust file list accordingly.
      3c2884bc
    • Ludovic Courtès's avatar
      kernels: 'read-message' no longer swallows heartbeat messages. · 1abf4098
      Ludovic Courtès authored
      * jupyter/kernels.scm (read-message): Return heartbeat messages.
      1abf4098
    • Ludovic Courtès's avatar
      Switch to Guile-JSON 3.x. · 0bd4ecd7
      Ludovic Courtès authored
      Guile-JSON 3.x is incompatible with Guile-JSON 1.x, which we relied on
      until now: it maps JSON dictionaries to alists (instead of hash tables),
      and JSON arrays to vectors (instead of lists).  This commit is about
      adjusting all the existing code to this new mapping.
      
      * jupyter/kernels.scm (kernel-arguments): Use 'assoc-ref' instead of
      'hash-ref'; pass JSON array through 'vector->list'.
      (relay-message, reply-html): Likewise.
      * jupyter/messages.scm (string->header): Likewise.
      * guix-jupyter-container.scm (local-eval, reply-execute-request): Likewise.
      * guix-jupyter-kernel.scm (reply-execute-request): Likewise.
      * guix-kernel/jupyter-client.scm (json->kernel): Likewise.
      * tests/kernels.scm: Likewise.
      * environment.scm (propagated-inputs): Replace GUILE-JSON with
      GUILE-JSON-3.
      0bd4ecd7
    • Ludovic Courtès's avatar
      kernels: Test "kernel_info_request". · 200be24b
      Ludovic Courtès authored
      * tests/kernels.scm ("run-kernel python3"): Try to get a "status"
      message.
      ("kernel_info_request"): New test.
      200be24b
    • Ludovic Courtès's avatar
      kernels: 'read-message' reads from any of the kernel's sockets. · d88fb653
      Ludovic Courtès authored
      * jupyter/kernels.scm (read-message): Rewrite to use 'zmq-poll'.  Add
      optional 'timeout' parameter.
      * tests/kernels.scm ("execute_request"): Call 'read-message' thrice and
      check all three replies.
      d88fb653
    • Ludovic Courtès's avatar
      kernels: 'run-kernel' no longer requires a UUID parameter. · 22e7d33f
      Ludovic Courtès authored
      * jupyter/kernels.scm (run-kernel): Remove 'uuid' parameter and add
       #:identity parameter.  Do not set ZMQ_IDENTITY on SOCKET-SHELL when
       #:identity is #f.
      * guix-jupyter-container.scm (reply-execute-request): Pass #:identity to
      'run-kernel'.
      * tests/kernels.scm (%kernel-uuid): Remove.
      ("run-kernel python3"): Remove %KERNEL-UUID argument from 'run-kernel'
      call.
      ("execute_request"): Remove #:recipient argument to 'send-message'.
      Remove reference to %KERNEL-UUID.
      22e7d33f
    • Ludovic Courtès's avatar
      messages: 'message-parts' accepts #f as the recipient. · 22b789fc
      Ludovic Courtès authored
      * jupyter/messages.scm (message-parts): Allow #:recipients to be #f.
      22b789fc
    • Ludovic Courtès's avatar
      kernels: Add 'kernel-sockets'. · 3b418494
      Ludovic Courtès authored
      * jupyter/kernels.scm (kernel-sockets): New procedure.
      (close-kernel): Use it.
      3b418494
    • Ludovic Courtès's avatar
      kernels: Add test talking to ipykernel. · 6874b76c
      Ludovic Courtès authored
      * tests/kernels.scm: New file.
      * Makefile.am (SCM_TESTS): Add it.
      * environment.scm <native-inputs>: Add JUPYTER, PYTHON-IPYTHON, and
      PYTHON-IPYKERNEL.
      6874b76c
    • Ludovic Courtès's avatar
      messages: Provide a simpler 'header' procedure and export it. · 89d52b8f
      Ludovic Courtès authored
      * jupyter/messages.scm (<header>): Rename contructor to '%header'.
      (%protocol-version): New variable.
      (current-date-string, header, make-header): New procedures.
      (reply): Adjust to new 'header' API.
      (string->header): Likewise.
      89d52b8f
    • Ludovic Courtès's avatar
      Move more kernel helpers to (guix kernels). · 16553955
      Ludovic Courtès authored
      * guix-kernel/jupyter-client.scm (read-message, send-message, pub)
      (pub-busy, pub-idle, reply-html): Move to...
      * jupyter/kernels.scm: ... here.
      16553955
    • Ludovic Courtès's avatar
      Rename (guix-kernel jupyter-server) to (jupyter kernels). · 0556e9dd
      Ludovic Courtès authored
      * guix-kernel/jupyter-server.scm: Rename to...
      * jupyter/kernels.scm: ... this.
      * guix-jupyter-container.scm, guix-jupyter-kernel.scm,
      guix-kernel/jupyter-client.scm: Adjust accordingly.
      * Makefile.am (SOURCES): Likewise.
      0556e9dd
    • Ludovic Courtès's avatar
      Move messaging to (jupyter messages). · 2cc4a5cc
      Ludovic Courtès authored
      * guix-kernel/jupyter-client.scm (<header>, <message>, message)
      (make-message, message-parts, reply, message-type, message-sender)
      (string->header, header->string, parts->message, DELIM): Move to...
      * jupyter/messages.scm: ... here.  New file.
      (get-signature, make-id): New procedures.
      * guix-kernel/hmac.msc, guix-kernel/tools.scm, tests/tools.scm: Remove.
      * Makefile.am (SOURCES, SCM_TESTS): Adjust accordingly.
      * guix-jupyter-container.scm, guix-jupyter-kernel.scm,
      guix-kernel/jupyter-client.scm: Adjust import list accordingly.
      * tests/hmac.scm (get-signature): New variable.
      2cc4a5cc
    • Ludovic Courtès's avatar
      Use <kernel> records to represent proxies. · 7da97367
      Ludovic Courtès authored
      * guix-jupyter-kernel.scm (<proxy>): Remove.
      (register-proxy): Add docstring.
      (new-container-connect): Return a <kernel> object.
      (reply-execute-request, kill-containers): Adjust accordingly.
      7da97367
    • Ludovic Courtès's avatar
      Remove <notebook>, use <kernel> throughout. · 30004d60
      Ludovic Courtès authored
      * guix-kernel/jupyter-client.scm (<notebook>, notebook): Remove.
      (json->notebook): Rename to...
      (json->kernel): ... this, and adjust accordingly.
      (read-message, send-message, relay-message, pub, pub-busy)
      (pub-idle, reply-html): Adjust accordingly.
      * guix-kernel/jupyter-server.scm (<kernel>)[key]: New field.
      (kernel-iopub): New macro.
      (kernel): Add #:key.
      (close-kernel): New procedure.
      * guix-jupyter-kernel.scm: Adjust, replacing "notebook" with "kernel".
      * guix-jupyter-container.scm: Likewise.
      30004d60
    • Ludovic Courtès's avatar
      Rewrite Jupyter messaging. · cc7fa604
      Ludovic Courtès authored
      Introduce <message> and <header> record that map directly to the Jupyter
      specs.
      
      This is a breaking change.
      cc7fa604
  4. 11 Jun, 2019 1 commit
  5. 14 Feb, 2019 2 commits
  6. 16 Oct, 2018 3 commits
    • Ludovic Courtès's avatar
      kernel: Remove unused 'send-to-container' parameter. · ab176916
      Ludovic Courtès authored
      * guix-jupyter-kernel.scm (send-to-container): Remove unused
      'containers' parameter.
      (proxy-exec-container, kill-containers): Adjust accordingly.
      ab176916
    • Ludovic Courtès's avatar
      kernel: Define a <proxy> record type and use it. · eb1396b5
      Ludovic Courtès authored
      * guix-jupyter-kernel.scm: Use SRFI-19.
      (session-id): Adjust accordingly.
      (<proxy>): New record type.
      (register-container, container-by-name, container-socket-by-name):
      Remove.
      (register-proxy, proxy-by-name): New procedures.
      (reply-execute-request): Adjust accordingly.
      (kill-containers): Rewrite using 'vlist-for-each'.
      (new-container-connect): Return a proxy record.
      eb1396b5
    • Ludovic Courtès's avatar
      client: 'pub' procedures now take a notebook. · 4f172f92
      Ludovic Courtès authored
      * guix-kernel/jupyter-client.scm (pub, pub-busy, pub-idle): Remove
      'socket' and 'key' parameters, add 'notebook' parameter instead.
      4f172f92
  7. 15 Oct, 2018 1 commit
    • Ludovic Courtès's avatar
      kernel: Remove '%notebook' global variable. · 3ec4956c
      Ludovic Courtès authored
      * guix-jupyter-kernel.scm (%notebook): Remove.
      (reply-kernel-info-request): Remove 'socket' parameter; add 'notebook'
      parameter and adjust accordingly.
      (reply-execute-request): Likewise.
      (shutdown): Likewise.
      (start-container): Add 'notebook' parameter and use it.
      (start-kernel): Likewise.
      (run-new-container): Remove.
      <top level>: Adjust 'sigaction' and 'start-kernel' calls accordingly.
      3ec4956c