gnu: Add python-jupyter-kernel-test.
[jackhill/guix/guix.git] / gnu / packages / jupyter.scm
CommitLineData
2cde4a96
LC
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)
a52d8cc6 23 #:use-module (guix git-download)
2cde4a96
LC
24 #:use-module (guix build-system python)
25 #:use-module (gnu packages check)
26 #:use-module (gnu packages python)
27 #:use-module (gnu packages python-xyz)
28 #:use-module (gnu packages time))
29
30(define-public python-jupyter-protocol
31 (package
32 (name "python-jupyter-protocol")
33 (version "0.1.1")
34 (source (origin
35 (method url-fetch)
36 (uri (pypi-uri "jupyter_protocol" version))
37 (sha256
38 (base32
39 "1bk3as5yw9y5nmq6l15nr46aby34phmvsx9kxgqnm5pd5q2b5h57"))))
40 (build-system python-build-system)
41 (propagated-inputs
42 `(("python-dateutil" ,python-dateutil)
43 ("python-jupyter-core" ,python-jupyter-core)
44 ("python-pyzmq" ,python-pyzmq)
45 ("python-traitlets" ,python-traitlets)))
46 (native-inputs
47 `(("python-ipykernel" ,python-ipykernel)
48 ("python-ipython" ,python-ipython)
49 ("python-mock" ,python-mock)
50 ("python-pytest" ,python-pytest)))
51 (home-page "https://jupyter.org")
52 (synopsis "Jupyter protocol implementation")
53 (description
54 "This Python library is an experimental implementation of the
55@uref{https://jupyter-client.readthedocs.io/en/latest/messaging.html, Jupyter
56protocol} to be used by both clients and kernels.")
57 (license license:bsd-3)
58 (properties '((upstream-name . "jupyter_protocol")))))
2835fb07
LC
59
60(define-public python-jupyter-kernel-mgmt
61 (package
62 (name "python-jupyter-kernel-mgmt")
63 (version "0.4.0")
64 (source (origin
65 (method url-fetch)
66 (uri (pypi-uri "jupyter_kernel_mgmt" version))
67 (sha256
68 (base32
69 "0i7a78dn89ca8h0a42giyxwcmk6y4wrdr7q8h2ax9vybb84c795q"))))
70 (build-system python-build-system)
71 (propagated-inputs
72 `(("python-dateutil" ,python-dateutil)
73 ("python-entrypoints" ,python-entrypoints)
74 ("python-jupyter-core" ,python-jupyter-core)
75 ("python-jupyter-protocol" ,python-jupyter-protocol)
76 ("python-pyzmq" ,python-pyzmq)
77 ("python-traitlets" ,python-traitlets)))
78 (native-inputs
79 `(("python-ipykernel" ,python-ipykernel)
80 ("python-ipython" ,python-ipython)
81 ("python-mock" ,python-mock)
82 ("python-pytest" ,python-pytest)))
83 (home-page "https://jupyter.org")
84 (synopsis "Discover, launch, and communicate with Jupyter kernels")
85 (description
86 "This package is an experimental refactoring of the machinery for
87launching and using Jupyter kernels.")
88 (license license:bsd-3)
89 (properties '((upstream-name . "jupyter_kernel_mgmt")))))
a52d8cc6
LC
90
91(define-public python-jupyter-kernel-test
92 (package
93 (name "python-jupyter-kernel-test")
94 (version "0.3")
95 (home-page "https://github.com/jupyter/jupyter_kernel_test")
96 (source (origin
97 ;; PyPI has a ".whl" file but not a proper source release.
98 ;; Thus, fetch code from Git.
99 (method git-fetch)
100 (uri (git-reference (url home-page) (commit version)))
101 (file-name (git-file-name name version))
102 (sha256
103 (base32
104 "00iy74i4i8is6axb9vlsm0b9wxkvyyxnbl8r0i4gaj3xd788jm83"))))
105 (build-system python-build-system)
106 (arguments
107 ;; The repo doesn't contain a "setup.py" file so install files manually.
108 '(#:phases (modify-phases %standard-phases
109 (delete 'build)
110 (delete 'check)
111 (replace 'install
112 (lambda* (#:key inputs outputs #:allow-other-keys)
113 (let* ((out (assoc-ref outputs "out"))
114 (version ((@@ (guix build python-build-system)
115 get-python-version)
116 (assoc-ref inputs "python")))
117 (pydir (string-append out "/lib/python"
118 version "/site-packages/"
119 "jupyter_kernel_test")))
120 (for-each (lambda (file)
121 (install-file file pydir))
122 (find-files "jupyter_kernel_test"
123 "\\.py$"))
124 #t))))))
125 (propagated-inputs
126 `(("python-jupyter-kernel-mgmt" ,python-jupyter-kernel-mgmt)
127 ("python-jupyter-protocol" ,python-jupyter-protocol)
128 ("python-jsonschema" ,python-jsonschema)))
129 (synopsis "Test Jupyter kernels")
130 (description
131 "@code{jupyter_kernel_test} is a tool for testing Jupyter kernels. It
132tests kernels for successful code execution and conformance with the
133@uref{https://jupyter-client.readthedocs.io/en/latest/messaging.html, Jupyter
134Messaging Protocol}.")
135 (license license:bsd-3)))