| 1 | ;;; GNU Guix --- Functional package management for GNU |
| 2 | ;;; Copyright © 2019 Ludovic Courtès <ludo@gnu.org> |
| 3 | ;;; |
| 4 | ;;; This file is part of GNU Guix. |
| 5 | ;;; |
| 6 | ;;; GNU Guix is free software; you can redistribute it and/or modify it |
| 7 | ;;; under the terms of the GNU General Public License as published by |
| 8 | ;;; the Free Software Foundation; either version 3 of the License, or (at |
| 9 | ;;; your option) any later version. |
| 10 | ;;; |
| 11 | ;;; GNU Guix is distributed in the hope that it will be useful, but |
| 12 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | ;;; GNU General Public License for more details. |
| 15 | ;;; |
| 16 | ;;; You should have received a copy of the GNU General Public License |
| 17 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. |
| 18 | |
| 19 | (define-module (gnu packages jupyter) |
| 20 | #:use-module ((guix licenses) #:prefix license:) |
| 21 | #:use-module (guix packages) |
| 22 | #:use-module (guix download) |
| 23 | #:use-module (guix git-download) |
| 24 | #:use-module (guix build-system cmake) |
| 25 | #:use-module (guix build-system python) |
| 26 | #:use-module (gnu packages check) |
| 27 | #:use-module (gnu packages cpp) |
| 28 | #:use-module (gnu packages linux) |
| 29 | #:use-module (gnu packages networking) |
| 30 | #:use-module (gnu packages pkg-config) |
| 31 | #:use-module (gnu packages python) |
| 32 | #:use-module (gnu packages python-xyz) |
| 33 | #:use-module (gnu packages time) |
| 34 | #:use-module (gnu packages tls)) |
| 35 | |
| 36 | (define-public python-jupyter-protocol |
| 37 | (package |
| 38 | (name "python-jupyter-protocol") |
| 39 | (version "0.1.1") |
| 40 | (source (origin |
| 41 | (method url-fetch) |
| 42 | (uri (pypi-uri "jupyter_protocol" version)) |
| 43 | (sha256 |
| 44 | (base32 |
| 45 | "1bk3as5yw9y5nmq6l15nr46aby34phmvsx9kxgqnm5pd5q2b5h57")))) |
| 46 | (build-system python-build-system) |
| 47 | (propagated-inputs |
| 48 | `(("python-dateutil" ,python-dateutil) |
| 49 | ("python-jupyter-core" ,python-jupyter-core) |
| 50 | ("python-pyzmq" ,python-pyzmq) |
| 51 | ("python-traitlets" ,python-traitlets))) |
| 52 | (native-inputs |
| 53 | `(("python-ipykernel" ,python-ipykernel) |
| 54 | ("python-ipython" ,python-ipython) |
| 55 | ("python-mock" ,python-mock) |
| 56 | ("python-pytest" ,python-pytest))) |
| 57 | (home-page "https://jupyter.org") |
| 58 | (synopsis "Jupyter protocol implementation") |
| 59 | (description |
| 60 | "This Python library is an experimental implementation of the |
| 61 | @uref{https://jupyter-client.readthedocs.io/en/latest/messaging.html, Jupyter |
| 62 | protocol} to be used by both clients and kernels.") |
| 63 | (license license:bsd-3) |
| 64 | (properties '((upstream-name . "jupyter_protocol"))))) |
| 65 | |
| 66 | (define-public python-jupyter-kernel-mgmt |
| 67 | (package |
| 68 | (name "python-jupyter-kernel-mgmt") |
| 69 | (version "0.4.0") |
| 70 | (source (origin |
| 71 | (method url-fetch) |
| 72 | (uri (pypi-uri "jupyter_kernel_mgmt" version)) |
| 73 | (sha256 |
| 74 | (base32 |
| 75 | "0i7a78dn89ca8h0a42giyxwcmk6y4wrdr7q8h2ax9vybb84c795q")))) |
| 76 | (build-system python-build-system) |
| 77 | (propagated-inputs |
| 78 | `(("python-dateutil" ,python-dateutil) |
| 79 | ("python-entrypoints" ,python-entrypoints) |
| 80 | ("python-jupyter-core" ,python-jupyter-core) |
| 81 | ("python-jupyter-protocol" ,python-jupyter-protocol) |
| 82 | ("python-pyzmq" ,python-pyzmq) |
| 83 | ("python-traitlets" ,python-traitlets))) |
| 84 | (native-inputs |
| 85 | `(("python-ipykernel" ,python-ipykernel) |
| 86 | ("python-ipython" ,python-ipython) |
| 87 | ("python-mock" ,python-mock) |
| 88 | ("python-pytest" ,python-pytest))) |
| 89 | (home-page "https://jupyter.org") |
| 90 | (synopsis "Discover, launch, and communicate with Jupyter kernels") |
| 91 | (description |
| 92 | "This package is an experimental refactoring of the machinery for |
| 93 | launching and using Jupyter kernels.") |
| 94 | (license license:bsd-3) |
| 95 | (properties '((upstream-name . "jupyter_kernel_mgmt"))))) |
| 96 | |
| 97 | (define-public python-jupyter-kernel-test |
| 98 | (package |
| 99 | (name "python-jupyter-kernel-test") |
| 100 | (version "0.3") |
| 101 | (home-page "https://github.com/jupyter/jupyter_kernel_test") |
| 102 | (source (origin |
| 103 | ;; PyPI has a ".whl" file but not a proper source release. |
| 104 | ;; Thus, fetch code from Git. |
| 105 | (method git-fetch) |
| 106 | (uri (git-reference (url home-page) (commit version))) |
| 107 | (file-name (git-file-name name version)) |
| 108 | (sha256 |
| 109 | (base32 |
| 110 | "00iy74i4i8is6axb9vlsm0b9wxkvyyxnbl8r0i4gaj3xd788jm83")))) |
| 111 | (build-system python-build-system) |
| 112 | (arguments |
| 113 | ;; The repo doesn't contain a "setup.py" file so install files manually. |
| 114 | '(#:phases (modify-phases %standard-phases |
| 115 | (delete 'build) |
| 116 | (delete 'check) |
| 117 | (replace 'install |
| 118 | (lambda* (#:key inputs outputs #:allow-other-keys) |
| 119 | (let* ((out (assoc-ref outputs "out")) |
| 120 | (version (python-version (assoc-ref inputs "python"))) |
| 121 | (pydir (string-append out "/lib/python" |
| 122 | version "/site-packages/" |
| 123 | "jupyter_kernel_test"))) |
| 124 | (for-each (lambda (file) |
| 125 | (install-file file pydir)) |
| 126 | (find-files "jupyter_kernel_test" |
| 127 | "\\.py$")) |
| 128 | #t)))))) |
| 129 | (propagated-inputs |
| 130 | `(("python-jupyter-kernel-mgmt" ,python-jupyter-kernel-mgmt) |
| 131 | ("python-jupyter-protocol" ,python-jupyter-protocol) |
| 132 | ("python-jsonschema" ,python-jsonschema))) |
| 133 | (synopsis "Test Jupyter kernels") |
| 134 | (description |
| 135 | "@code{jupyter_kernel_test} is a tool for testing Jupyter kernels. It |
| 136 | tests kernels for successful code execution and conformance with the |
| 137 | @uref{https://jupyter-client.readthedocs.io/en/latest/messaging.html, Jupyter |
| 138 | Messaging Protocol}.") |
| 139 | (license license:bsd-3))) |
| 140 | |
| 141 | (define-public xeus |
| 142 | (package |
| 143 | (name "xeus") |
| 144 | (version "0.23.2") |
| 145 | (source (origin |
| 146 | (method git-fetch) |
| 147 | (uri (git-reference |
| 148 | (url "https://github.com/QuantStack/xeus.git") |
| 149 | (commit version))) |
| 150 | (sha256 |
| 151 | (base32 |
| 152 | "1m1b6z1538r7mv2ggn7bdbd9570ja7cadplq64zl8rgl2c8vdi2a")) |
| 153 | (file-name (git-file-name name version)))) |
| 154 | (build-system cmake-build-system) |
| 155 | (arguments |
| 156 | '(#:configure-flags '("-DBUILD_STATIC_LIBS=OFF" |
| 157 | "-DDISABLE_ARCH_NATIVE=ON" ;no '-march=native' |
| 158 | "-DBUILD_TESTING=ON"))) |
| 159 | (native-inputs |
| 160 | `(("pkg-config" ,pkg-config) |
| 161 | |
| 162 | ;; The following inputs are used by the test suite. |
| 163 | ("googletest" ,googletest) |
| 164 | ("python-pytest" ,python-pytest) |
| 165 | ("python" ,python-3) |
| 166 | ("python-jupyter-kernel-test" ,python-jupyter-kernel-test) |
| 167 | ("python-jupyter-client" ,python-jupyter-client))) |
| 168 | (inputs |
| 169 | `(("xtl" ,xtl) |
| 170 | ("json-modern-cxx" ,json-modern-cxx) |
| 171 | ("cppzmq" ,cppzmq) |
| 172 | ("zeromq" ,zeromq) |
| 173 | ("openssl" ,openssl) |
| 174 | ("util-linux" ,util-linux))) ;libuuid |
| 175 | (home-page "https://quantstack.net/xeus") |
| 176 | (synopsis "C++ implementation of the Jupyter Kernel protocol") |
| 177 | (description |
| 178 | "@code{xeus} is a library meant to facilitate the implementation of |
| 179 | kernels for Jupyter. It takes the burden of implementing the Jupyter Kernel |
| 180 | protocol so developers can focus on implementing the interpreter part of the |
| 181 | kernel. |
| 182 | |
| 183 | Several Jupyter kernels are built upon @code{xeus}, such as @code{xeus-cling}, |
| 184 | a kernel for the C++ programming language, and @code{xeus-python}, an |
| 185 | alternative Python kernel for Jupyter.") |
| 186 | (license license:bsd-3))) |