Add package JupyterLab

  • Done
  • quality assurance status badge
Details
3 participants
  • Lars-Dominik Braun
  • Lars-Dominik Braun
  • Ludovic Courtès
Owner
unassigned
Submitted by
Lars-Dominik Braun
Severity
normal
L
L
Lars-Dominik Braun wrote on 24 Feb 2020 11:18
(address . guix-patches@gnu.org)
20200224101810.GA9010@zpidnp36
Hi,

this patch series adds Jupyter’s JupyterLab, which is the new frontend for
Jupyter Notebooks. The software works fine, but there are a few caveats

1) it comes with bundled pre-compiled JavaScript, which cannot be removed until
we have proper support for importing from NPM
2) it contains an extension manager, that downloads arbitrary packages from NPM
(`jupyter lab build`). This works, but is less than optimal imo. We should
figure out how to package extensions in guix.
3) also it is required to install the package `jupyter`, otherwise installed
kernels cannot be found and the `jupyter` command does not work.

Cheers,
Lars
From 4a5862e2add1d537770a5ea466dbb8a4851afad9 Mon Sep 17 00:00:00 2001
From: Lars-Dominik Braun <ldb@leibniz-psychology.org>
Date: Fri, 7 Feb 2020 08:38:32 +0100
Subject: [PATCH 1/5] gnu: Add package python-pytest-check-links

* gnu/packages/python-xyz.scm (python-pytest-check-links): New variable.
---
gnu/packages/python-xyz.scm | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)

Toggle diff (38 lines)
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 84b70954bd..902ca5030b 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -17570,3 +17570,31 @@ sequences.")
(define-public python2-fuzzywuzzy
(package-with-python2 python-fuzzywuzzy))
+
+(define-public python-pytest-check-links
+ (package
+ (name "python-pytest-check-links")
+ (version "0.3.0")
+ (source
+ (origin
+ (method url-fetch)
+ ;; URI uses underscores
+ (uri (pypi-uri "pytest_check_links" version))
+ (sha256
+ (base32
+ "12x3wmrdzm6wgk0vz02hb769h68nr49q47w5q1pj95pc89hsa34v"))))
+ (build-system python-build-system)
+ (propagated-inputs
+ `(("python-docutils" ,python-docutils)
+ ("python-html5lib" ,python-html5lib)
+ ("python-nbconvert" ,python-nbconvert)
+ ("python-nbformat" ,python-nbformat)
+ ("python-pytest" ,python-pytest)
+ ("python-six" ,python-six)))
+ (native-inputs
+ `(("python-pbr-minimal" ,python-pbr-minimal)))
+ (home-page
+ "https://github.com/minrk/pytest-check-links")
+ (synopsis "Check links in files")
+ (description "Plugin for pytest that checks URLs for HTML-containing files")
+ (license license:bsd-3)))
--
2.20.1
From 690d45cba7d1a21fa6ae97fbe4fec6e1abae3635 Mon Sep 17 00:00:00 2001
From: Lars-Dominik Braun <ldb@leibniz-psychology.org>
Date: Fri, 7 Feb 2020 08:39:55 +0100
Subject: [PATCH 2/5] gnu: Add package python-json5

* gnu/packages/python-xyz.scm (python-json5): New variable.
---
gnu/packages/python-xyz.scm | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)

Toggle diff (34 lines)
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 902ca5030b..ad1cd5fbd4 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -17598,3 +17598,27 @@ sequences.")
(synopsis "Check links in files")
(description "Plugin for pytest that checks URLs for HTML-containing files")
(license license:bsd-3)))
+
+(define-public python-json5
+ (package
+ (name "python-json5")
+ (version "0.8.5")
+ (source
+ (origin
+ ;; sample.json5 is missing from PyPi source tarball
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/dpranke/pyjson5.git")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "0nyngj18jlkgvm1177lc3cj47wm4yh3dqigygvcvw7xkyryafsqn"))))
+ (build-system python-build-system)
+ (home-page "https://github.com/dpranke/pyjson5")
+ (synopsis
+ "Python implementation of the JSON5 data format")
+ (description
+ "JSON5 extends the JSON data interchange format to make it slightly more
+usable as a configuration language. This Python package implements parsing and
+dumping of JSON5 data structures.")
+ (license license:asl2.0)))
--
2.20.1
From a4535f6002a618444171d5a92146fb7a7e7e8243 Mon Sep 17 00:00:00 2001
From: Lars-Dominik Braun <ldb@leibniz-psychology.org>
Date: Fri, 7 Feb 2020 08:40:41 +0100
Subject: [PATCH 3/5] gnu: Add package python-jupyterlab-server

* gnu/packages/python-xyz.scm (python-jupyterlab-server): New variable.
---
gnu/packages/python-xyz.scm | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)

Toggle diff (44 lines)
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index ad1cd5fbd4..92ee53fe6f 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -17622,3 +17622,37 @@ sequences.")
usable as a configuration language. This Python package implements parsing and
dumping of JSON5 data structures.")
(license license:asl2.0)))
+
+(define-public python-jupyterlab-server
+ (package
+ (name "python-jupyterlab-server")
+ (version "1.0.6")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (pypi-uri "jupyterlab_server" version))
+ (sha256
+ (base32
+ "1bax8iqwcc5p02h5ysdc48zvx7ll5jfzfsybhb3lfvyfpwkpb5yh"))))
+ (build-system python-build-system)
+ (propagated-inputs
+ `(("python-jinja2" ,python-jinja2)
+ ("python-json5" ,python-json5)
+ ("python-jsonschema" ,python-jsonschema)
+ ("python-notebook" ,python-notebook)))
+ (native-inputs
+ `(("python-pytest" ,python-pytest)
+ ("python-requests" ,python-requests)
+ ("python-ipykernel" ,python-ipykernel)))
+ (arguments
+ `(#:phases
+ (modify-phases %standard-phases
+ ;; python setup.py test does not invoke pytest?
+ (replace 'check
+ (lambda _
+ (invoke "pytest" "-vv"))))))
+ (home-page "https://jupyter.org")
+ (synopsis "JupyterLab Server")
+ (description "A set of server components for JupyterLab and JupyterLab like
+applications")
+ (license license:bsd-3)))
--
2.20.1
L
L
Ludovic Courtès wrote on 26 Mar 2020 23:55
(name . Lars-Dominik Braun)(address . ldb@leibniz-psychology.org)(address . 39765@debbugs.gnu.org)
87d08y915t.fsf@gnu.org
Hi Lars,

Sorry for the late reply.

Lars-Dominik Braun <ldb@leibniz-psychology.org> skribis:

Toggle quote (11 lines)
> this patch series adds Jupyter’s JupyterLab, which is the new frontend for
> Jupyter Notebooks. The software works fine, but there are a few caveats
>
> 1) it comes with bundled pre-compiled JavaScript, which cannot be removed until
> we have proper support for importing from NPM
> 2) it contains an extension manager, that downloads arbitrary packages from NPM
> (`jupyter lab build`). This works, but is less than optimal imo. We should
> figure out how to package extensions in guix.
> 3) also it is required to install the package `jupyter`, otherwise installed
> kernels cannot be found and the `jupyter` command does not work.

#2 should be quite easy to address: we could arrange to have that
feature disabled by default, so that users don’t find themselves
unknowingly downloading arbitrary code from npm.

#3 is OK.

#1 is a showstopper. :-/ I suppose that’s a lot of code that would
need to be imported from npm, right?

It’s sad because all this is free software, but we practically can’t get
the corresponding source.

I’ve pushed the first two patches of the series (python-json5 and
python-pytest-check-links).

Comments on the other bits that are readily applicable:

Toggle quote (21 lines)
>>From a47fd94aa6f3e62b77f3b7208c4e6757e3a9ee08 Mon Sep 17 00:00:00 2001
> From: Lars-Dominik Braun <ldb@leibniz-psychology.org>
> Date: Thu, 12 Dec 2019 08:53:39 +0100
> Subject: [PATCH 5/5] gnu: python-notebook: Support UNIX domain sockets
>
> * gnu/packages/python-xyz.scm (python-notebook): Add patch from upstream
> https://github.com/jupyter/notebook/pull/4835
> (python-requests-unixsocket) New variable
> ---
> ...pyter-unix-domain-sockets-4835-5.7.4.patch | 591 ++++++++++++++++++
> gnu/packages/python-xyz.scm | 35 +-
> 2 files changed, 624 insertions(+), 2 deletions(-)
> create mode 100644 gnu/packages/patches/jupyter-unix-domain-sockets-4835-5.7.4.patch
>
> diff --git a/gnu/packages/patches/jupyter-unix-domain-sockets-4835-5.7.4.patch b/gnu/packages/patches/jupyter-unix-domain-sockets-4835-5.7.4.patch
> new file mode 100644
> index 0000000000..134d3ad2b8
> --- /dev/null
> +++ b/gnu/packages/patches/jupyter-unix-domain-sockets-4835-5.7.4.patch
> @@ -0,0 +1,591 @@

Please add provenance info at the top of the patch (such as the URL of
the upstream commit), as well as a line or two explaining what it does.

You can omit “-4835-5.7.4” from the file name.

Make sure to add the file to ‘gnu/local.mk’.

That said, it’s a big patch, so it would be even better if we didn’t
have to carry it. Will the next version of ‘notebook’ include it?

Last, ‘python-requests-unixsocket’ should be added in a separate patch.

[...]

Toggle quote (4 lines)
> + (arguments
> + ;; tests depend on very specific package version, which are not available in guix
> + '(#:tests? #f))

Perhaps add a “FIXME” and clarify which packages we’re talking about
(the “not available” bit is bound to become outdated :-)).

Toggle quote (7 lines)
> + (home-page
> + "https://github.com/msabramo/requests-unixsocket")
> + (synopsis
> + "Use requests to talk HTTP via a UNIX domain socket")
> + (description
> + "Use requests to talk HTTP via a UNIX domain socket")

Please follow the synopsis/description guidelines (info "(guix) Synopses
and Descriptions").

Thank you for this endeavor!

Ludo’.
L
L
Lars-Dominik Braun wrote on 27 Mar 2020 08:30
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 39765@debbugs.gnu.org)
20200327073027.GA4578@zpidnp36
Hi Ludo,

Toggle quote (3 lines)
> #2 should be quite easy to address: we could arrange to have that
> feature disabled by default, so that users don’t find themselves
> unknowingly downloading arbitrary code from npm.
it’s “disabled” by default, because it is considered experimental in this
version of JupyterLab. But a user can re-enable it. And the last part is
entirely client-side, so we cannot disable it completely until we fix #1.

Toggle quote (2 lines)
> #1 is a showstopper. :-/ I suppose that’s a lot of code that would
> need to be imported from npm, right?
`jupyter build` downloads about 600 NPM packages, as far as I remember.

Toggle quote (2 lines)
> I’ve pushed the first two patches of the series (python-json5 and
> python-pytest-check-links).
Thank you!

Toggle quote (2 lines)
> That said, it’s a big patch, so it would be even better if we didn’t
> have to carry it. Will the next version of ‘notebook’ include it?
Does not look like it. The pull request[1] has been open for a few months now.
It’s vital to our use-case and (probably) everyone hosting notebooks, but not
very useful to the casual home user. So, executive decision: Do you want it in
guix proper? I’ll just maintain it in my channel[2] otherwise.

Lars

-----BEGIN PGP SIGNATURE-----

iQGzBAABCgAdFiEEyk+M9DfXR4/aBV/UQhN3ARo3hEYFAl59q40ACgkQQhN3ARo3
hEYVigwAiGGFF8X4gArot3ak+ve/UX4rKrLHkMWiFsBBZwIr8EXEHbpqhyTr1zIv
1Nq2nCG2lxbY0V1TEwHsvyn1xPB5GOZFuQVai3OZX2ic+/FS1NtmR1nyjX368ZRW
Qnrq3p6rdSZ/1HDlr+XXULMtl4GaC1NVR4Jlu3TOHhRNUlVoeCSTqFwXarIrJJwn
DQrkIs+N5xXYi7hSXBdYJiP0SGsFfdFG81QfrHYL+a2dm3J5ndVdaaI3t3lX3Sgq
s6H3ehOFc6RmHB0JGeyc0riKWcXtMT1T5es9SC7QFXXXfzXEWX/wwnE9GHAEdAWZ
Olc7+sGFQsjzvAkr8dP8Ef0KKrdxrUFs/DY0Yn9CjgmYjWf8NxtO/C62DKHpKYOR
Wv+evmPs6f5hoW+yItQpXPRktMMHjTr8QP9OoQ4Q2+11XnptoMasndUCylXgq0fi
EQ5k7QuNV3B9X1UjQ+bHHzehF79c2IhkbcfgCU9oJs8rVfCeSqecQbRCBNRCpNtS
bxMT+ibh
=x8+8
-----END PGP SIGNATURE-----


L
L
Ludovic Courtès wrote on 29 Mar 2020 16:37
(name . Lars-Dominik Braun)(address . ldb@leibniz-psychology.org)(address . 39765@debbugs.gnu.org)
87ftdr1b3c.fsf@gnu.org
Hi,

Lars-Dominik Braun <ldb@leibniz-psychology.org> skribis:

Toggle quote (11 lines)
>> #2 should be quite easy to address: we could arrange to have that
>> feature disabled by default, so that users don’t find themselves
>> unknowingly downloading arbitrary code from npm.
> it’s “disabled” by default, because it is considered experimental in this
> version of JupyterLab. But a user can re-enable it. And the last part is
> entirely client-side, so we cannot disable it completely until we fix #1.
>
>> #1 is a showstopper. :-/ I suppose that’s a lot of code that would
>> need to be imported from npm, right?
> `jupyter build` downloads about 600 NPM packages, as far as I remember.

OK.

Toggle quote (7 lines)
>> That said, it’s a big patch, so it would be even better if we didn’t
>> have to carry it. Will the next version of ‘notebook’ include it?
> Does not look like it. The pull request[1] has been open for a few months now.
> It’s vital to our use-case and (probably) everyone hosting notebooks, but not
> very useful to the casual home user. So, executive decision: Do you want it in
> guix proper? I’ll just maintain it in my channel[2] otherwise.

(It’s not about what I personally want or don’t want, of course. :-))
In general, the guideline is to have patches that are either included
upstream, just not in a published release, or are Guix-specific and thus
are not meant to be included upstream.

This patch doesn’t seem to fall in any of these two categories, so I
would prefer not to have it, at least not until upstream has included
it.

WDYT?

Thanks,
Ludo’.
L
L
Lars-Dominik Braun wrote on 30 Mar 2020 08:10
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 39765@debbugs.gnu.org)
20200330061054.GA3329@zpidnp36
Hi Ludo,

Toggle quote (8 lines)
> (It’s not about what I personally want or don’t want, of course. :-))
> In general, the guideline is to have patches that are either included
> upstream, just not in a published release, or are Guix-specific and thus
> are not meant to be included upstream.
>
> This patch doesn’t seem to fall in any of these two categories, so I
> would prefer not to have it, at least not until upstream has included
> it.
sure, I can see that :)

Lars
L
L
Lars-Dominik Braun wrote on 14 Jan 2021 10:10
Close
(address . control@debbugs.gnu.org)
YAAKl61y0OqmsI+7@noor.fritz.box
close 39765
thanks
?