gnu: Remove unneeded uses of 'libiconv'.
[jackhill/guix/guix.git] / gnu / packages / jupyter.scm
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>
6 ;;;
7 ;;; This file is part of GNU Guix.
8 ;;;
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.
13 ;;;
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.
18 ;;;
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/>.
21
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))
49
50 (define-public python-jupyter-protocol
51 (package
52 (name "python-jupyter-protocol")
53 (version "0.1.1")
54 (source (origin
55 (method url-fetch)
56 (uri (pypi-uri "jupyter_protocol" version))
57 (sha256
58 (base32
59 "1bk3as5yw9y5nmq6l15nr46aby34phmvsx9kxgqnm5pd5q2b5h57"))))
60 (build-system python-build-system)
61 (propagated-inputs
62 (list python-dateutil python-jupyter-core python-pyzmq
63 python-traitlets))
64 (native-inputs
65 (list python-ipykernel python-ipython python-mock python-pytest))
66 (home-page "https://jupyter.org")
67 (synopsis "Jupyter protocol implementation")
68 (description
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")))))
74
75 (define-public python-jupyter-kernel-mgmt
76 (package
77 (name "python-jupyter-kernel-mgmt")
78 (version "0.4.0")
79 (source (origin
80 (method url-fetch)
81 (uri (pypi-uri "jupyter_kernel_mgmt" version))
82 (sha256
83 (base32
84 "0i7a78dn89ca8h0a42giyxwcmk6y4wrdr7q8h2ax9vybb84c795q"))))
85 (build-system python-build-system)
86 (propagated-inputs
87 (list python-dateutil
88 python-entrypoints
89 python-jupyter-core
90 python-jupyter-protocol
91 python-pyzmq
92 python-traitlets))
93 (native-inputs
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")
97 (description
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")))))
102
103 (define-public python-jupyter-kernel-test
104 (package
105 (name "python-jupyter-kernel-test")
106 (version "0.3")
107 (home-page "https://github.com/jupyter/jupyter_kernel_test")
108 (source (origin
109 ;; PyPI has a ".whl" file but not a proper source release.
110 ;; Thus, fetch code from Git.
111 (method git-fetch)
112 (uri (git-reference (url home-page) (commit version)))
113 (file-name (git-file-name name version))
114 (sha256
115 (base32
116 "00iy74i4i8is6axb9vlsm0b9wxkvyyxnbl8r0i4gaj3xd788jm83"))))
117 (build-system python-build-system)
118 (arguments
119 ;; The repo doesn't contain a "setup.py" file so install files manually.
120 '(#:phases (modify-phases %standard-phases
121 (delete 'build)
122 (delete 'check)
123 (replace 'install
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"
133 "\\.py$"))
134 #t))))))
135 (propagated-inputs
136 (list python-jupyter-kernel-mgmt python-jupyter-protocol
137 python-jsonschema))
138 (synopsis "Test Jupyter kernels")
139 (description
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)))
145
146 (define-public xeus
147 (package
148 (name "xeus")
149 (version "0.23.2")
150 (source (origin
151 (method git-fetch)
152 (uri (git-reference
153 (url "https://github.com/QuantStack/xeus")
154 (commit version)))
155 (sha256
156 (base32
157 "1m1b6z1538r7mv2ggn7bdbd9570ja7cadplq64zl8rgl2c8vdi2a"))
158 (file-name (git-file-name name version))))
159 (build-system cmake-build-system)
160 (arguments
161 '(#:configure-flags '("-DBUILD_STATIC_LIBS=OFF"
162 "-DDISABLE_ARCH_NATIVE=ON" ;no '-march=native'
163 "-DBUILD_TESTING=ON")))
164 (native-inputs
165 (list pkg-config
166 ;; The following inputs are used by the test suite.
167 googletest
168 python-pytest
169 python-3
170 python-jupyter-kernel-test
171 python-jupyter-client))
172 (inputs
173 (list xtl
174 json-modern-cxx
175 cppzmq
176 zeromq
177 openssl
178 `(,util-linux "lib"))) ;libuuid
179 (home-page "https://quantstack.net/xeus")
180 (synopsis "C++ implementation of the Jupyter Kernel protocol")
181 (description
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
185 kernel.
186
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)))
191
192 (define-public python-jupyterlab-pygments
193 (package
194 (name "python-jupyterlab-pygments")
195 (version "0.1.2")
196 (source
197 (origin
198 (method url-fetch)
199 (uri (pypi-uri "jupyterlab_pygments" version))
200 (sha256
201 (base32
202 "0ij14mmnc39nmf84i0av6j9glazjic7wzv1qyhr0j5966s3s1kfg"))))
203 (build-system python-build-system)
204 (arguments '(#:tests? #false)) ; there are no tests
205 (propagated-inputs
206 (list python-pygments))
207 (home-page "https://jupyter.org")
208 (synopsis "Pygments theme using JupyterLab CSS variables")
209 (description
210 "This package contains a syntax coloring theme for pygments making use of
211 the JupyterLab CSS variables.")
212 (license license:bsd-3)))
213
214 (define-public python-jupyter-packaging
215 (package
216 (name "python-jupyter-packaging")
217 (version "0.9.1")
218 (source
219 (origin
220 (method url-fetch)
221 (uri (pypi-uri "jupyter_packaging" version))
222 (sha256
223 (base32
224 "0r015c0m713d19asmpimsw6bk2sqv2lpd2nccgjzjdj5h1crg0bg"))))
225 (build-system python-build-system)
226 (propagated-inputs
227 (list python-deprecation python-packaging python-setuptools
228 python-tomlkit python-wheel))
229 (native-inputs
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)))
238
239 (define-public python-jupyter-server
240 (package
241 (name "python-jupyter-server")
242 (version "1.10.2")
243 (source
244 (origin
245 (method url-fetch)
246 (uri (pypi-uri "jupyter_server" version))
247 (sha256
248 (base32
249 "1gvjbsw5nl94hz02rnkr4g4kkvh9fz7i45vz17hzwyvdpj7bd8yk"))))
250 (build-system python-build-system)
251 (arguments
252 `(#:phases
253 (modify-phases %standard-phases
254 (replace 'check
255 (lambda* (#:key inputs outputs tests? #:allow-other-keys)
256 (when tests?
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.
261 (setenv "PATH"
262 (string-append (assoc-ref outputs "out") "/bin:"
263 (getenv "PATH")))
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"))))))))
273 (propagated-inputs
274 (list python-anyio
275 python-argon2-cffi
276 python-ipython-genutils
277 python-jinja2
278 python-jupyter-client
279 python-jupyter-core
280 python-nbconvert
281 python-nbformat
282 python-prometheus-client
283 python-pyzmq
284 python-requests-unixsocket
285 python-send2trash
286 python-terminado
287 python-tornado-6
288 python-traitlets
289 python-websocket-client))
290 (native-inputs
291 (list python-coverage
292 python-ipykernel
293 python-pytest
294 python-pytest-console-scripts
295 python-pytest-cov
296 python-pytest-mock
297 python-pytest-tornasync
298 python-requests))
299 (home-page "https://jupyter.org")
300 (synopsis "Core services, APIs, and REST endpoints for Jupyter web applications")
301 (description
302 "This package provides the backend—i.e. core services, APIs, and REST
303 endpoints—to Jupyter web applications.")
304 (license license:expat)))
305
306 (define-public python-jupyterlab-widgets
307 (package
308 (name "python-jupyterlab-widgets")
309 (version "1.0.0")
310 (source
311 (origin
312 (method url-fetch)
313 (uri (pypi-uri "jupyterlab_widgets" version))
314 (sha256
315 (base32
316 "0y7vhhas3qndiypcpcfnhrj9n92v2w4hdc86nn620s9h9nl2j6jw"))))
317 (build-system python-build-system)
318 (native-inputs
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)))
325
326 (define-public python-nbclient
327 (package
328 (name "python-nbclient")
329 (version "0.5.3")
330 (source
331 (origin
332 (method url-fetch)
333 (uri (pypi-uri "nbclient" version))
334 (sha256
335 (base32
336 "172q4r6mq0lg394di0pc6ipvniy14jg38wkdsj48r366609jf5yv"))))
337 (build-system python-build-system)
338 ;; Tests require a kernel via python-ipykernel, and also tools from
339 ;; nbconvert.
340 (arguments '(#:tests? #false))
341 (propagated-inputs
342 (list python-async-generator python-jupyter-client python-nbformat
343 python-nest-asyncio python-traitlets))
344 (native-inputs
345 (list python-black
346 python-bumpversion
347 python-check-manifest
348 python-codecov
349 python-coverage
350 python-flake8
351 ;; ("python-ipykernel" ,python-ipykernel)
352 ;; ("python-ipython" ,python-ipython)
353 ;; ("python-ipywidgets" ,python-ipywidgets)
354 python-mypy
355 python-pip
356 python-pytest
357 python-pytest-cov
358 python-setuptools
359 python-testpath
360 python-tox
361 python-twine
362 python-wheel
363 python-xmltodict))
364 (home-page "https://jupyter.org")
365 (synopsis "Client library for executing notebooks")
366 (description
367 "This package provides a client library for executing notebooks. Formerly
368 nbconvert's @code{ExecutePreprocessor.}")
369 (license license:bsd-3)))
370
371 (define-public repo2docker
372 (package
373 (name "repo2docker")
374 (version "2021.08.0")
375 (source (origin
376 (method git-fetch)
377 (uri (git-reference
378 (url "https://github.com/jupyterhub/repo2docker/")
379 (commit version)))
380 (file-name (git-file-name name version))
381 (sha256
382 (base32
383 "111irpghzys0s5ixs8paskz7465cls1sm9d5bg45a15jklcw84a9"))))
384 (outputs '("out" "doc"))
385 (build-system python-build-system)
386 (arguments
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")
395 "#!/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))))
404 (setenv "PYTHONPATH"
405 (string-append (getcwd) ":"
406 (getenv "GUIX_PYTHONPATH")))
407 ;; Don't treat warnings as errors.
408 (substitute* "docs/Makefile"
409 (("(SPHINXOPTS[[:blank:]]+= )-W" _ group)
410 group))
411 (with-directory-excursion "docs"
412 (invoke "make" "html")
413 (copy-recursively "build/html"
414 (string-append doc "/html")))))))))
415 (inputs
416 (list python-traitlets
417 python-toml
418 python-semver
419 python-ruamel.yaml
420 python-requests
421 python-json-logger
422 python-jinja2
423 python-escapism
424 python-docker))
425 (native-inputs
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")
430 (description
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
437 Docker registry.")
438 (license license:bsd-3)))
439
440 (define-public python-bash-kernel
441 (package
442 (name "python-bash-kernel")
443 (version "0.7.2")
444 (source (origin
445 (method url-fetch)
446 (uri (pypi-uri "bash_kernel" version))
447 (sha256
448 (base32
449 "0w0nbr3iqqsgpk83rgd0f5b02462bkyj2n0h6i9dwyc1vpnq9350"))))
450 (build-system python-build-system)
451 (arguments
452 `(#:tests? #f
453 #:phases
454 (modify-phases %standard-phases
455 (add-after 'unpack 'bash-references
456 (lambda* (#:key inputs #:allow-other-keys)
457 (substitute* "bash_kernel/kernel.py"
458 (("\"bash\"")
459 (string-append "\"" (assoc-ref inputs "bash") "/bin/bash\""))
460 (("\\['bash', ")
461 (string-append "['" (assoc-ref inputs "bash") "/bin/bash', ")))
462 #t))
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)
468 #t))))))
469 (inputs
470 (list bash))
471 (propagated-inputs
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)))
477
478 (define-public python-sparqlkernel
479 (package
480 (name "python-sparqlkernel")
481 (version "1.3.0")
482 (source (origin
483 (method url-fetch)
484 (uri (pypi-uri "sparqlkernel" version))
485 (sha256
486 (base32
487 "004v22nyi5cnpxq4fiws89p7i5wcnzv45n3n70axdd6prh6rkapx"))))
488 (build-system python-build-system)
489 (arguments
490 `(#:tests? #f
491 #:phases
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 \\)") ""))
497 #t))
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)
503 (invoke
504 (string-append out "/bin/jupyter-sparqlkernel")
505 "install"
506 (string-append "--InstallKernelSpec.prefix=" out))
507 #t))))))
508 (native-inputs
509 (list python-traitlets python-jupyter-client python-notebook
510 python-ipykernel python-html5lib-0.9))
511 (propagated-inputs
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
517 a notebook.")
518 (license license:bsd-3)))
519
520 (define-public python-voila
521 (package
522 (name "python-voila")
523 (version "0.2.10")
524 (source
525 (origin
526 (method url-fetch)
527 (uri (pypi-uri "voila" version))
528 (sha256
529 (base32
530 "0krfc95yjlhjdmrsladhy6lpf4xs1zw49nmkyl4pkykndglvwa1m"))))
531 (build-system python-build-system)
532 (propagated-inputs
533 (list python-jupyter-client python-jupyter-server python-nbclient
534 python-nbconvert))
535 (native-inputs
536 (list python-ipywidgets
537 python-jupyter-packaging
538 python-matplotlib
539 python-mock
540 python-pytest
541 python-pytest-tornasync
542 python-setuptools
543 python-tornado-6))
544 (home-page "https://github.com/voila-dashboards/voila")
545 (synopsis "Render live Jupyter notebooks with interactive widgets")
546 (description
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)))