aboutsummaryrefslogtreecommitdiff
path: root/gn/packages/jupyterhub.scm
blob: 838412bdcdad8fe4fc4ef55262c9120e3fbd48f3 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
(define-module (gn packages jupyterhub)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (guix packages)
  #:use-module (guix download)
  #:use-module (guix git-download)
  #:use-module (guix build-system python)
  #:use-module (gnu packages check)
  #:use-module (gnu packages databases)
  #:use-module (gnu packages docker)
  #:use-module (gnu packages libffi)
  #:use-module (gnu packages linux)
  #:use-module (gnu packages monitoring)
  #:use-module (gnu packages openstack)
  #:use-module (gnu packages protobuf)
  #:use-module (gnu packages python-build)
  #:use-module (gnu packages python-crypto)
  #:use-module (gnu packages python-web)
  #:use-module (gnu packages python-xyz)
  #:use-module (gnu packages rpc)
  #:use-module (gnu packages serialization)
  #:use-module (gnu packages time)
  #:use-module (gn packages node))

(define-public jupyterhub
  (package
    (name "jupyterhub")
    (version "1.0.0")
    (source
      (origin
        (method url-fetch)
        (uri (pypi-uri "jupyterhub" version))
        (sha256
         (base32
          "0zx6gw9yhgki05j21p6x1x2sf5a2mg2c2mx0ii8rl6q4b98ilm1k"))
        (patches
          (list
            (origin
              (method url-fetch)
              (uri "https://github.com/jupyterhub/jupyterhub/commit/b624116be79168f37af728195af663498f3c55c0.patch")
              (file-name "jupyterhub-fix-first-launch-errors.patch")
              (sha256
               (base32
                "00rbqz0rz2642ypfgpd49fv7wzpc9n0pdfqixqp3zxs6vqf3x372")))))))
    (build-system python-build-system)
    (arguments
     '(#:tests? #f ; Tests require a webserver, postgresql database and npm.
       #:phases
       (modify-phases %standard-phases
         (replace 'check
           (lambda* (#:key tests? inputs #:allow-other-keys)
             (if tests?
               ((let* ((postgres (assoc-ref inputs "postgresql"))
                       (initdb   (string-append postgres "/bin/initdb"))
                       (pg_ctl   (string-append postgres "/bin/pg_ctl"))
                       (psql     (string-append postgres "/bin/psql"))
                       )
                  ;; From .travis.yml
                  (invoke initdb "main")
                  (invoke pg_ctl "-D" "main" "start")
                  (invoke psql "--list")
                  ;; From ci/init-db.sh
                  (invoke psql "-d" "postgres" "-c"
                          "CREATE DATABASE jupyterhub_upgrade_072;")
                  (invoke psql "-d" "postgres" "-c"
                          "CREATE DATABASE jupyterhub_upgrade_081;")
                  (invoke psql "-d" "postgres" "-c"
                          "CREATE DATABASE jupyterhub_upgrade_094;")
                  (invoke "pytest" "-v" "--maxfail=2" "jupyterhub/tests"))
                )
               #t))))))
    (propagated-inputs
     `(;("node-configurable-http-proxy" ,node-configurable-http-proxy)
       ("python-alembic" ,python-alembic)
       ("python-async-generator" ,python-async-generator)
       ("python-certipy" ,python-certipy)
       ("python-dateutil" ,python-dateutil)
       ("python-entrypoints" ,python-entrypoints)
       ("python-jinja2" ,python-jinja2)
       ("python-oauthlib" ,python-oauthlib)
       ("python-pamela" ,python-pamela)
       ("python-prometheus-client" ,python-prometheus-client)
       ("python-requests" ,python-requests)
       ("python-sqlalchemy" ,python-sqlalchemy)
       ("python-tornado" ,python-tornado)
       ("python-traitlets" ,python-traitlets)
       ;; Recommended but not required:
       ("python-pycurl" ,python-pycurl)))
    (native-inputs
     `(
       ("postgresql" ,postgresql)
       ("python-psycopg2" ,python-psycopg2)

       ("python-beautifulsoup4" ,python-beautifulsoup4)
       ("python-jupyter-client" ,python-jupyter-client)
       ("python-notebook" ,python-notebook)
       ("python-pytest" ,python-pytest)
       ("python-pyzmq" ,python-pyzmq)
       ("python-requests-mock" ,python-requests-mock)))
    (home-page "https://jupyter.org")
    (synopsis "Multi-user server for Jupyter notebooks")
    (description
     "JupyterHub is the best way to serve Jupyter notebook for multiple users.
It can be used in a classes of students, a corporate data science group or
scientific research group. It is a multi-user Hub that spawns, manages, and
proxies multiple instances of the single-user Jupyter notebook server.")
    (license license:bsd-3)))

(define-public the-littlest-jupyterhub
  (let ((commit "29e8bcc4865d26ef67910862a567f55f46f96593") ; Dec 6, 2019
        (revision "2"))
    (package
      (name "the-littlest-jupyterhub")
      (version (git-version "0.0.0" revision commit))
      (source
        (origin
          (method git-fetch)
          (uri (git-reference
                 (url "https://github.com/jupyterhub/the-littlest-jupyterhub.git")
                 (commit commit)))
          (file-name (git-file-name name version))
          (sha256
           (base32
            "10xrmia8w9vd9zmgww426kyd95jx81l5c4zpq84gqbvkibq61rsa"))))
      (build-system python-build-system)
      (arguments
       '(#:phases
         (modify-phases %standard-phases
           (add-after 'unpack 'loosen-input-requirements
             (lambda _
               (substitute* "setup.py"
                 (("==.*'") "'"))
               #t))
           (add-after 'unpack 'patch-some-sources
             (lambda* (#:key inputs #:allow-other-keys)
               (let ((python (assoc-ref inputs "python")))
                 ;; Delete some tests that we're not going to run.
                 (delete-file "tests/test_conda.py")
                 (delete-file "tests/test_user.py")
                 (delete-file "tests/test_utils.py")
                 ;; No need to make node available for the test suite.
                 (substitute* "tests/test_installer.py"
                   (("installer.ensure_node.*") "")
                   (("/usr/bin/node") (string-append python "/bin/python")))
                 ;; Don't download traefik.
                 (substitute* "tests/test_traefik.py"
                   (("traefik.ensure_traefik_binary")
                    "#traefik.ensure_traefik_binary")
                   (("assert traefik") "#assert traefik")
                   (("assert \\(traefik") "#assert (traefik"))
                 #t)))
           (replace 'check
             (lambda _
               (invoke "python3" "-m" "pytest" "-v" "tests/"))))))
      (propagated-inputs
       `(("python-ruamel.yaml" ,python-ruamel.yaml)
         ("python-jinja2" ,python-jinja2)
         ("python-pluggy" ,python-pluggy)
         ("python-passlib" ,python-passlib)
         ("python-backoff" ,python-backoff)
         ("python-requests" ,python-requests)
         ("python-jupyterhub-traefik-proxy" ,python-jupyterhub-traefic-proxy)))
      (native-inputs
       `(("python-pytest" ,python-pytest)
         ("python-pytoml" ,python-pytoml)))
      (home-page "https://the-littlest-jupyterhub.readthedocs.io/en/latest/")
      (synopsis "JupyterHub server for a single server")
      (description
       "The Littlest JupyterHub (TLJH) distribution helps you provide Jupyter
Notebooks to 1-50 users on a single server.  Administrators who do not consider
themselves 'system administrators' but would like to provide hosted Jupyter
Notebooks for their students / users are the primary audience.  All users are
provided with the same environment, and administrators can easily install
libraries into this environment without any specialized knowledge.")
      (license license:bsd-3))))

(define-public python-backoff
  (package
    (name "python-backoff")
    (version "1.8.1")
    (source
      (origin
        (method url-fetch)
        (uri (pypi-uri "backoff" version))
        (sha256
         (base32
          "0g2s4p34ml8dnldbj5qkg7ni5bwsq492nhry2inc2pn66qyx47iz"))))
    (build-system python-build-system)
    (home-page "https://github.com/litl/backoff")
    (synopsis "Function decoration for backoff and retry")
    (description
     "Function decoration for backoff and retry")
    (license license:expat)))

(define-public python-jupyterhub-traefic-proxy
  (package
    (name "python-jupyterhub-traefic-proxy")
    (version "0.1.4")
    (source
      (origin
        (method git-fetch)
        (uri (git-reference
               (url "https://github.com/jupyterhub/traefik-proxy.git")
               (commit version)))
        (file-name (git-file-name name version))
        (sha256
         (base32
          "021lqll3b84qmyw417wj15wpvs8ckvabx8ygm4fjy9bdllaxmmag"))))
    (build-system python-build-system)
    (propagated-inputs
     `(("jupyterhub" ,jupyterhub)
       ("python-etcd3" ,python-etcd3)
       ("python-aiohttp" ,python-aiohttp)
       ("python-passlib" ,python-passlib)
       ("python-consul" ,python-consul)
       ("python-toml" ,python-toml)
       ("python-escapism" ,python-escapism)))
    (native-inputs
     `(("python-jupyter-client" ,python-jupyter-client)
       ("python-notebook" ,python-notebook)
       ("python-numpy" ,python-numpy)
       ("python-pyzmq" ,python-pyzmq)
       ("python-websockets" ,python-websockets)))
    (home-page "https://jupyterhub-traefik-proxy.readthedocs.io/")
    (synopsis "JupyterHub proxy implementation with traefik")
    (description "An implementation of the JupyterHub proxy api with traefik: an
extremely lightweight, portable reverse proxy implementation, that supports load
balancing and can configure itself automatically and dynamically.")
    (license license:bsd-3)))

(define-public python-etcd3
  (package
    (name "python-etcd3")
    (version "0.10.0")
    (source
      (origin
        (method url-fetch)
        (uri (pypi-uri "etcd3" version))
        (sha256
         (base32
          "11qf9v69h5gx212p9hv3m8z290gagn834x89y0gn7iijy2wj9995"))))
    (build-system python-build-system)
    (arguments '(#:tests? #f)) ; Tests require running etcd.
    (propagated-inputs
     `(("python-grpcio" ,python-grpcio)
       ("python-protobuf" ,python-protobuf)
       ("python-tenacity" ,python-tenacity)))
    (home-page "https://github.com/kragniz/python-etcd3")
    (synopsis "Python client for the etcd3 API")
    (description "Python client for the etcd3 API")
    (license license:asl2.0)))

(define-public python-escapism
  (package
    (name "python-escapism")
    (version "1.0.0")
    (source
      (origin
        (method url-fetch)
        (uri (pypi-uri "escapism" version))
        (sha256
         (base32
          "11lv1kqlk2brx1i2yczajga4c657z184f6fsnf2mnpx90kxc272z"))))
    (build-system python-build-system)
    (home-page "https://github.com/minrk/escapism")
    (synopsis "Simple, generic API for escaping strings")
    (description
     "Simple, generic API for escaping strings.")
    (license license:expat)))

;; This package is deprecated upstream.
;; Author suggests using python-toml
(define-public python-pytoml
  (package
    (name "python-pytoml")
    (version "0.1.21")
    (source
      (origin
        (method url-fetch)
        (uri (pypi-uri "pytoml" version))
        (sha256
         (base32
          "1rv1byiw82k7mj6aprcrqi2vdabs801y97xhfnrz7kxds34ggv4f"))))
    (build-system python-build-system)
    (home-page "https://github.com/avakar/pytoml")
    (synopsis "A parser for TOML-0.4.0")
    (description "A parser for TOML-0.4.0")
    (license license:expat)))

(define-public python-jupyter-repo2docker
  (package
    (name "python-jupyter-repo2docker")
    (version "0.10.0")
    (source
      (origin
        (method url-fetch)
        (uri (pypi-uri "jupyter-repo2docker" version))
        (sha256
         (base32
          "0nn0vcm3pmsrb0hhjwkqy80kgyab7mgny0f8ch7fcsxy2cljcrbr"))))
    (build-system python-build-system)
    (propagated-inputs
     `(("python-docker" ,python-docker)
       ("python-escapism" ,python-escapism)
       ("python-jinja2" ,python-jinja2)
       ("python-json-logger" ,python-json-logger)
       ("python-ruamel.yaml" ,python-ruamel.yaml)
       ("python-semver" ,python-semver)
       ("python-toml" ,python-toml)
       ("python-traitlets" ,python-traitlets)))
    (native-inputs
     `(("python-requests" ,python-requests)
       ("python-websocket-client" ,python-websocket-client)))
    (home-page "https://repo2docker.readthedocs.io/en/latest/")
    (synopsis "Turn git repositories into Jupyter enabled Docker Images")
    (description
     "@code{repo2docker} fetches a git repository and builds a container image
based on the configuration files found in the repository.")
    (license license:bsd-3)))