Skip to content

Commit

Permalink
Trac #32069: Upgrade jupyterlab to 3.3.x, add "sage -n nbclassic" and…
Browse files Browse the repository at this point in the history
… "sage -n retrolab"

#30246 added jupyterlab 2.2.x as an optional package as part of Meta-
ticket #30399.

The 3.0 series has been out since December 2020.
https://pypi.org/project/jupyterlab/#history

Current as of Mar 2022 is 3.3.0. It still supports Python 3.7, as needed
for Sage 9.6.

It is now also possible to run the classic notebook on top of jupyterlab
- https://pypi.org/project/nbclassic/
(See also https://github.com/jupyterlab/retrolab#relation-to-other-
jupyter-frontends)

URL: https://trac.sagemath.org/32069
Reported by: mkoeppe
Ticket author(s): Matthias Koeppe
Reviewer(s): Eric Gourgoulhon
  • Loading branch information
Release Manager committed Mar 8, 2022
2 parents 314d846 + 1243bd8 commit 78990d5
Show file tree
Hide file tree
Showing 20 changed files with 84 additions and 41 deletions.
5 changes: 0 additions & 5 deletions build/pkgs/ipympl/checksums.ini

This file was deleted.

1 change: 0 additions & 1 deletion build/pkgs/ipympl/package-version.txt

This file was deleted.

1 change: 1 addition & 0 deletions build/pkgs/ipympl/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ipympl
2 changes: 0 additions & 2 deletions build/pkgs/ipympl/spkg-install.in

This file was deleted.

5 changes: 0 additions & 5 deletions build/pkgs/jupyter_packaging/checksums.ini

This file was deleted.

2 changes: 1 addition & 1 deletion build/pkgs/jupyter_packaging/dependencies
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$(PYTHON) packaging | $(PYTHON_TOOLCHAIN)
$(PYTHON) | $(PYTHON_TOOLCHAIN)

----------
All lines of this file are ignored except the first.
1 change: 0 additions & 1 deletion build/pkgs/jupyter_packaging/package-version.txt

This file was deleted.

1 change: 1 addition & 0 deletions build/pkgs/jupyter_packaging/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
jupyter-packaging
2 changes: 0 additions & 2 deletions build/pkgs/jupyter_packaging/spkg-install.in

This file was deleted.

2 changes: 1 addition & 1 deletion build/pkgs/jupyterlab/dependencies
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$(PYTHON) vcversioner jupyter_core jupyter_client | $(PYTHON_TOOLCHAIN)
$(PYTHON) vcversioner jupyter_core jupyter_client jinja2 tornado ipython packaging terminado traitlets nbconvert send2trash nbformat prometheus_client ipython_genutils argon2_cffi pyzmq idna requests jsonschema babel notebook | $(PYTHON_TOOLCHAIN)

----------
All lines of this file are ignored except the first.
Expand Down
2 changes: 1 addition & 1 deletion build/pkgs/jupyterlab/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
jupyterlab ~= 2.2.5
jupyterlab ~= 3.3
3 changes: 1 addition & 2 deletions build/pkgs/jupyterlab_widgets/dependencies
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
jupyterlab nodejs tornado
ipympl jupyterlab nodejs tornado $(PYTHON) | $(PYTHON_TOOLCHAIN) jupyter_packaging

----------
All lines of this file are ignored except the first.
It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile.
1 change: 0 additions & 1 deletion build/pkgs/jupyterlab_widgets/package-version.txt

This file was deleted.

1 change: 1 addition & 0 deletions build/pkgs/jupyterlab_widgets/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
jupyterlab-widgets
19 changes: 0 additions & 19 deletions build/pkgs/jupyterlab_widgets/spkg-install

This file was deleted.

16 changes: 16 additions & 0 deletions build/pkgs/retrolab/SPKG.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
retrolab: JupyterLab Distribution with a retro look and feel
============================================================

Description
-----------

JupyterLab Distribution with a retro look and feel

License
-------

Upstream Contact
----------------

https://pypi.org/project/retrolab/

4 changes: 4 additions & 0 deletions build/pkgs/retrolab/dependencies
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
$(PYTHON) jupyterlab | $(PYTHON_TOOLCHAIN)

----------
All lines of this file are ignored except the first.
1 change: 1 addition & 0 deletions build/pkgs/retrolab/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
retrolab ~= 0.3
1 change: 1 addition & 0 deletions build/pkgs/retrolab/type
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
optional
55 changes: 55 additions & 0 deletions src/bin/sage-notebook
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,58 @@ class NotebookJupyterlab(object):
main(argv)


class NotebookNbclassic(object):
def print_banner(self):
banner()
print('Please wait while the Jupyterlab server starts...')

@classmethod
def print_help(cls):
cls(['help'])

def __init__(self, argv):
try:
from nbclassic.notebookapp import main
except ImportError:
import traceback
traceback.print_exc()
print("Jupyterlab is not installed (at least not in this Sage installation).")
print("You can install it by running")
print(" sage -i jupyterlab_widgets")
print("which includes support for interacts and the ability to download and")
print("install other Jupyterlab extensions. For a minimal installation, run")
print(" sage -i jupyterlab")
raise SystemExit(1)
self.print_banner()
main(argv)


class NotebookRetrolab(object):
def print_banner(self):
banner()
print('Please wait while the Jupyterlab server starts...')

@classmethod
def print_help(cls):
cls(['help'])

def __init__(self, argv):
try:
from retrolab.app import main
except ImportError:
import traceback
traceback.print_exc()
print("Retrolab is not installed (at least not in this Sage installation).")
print("You can install it by running")
print(" sage -i jupyterlab_widgets retrolab")
print("which includes support for interacts and the ability to download and")
print("install other Jupyterlab extensions. For a minimal installation, run")
print(" sage -i retrolab")
raise SystemExit(1)
self.print_banner()
main(argv)


class SageNBExport(NotebookJupyter):

def print_banner(self):
Expand Down Expand Up @@ -135,9 +187,12 @@ notebook_launcher = {
'ipython': NotebookJupyter,
'jupyter': NotebookJupyter,
'jupyterlab': NotebookJupyterlab,
'nbclassic': NotebookNbclassic,
'retrolab': NotebookRetrolab,
'export': SageNBExport,
}


notebook_names = ', '.join(notebook_launcher.keys())


Expand Down

0 comments on commit 78990d5

Please sign in to comment.