1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2019 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2021 Ricardo Wurmus <rekado@elephly.net>
4 ;;; Copyright © 2021 Hugo Lecomte <hugo.lecomte@inria.fr>
5 ;;; Copyright © 2022 Marius Bakke <marius@gnu.org>
7 ;;; This file is part of GNU Guix.
9 ;;; GNU Guix is free software; you can redistribute it and/or modify it
10 ;;; under the terms of the GNU General Public License as published by
11 ;;; the Free Software Foundation; either version 3 of the License, or (at
12 ;;; your option) any later version.
14 ;;; GNU Guix is distributed in the hope that it will be useful, but
15 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;;; GNU General Public License for more details.
19 ;;; You should have received a copy of the GNU General Public License
20 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
22 (define-module (gnu packages jupyter)
23 #:use-module ((guix licenses) #:prefix license:)
24 #:use-module (guix packages)
25 #:use-module (guix download)
26 #:use-module (guix git-download)
27 #:use-module (guix build-system cmake)
28 #:use-module (guix build-system python)
29 #:use-module (gnu packages bash)
30 #:use-module (gnu packages check)
31 #:use-module (gnu packages cpp)
32 #:use-module (gnu packages linux)
33 #:use-module (gnu packages monitoring)
34 #:use-module (gnu packages networking)
35 #:use-module (gnu packages pkg-config)
36 #:use-module (gnu packages python)
37 #:use-module (gnu packages python-build)
38 #:use-module (gnu packages python-check)
39 #:use-module (gnu packages python-crypto)
40 #:use-module (gnu packages python-xyz)
41 #:use-module (gnu packages python-web)
42 #:use-module (gnu packages rdf)
43 #:use-module (gnu packages time)
44 #:use-module (gnu packages xml)
45 #:use-module (gnu packages tls)
46 #:use-module (gnu packages sphinx)
47 #:use-module (gnu packages serialization)
48 #:use-module (gnu packages docker))
50 (define-public python-jupyter-protocol
52 (name "python-jupyter-protocol")
56 (uri (pypi-uri "jupyter_protocol" version))
59 "1bk3as5yw9y5nmq6l15nr46aby34phmvsx9kxgqnm5pd5q2b5h57"))))
60 (build-system python-build-system)
62 (list python-dateutil python-jupyter-core python-pyzmq
65 (list python-ipykernel python-ipython python-mock python-pytest))
66 (home-page "https://jupyter.org")
67 (synopsis "Jupyter protocol implementation")
69 "This Python library is an experimental implementation of the
70 @uref{https://jupyter-client.readthedocs.io/en/latest/messaging.html, Jupyter
71 protocol} to be used by both clients and kernels.")
72 (license license:bsd-3)
73 (properties '((upstream-name . "jupyter_protocol")))))
75 (define-public python-jupyter-kernel-mgmt
77 (name "python-jupyter-kernel-mgmt")
81 (uri (pypi-uri "jupyter_kernel_mgmt" version))
84 "0i7a78dn89ca8h0a42giyxwcmk6y4wrdr7q8h2ax9vybb84c795q"))))
85 (build-system python-build-system)
90 python-jupyter-protocol
94 (list python-ipykernel python-ipython python-mock python-pytest))
95 (home-page "https://jupyter.org")
96 (synopsis "Discover, launch, and communicate with Jupyter kernels")
98 "This package is an experimental refactoring of the machinery for
99 launching and using Jupyter kernels.")
100 (license license:bsd-3)
101 (properties '((upstream-name . "jupyter_kernel_mgmt")))))
103 (define-public python-jupyter-kernel-test
105 (name "python-jupyter-kernel-test")
107 (home-page "https://github.com/jupyter/jupyter_kernel_test")
109 ;; PyPI has a ".whl" file but not a proper source release.
110 ;; Thus, fetch code from Git.
112 (uri (git-reference (url home-page) (commit version)))
113 (file-name (git-file-name name version))
116 "00iy74i4i8is6axb9vlsm0b9wxkvyyxnbl8r0i4gaj3xd788jm83"))))
117 (build-system python-build-system)
119 ;; The repo doesn't contain a "setup.py" file so install files manually.
120 '(#:phases (modify-phases %standard-phases
124 (lambda* (#:key inputs outputs #:allow-other-keys)
125 (let* ((out (assoc-ref outputs "out"))
126 (version (python-version (assoc-ref inputs "python")))
127 (pydir (string-append out "/lib/python"
128 version "/site-packages/"
129 "jupyter_kernel_test")))
130 (for-each (lambda (file)
131 (install-file file pydir))
132 (find-files "jupyter_kernel_test"
136 (list python-jupyter-kernel-mgmt python-jupyter-protocol
138 (synopsis "Test Jupyter kernels")
140 "@code{jupyter_kernel_test} is a tool for testing Jupyter kernels. It
141 tests kernels for successful code execution and conformance with the
142 @uref{https://jupyter-client.readthedocs.io/en/latest/messaging.html, Jupyter
143 Messaging Protocol}.")
144 (license license:bsd-3)))
153 (url "https://github.com/QuantStack/xeus")
157 "1m1b6z1538r7mv2ggn7bdbd9570ja7cadplq64zl8rgl2c8vdi2a"))
158 (file-name (git-file-name name version))))
159 (build-system cmake-build-system)
161 '(#:configure-flags '("-DBUILD_STATIC_LIBS=OFF"
162 "-DDISABLE_ARCH_NATIVE=ON" ;no '-march=native'
163 "-DBUILD_TESTING=ON")))
166 ;; The following inputs are used by the test suite.
170 python-jupyter-kernel-test
171 python-jupyter-client))
178 `(,util-linux "lib"))) ;libuuid
179 (home-page "https://quantstack.net/xeus")
180 (synopsis "C++ implementation of the Jupyter Kernel protocol")
182 "@code{xeus} is a library meant to facilitate the implementation of
183 kernels for Jupyter. It takes the burden of implementing the Jupyter Kernel
184 protocol so developers can focus on implementing the interpreter part of the
187 Several Jupyter kernels are built upon @code{xeus}, such as @code{xeus-cling},
188 a kernel for the C++ programming language, and @code{xeus-python}, an
189 alternative Python kernel for Jupyter.")
190 (license license:bsd-3)))
192 (define-public python-jupyterlab-pygments
194 (name "python-jupyterlab-pygments")
199 (uri (pypi-uri "jupyterlab_pygments" version))
202 "0ij14mmnc39nmf84i0av6j9glazjic7wzv1qyhr0j5966s3s1kfg"))))
203 (build-system python-build-system)
204 (arguments '(#:tests? #false)) ; there are no tests
206 (list python-pygments))
207 (home-page "https://jupyter.org")
208 (synopsis "Pygments theme using JupyterLab CSS variables")
210 "This package contains a syntax coloring theme for pygments making use of
211 the JupyterLab CSS variables.")
212 (license license:bsd-3)))
214 (define-public python-jupyter-packaging
216 (name "python-jupyter-packaging")
221 (uri (pypi-uri "jupyter_packaging" version))
224 "0r015c0m713d19asmpimsw6bk2sqv2lpd2nccgjzjdj5h1crg0bg"))))
225 (build-system python-build-system)
227 (list python-deprecation python-packaging python-setuptools
228 python-tomlkit python-wheel))
230 (list python-pypa-build python-coverage python-pytest
231 python-pytest-cov python-pytest-mock))
232 (home-page "https://jupyter.org")
233 (synopsis "Jupyter packaging utilities")
234 (description "This package provides tools to help build and install
235 Jupyter Python packages that require a pre-build step that may include
236 JavaScript build steps.")
237 (license license:bsd-3)))
239 (define-public python-jupyter-server
241 (name "python-jupyter-server")
246 (uri (pypi-uri "jupyter_server" version))
249 "1gvjbsw5nl94hz02rnkr4g4kkvh9fz7i45vz17hzwyvdpj7bd8yk"))))
250 (build-system python-build-system)
253 (modify-phases %standard-phases
255 (lambda* (#:key inputs outputs tests? #:allow-other-keys)
257 (add-installed-pythonpath inputs outputs)
258 (let ((home (string-append (getcwd) "/guix-home")))
259 (setenv "HOME" home))
260 ;; Add jupyter-server executable to PATH.
262 (string-append (assoc-ref outputs "out") "/bin:"
264 (with-directory-excursion "jupyter_server"
265 ;; The pytest fixtures are only loaded when the file is
266 ;; called conftest.py.
267 (rename-file "pytest_plugin.py" "conftest.py")
268 (invoke "pytest" "-vv"
269 ;; Fails with internal server error
270 "-k" "not test_list_formats"
271 ;; Integration tests require a server.
272 "-m" "not integration_test"))))))))
276 python-ipython-genutils
278 python-jupyter-client
282 python-prometheus-client
284 python-requests-unixsocket
289 python-websocket-client))
291 (list python-coverage
294 python-pytest-console-scripts
297 python-pytest-tornasync
299 (home-page "https://jupyter.org")
300 (synopsis "Core services, APIs, and REST endpoints for Jupyter web applications")
302 "This package provides the backend—i.e. core services, APIs, and REST
303 endpoints—to Jupyter web applications.")
304 (license license:expat)))
306 (define-public python-jupyterlab-widgets
308 (name "python-jupyterlab-widgets")
313 (uri (pypi-uri "jupyterlab_widgets" version))
316 "0y7vhhas3qndiypcpcfnhrj9n92v2w4hdc86nn620s9h9nl2j6jw"))))
317 (build-system python-build-system)
319 (list python-jupyter-packaging python-setuptools))
320 (home-page "https://github.com/jupyter-widgets/ipywidgets")
321 (synopsis "Interactive widgets for Jupyter Notebooks")
322 (description "ipywidgets, also known as jupyter-widgets or simply widgets,
323 are interactive HTML widgets for Jupyter notebooks and the IPython kernel.")
324 (license license:bsd-3)))
326 (define-public python-nbclient
328 (name "python-nbclient")
333 (uri (pypi-uri "nbclient" version))
336 "172q4r6mq0lg394di0pc6ipvniy14jg38wkdsj48r366609jf5yv"))))
337 (build-system python-build-system)
338 ;; Tests require a kernel via python-ipykernel, and also tools from
340 (arguments '(#:tests? #false))
342 (list python-async-generator python-jupyter-client python-nbformat
343 python-nest-asyncio python-traitlets))
347 python-check-manifest
351 ;; ("python-ipykernel" ,python-ipykernel)
352 ;; ("python-ipython" ,python-ipython)
353 ;; ("python-ipywidgets" ,python-ipywidgets)
364 (home-page "https://jupyter.org")
365 (synopsis "Client library for executing notebooks")
367 "This package provides a client library for executing notebooks. Formerly
368 nbconvert's @code{ExecutePreprocessor.}")
369 (license license:bsd-3)))
371 (define-public repo2docker
374 (version "2021.08.0")
378 (url "https://github.com/jupyterhub/repo2docker/")
380 (file-name (git-file-name name version))
383 "111irpghzys0s5ixs8paskz7465cls1sm9d5bg45a15jklcw84a9"))))
384 (outputs '("out" "doc"))
385 (build-system python-build-system)
387 `(#:phases (modify-phases %standard-phases
388 (add-after 'patch-shebangs 'fix-install-miniforge
389 (lambda* (#:key outputs #:allow-other-keys)
390 (let* ((out (assoc-ref outputs "out")))
391 (substitute* (find-files
392 out "^(install-miniforge|install-nix|\
393 nix-shell-wrapper|repo2docker-entrypoint)")
394 (("^#!(.*)/bin/bash")
396 (substitute* (find-files out "^freeze\\.py$")
397 (("^#!(.*)/bin/python3")
398 "#!/bin/python3\n")))))
399 (add-after 'install 'make-doc
400 (lambda* (#:key outputs #:allow-other-keys)
401 (let* ((out (assoc-ref outputs "doc"))
402 (doc (string-append out "/share/doc/"
403 ,(package-name this-package))))
405 (string-append (getcwd) ":"
406 (getenv "GUIX_PYTHONPATH")))
407 ;; Don't treat warnings as errors.
408 (substitute* "docs/Makefile"
409 (("(SPHINXOPTS[[:blank:]]+= )-W" _ group)
411 (with-directory-excursion "docs"
412 (invoke "make" "html")
413 (copy-recursively "build/html"
414 (string-append doc "/html")))))))))
416 (list python-traitlets
426 (list python-sphinx python-entrypoints python-recommonmark
427 python-sphinxcontrib-autoprogram python-pydata-sphinx-theme))
428 (home-page "https://repo2docker.readthedocs.io/en/latest/index.html#")
429 (synopsis "Generate docker images from repositories")
431 "repo2docker fetches a repository (from GitHub, GitLab, Zenodo, Figshare,
432 Dataverse installations, a Git repository or a local directory) and builds a
433 container image in which the code can be executed. The image build process is
434 based on the configuration files found in the repository. repo2docker can be
435 used to explore a repository locally by building and executing the constructed
436 image of the repository, or as a means of building images that are pushed to a
438 (license license:bsd-3)))
440 (define-public python-bash-kernel
442 (name "python-bash-kernel")
446 (uri (pypi-uri "bash_kernel" version))
449 "0w0nbr3iqqsgpk83rgd0f5b02462bkyj2n0h6i9dwyc1vpnq9350"))))
450 (build-system python-build-system)
454 (modify-phases %standard-phases
455 (add-after 'unpack 'bash-references
456 (lambda* (#:key inputs #:allow-other-keys)
457 (substitute* "bash_kernel/kernel.py"
459 (string-append "\"" (assoc-ref inputs "bash") "/bin/bash\""))
461 (string-append "['" (assoc-ref inputs "bash") "/bin/bash', ")))
463 (add-after 'install 'install-kernelspec
464 (lambda* (#:key outputs #:allow-other-keys)
465 (let ((out (assoc-ref outputs "out")))
466 (setenv "HOME" "/tmp")
467 (invoke "python" "-m" "bash_kernel.install" "--prefix" out)
472 (list python-pexpect python-ipykernel python-jupyter-client))
473 (home-page "https://github.com/takluyver/bash_kernel")
474 (synopsis "Jupyter kernel for Bash")
475 (description "A bash shell kernel for Jupyter.")
476 (license license:expat)))
478 (define-public python-sparqlkernel
480 (name "python-sparqlkernel")
484 (uri (pypi-uri "sparqlkernel" version))
487 "004v22nyi5cnpxq4fiws89p7i5wcnzv45n3n70axdd6prh6rkapx"))))
488 (build-system python-build-system)
492 (modify-phases %standard-phases
493 (add-after 'unpack 'no-custom-css
494 (lambda* (#:key inputs #:allow-other-keys)
495 (substitute* "sparqlkernel/install.py"
496 (("install_custom_css\\( destd, PKGNAME \\)") ""))
498 (add-after 'install 'install-kernelspec
499 (lambda* (#:key inputs outputs #:allow-other-keys)
500 (let ((out (assoc-ref outputs "out")))
501 (setenv "HOME" "/tmp")
502 (add-installed-pythonpath inputs outputs)
504 (string-append out "/bin/jupyter-sparqlkernel")
506 (string-append "--InstallKernelSpec.prefix=" out))
509 (list python-traitlets python-jupyter-client python-notebook
510 python-ipykernel python-html5lib-0.9))
512 (list python-sparqlwrapper python-pygments))
513 (home-page "https://github.com/paulovn/sparql-kernel")
514 (synopsis "Jupyter kernel for SPARQL")
515 (description "This module installs a Jupyter kernel for SPARQL. It allows
516 sending queries to an SPARQL endpoint and fetching & presenting the results in
518 (license license:bsd-3)))
520 (define-public python-voila
522 (name "python-voila")
527 (uri (pypi-uri "voila" version))
530 "0krfc95yjlhjdmrsladhy6lpf4xs1zw49nmkyl4pkykndglvwa1m"))))
531 (build-system python-build-system)
533 (list python-jupyter-client python-jupyter-server python-nbclient
536 (list python-ipywidgets
537 python-jupyter-packaging
541 python-pytest-tornasync
544 (home-page "https://github.com/voila-dashboards/voila")
545 (synopsis "Render live Jupyter notebooks with interactive widgets")
547 "Voilà turns Jupyter notebooks into standalone web applications. Unlike
548 the usual HTML-converted notebooks, each user connecting to the Voilà tornado
549 application gets a dedicated Jupyter kernel which can execute the callbacks to
550 changes in Jupyter interactive widgets.")
551 (license license:bsd-3)))