SageWui is a major refactor/rewrite of the Sage Notebook (Sagenb).
We intend a smooth transition from Sagenb to SageWui to get something completely different.
- SageWui is independent from Sage, so that it can be launched from
an independent python interpreter. A SageMath installation and the
sage
command in the default path is required, though. - SageWui runs on python 2 and 3.
smtpsend
is now a global module.- Sagewui startup procedure differs from Sagenb one.
- No need for intermediate startup code files.
- Standalone command interface.
- Debug mode added.
- Sage server interface totally isolated.
- Implemented in the package
sagewui_kernels.sage
. It can be reused in other projects. - No need for intermediate code files. Code is passed directly to the Sage server.
- Sage initialization left to the
sagewui_kernels.sage
interface. - Input is parsed with
ast
. Bugs in Sagenb related to incorrect parsing fixed
- Implemented in the package
- New flask json session mechanism adopted.
- A lot of reformatting, bug fixing and simplification of code done, with respect to Sagenb.
Only for testing purposes.
The instructions below are valid for a modern Linux host. A working
python
>= 3.4 and <3.6 installation with venv
module
(sudo apt-get install python3-venv
on Ubuntu based dists) is supposed to be
available.
Previously to the instructions below, install a recent version of
SageMath. Make sage
command available in your PATH.
-
In the command line, set a variable with your installation dir
export INSTALLDIR="/some/dir/you/can/write/to"
-
Create a python3 virtual environment
python3 -m venv "$INSTALLDIR/python"
-
Clone SageWui
git clone https://github.com/damahou/sagewui $INSTALLDIR/sagewui cd "$INSTALLDIR/sagewui" git branch release origin/release git checkout release
-
Activate the python virtual environment
. "$INSTALLDIR/python/bin/activate"
-
Populate de virtual environment
pip install twisted flask flask-autoindex flask-babel flask-themes2 future pexpect docutils jsmin pyopenssl service_identity appdirs
-
SageWui related stuff
cp -a "$INSTALLDIR/sagewui/sagewui" "$INSTALLDIR/sagewui/sagewui_kernels" "$INSTALLDIR/sagewui/smtpsend.py" "$INSTALLDIR"/python/lib/python*/site-packages ln -s "$INSTALLDIR"/python/lib/python*/site-packages/sagewui/run.py "$INSTALLDIR/python/bin/sagewui"
-
Test the installation
sagewui
To run sagewui from a fresh command line shell write
cd /path/where/you/installed/sagewui
. python/bin/activate
sagewui
-
In the command line, set a variable with your installation dir
export INSTALLDIR="/some/dir/you/can/write/to"
-
Create a python3 virtual environment
python3 -m venv "$INSTALLDIR/python"
-
Clone SageWui
git clone https://github.com/damahou/sagewui "$INSTALLDIR/sagewui"
-
Activate the python virtual environment
. "$INSTALLDIR/python/bin/activate"
-
Populate de virtual environment
pip install twisted flask flask-autoindex flask-babel flask-themes2 future pexpect docutils jsmin pyopenssl service_identity appdirs
-
SageWui related stuff
ln -s "$INSTALLDIR/sagewui/sagewui" "$INSTALLDIR/sagewui/sagewui_kernels" "$INSTALLDIR/sagewui/smtpsend.py" "$INSTALLDIR"/python/lib/python*/site-packages ln -s "$INSTALLDIR"/python/lib/python*/site-packages/sagewui/run.py "$INSTALLDIR/python/bin/sagewui"
-
Test the installation
sagewui
-
Run sagewui from a fresh command line shell in debug mode
cd /path/where/you/installed/sagewui . python/bin/activate sagewui --debug
-
Edit code in $INSTALLDIR/sagewui. every time you change python code, the application is reloaded.
This instructions are based on https://wiki.sagemath.org/SageServer.
A ssh
server must be running.
-
Change the following shell variables as needed
export sageservername="sageserver" export sageusername="sage" export sageusergroupname="sageusers" export INSTALLDIR="/directory/where/sagewui/will/be/installed" export pythondir="$INSTALLDIR/python" export sagewuidir="$INSTALLDIR/sagewui" export sageserverdir="$INSTALLDIR/$sageservername" export sageuserdir="$INSTALLDIR/$sageusergroupname"
-
Create a python3 virtual environment
python3 -m venv "$pythondir"
-
Clone SageWui
git clone https://github.com/damahou/sagewui "$sagewuidir" cd "$sagewuidir" git branch release origin/release git checkout release
-
Activate the python virtual environment
. $pythondir/bin/activate"
-
Populate de virtual environment
pip install twisted flask flask-autoindex flask-babel flask-themes2 future pexpect docutils jsmin pyopenssl service_identity appdirs
-
SageWui related stuff
cp -a "$sagewuidir/sagewui" "$sagewuidir/sagewui_kernels" "$sagewuidir/smtpsend.py" "$pythondir"/lib/python*/site-packages ln -s "$pythondir"/lib/python*/site-packages/sagewui/run.py "$pythondir/bin/sagewui"
-
Test the installation and set the SageWui admin password
sagewui --secure
-
Create users
sudo mkdir -p "$sageserverdir" "$sageuserdir" sudo addgroup --gid 1010 "$sageservername" sudo addgroup --gid 1011 "$sageusergroupname" sudo adduser --disabled-password "$sageservername"\ --ingroup "$sageservername"\ --home "$sageserverdir/$sageservername"\ --geco ",,," for i in $(seq 0 9); do sudo adduser --disabled-password\ --ingroup "$sageusergroupname"\ --home "$sageuserdir/$sageusername$i"\ --geco ",,," sage$i; done
-
Secure users login
sudo echo "- : (sageusers) : ALL EXCEPT localhost" >> /etc/security/access.conf sudo echo "- : sageserver : ALL" >> /etc/security/access.conf
-
ssh
configurationsudo -u "$sageservername" -i ssh-keygen -b 4096 dir="$sageuserdir/$sageusername" for i in $(seq 0 9); do sudo mkdir -p "$dir$i"/.ssh sudo cat "$sageserverdir/$sageservername/.ssh/id_rsa.pub" \ > "$dir$i/.ssh/authorized_keys" sudo chown -R "$sageusername$i:$sageusergroupname" "$dir$i" sudo chmod -R 700 "$dir$i" done sudo find "$sageuserdir" -type f -exec chmod u-x {} \; sudo chmod 700 "$sageserverdir/$sageservername" sudo chmod 750 "$sageserverdir" "$sageuserdir" sudo chgrp "$sageservername" "$sageserverdir" sudo chgrp "$sageusergroupname" "$sageuserdir" sudo echo "umask 077" >> "$sageserverdir/$sageservername/.profile" sudo dir="$sageuserdir/$sageusername" for i in $(seq 0 9); do sudo echo "umask 077" >> "$dir$i/.profile" done
-
Set localhost identity for sageserver user ssh config. Answer yes to all
sudo -u "$sageservername" ssh "${sageusername}0@localhost" echo Done
-
Test all the ssh connections
for i in $(seq 0 9); do sudo -u "$sageservername" ssh "$sageusername$i@localhost" echo Success done
-
Prepare the sagewui service
cp "$sagewuidir/util/sagewui-server" /etc/init.d
-
Edit the shell variables in
/etc/init.d/sagewui-server
to set the host and port wanted. -
Configure the sagewui service
update-rc.d sagewui-server defaults 92 08 update-rc.d sagewui-server enable
-
Test the service
service sagewui-server start
Open your browser and navigate accordingly with the host and port selected. Note that SageWui runs in secure mode, so
https://
must be used.
- Break SageWui in more packages (WebApp, model, controller, ...) useful to develop other independent software.
- Objects must be processed by the client for displaying. No more html representation of objects must be generated by the server. Establish a clear web server API, so that different web clients could be implemented.
interact
code refactor.- Improve maintainability.
- Improve security, both in the WebApp and in the sagewui_kernels.sage interactions.
- Improve scalability.
- ...
-
The dependencies for
sagewui
are:twisted
,flask
,flask-autoindex
,flask-babel
,flask-themes2
,future
,smtpsend
,pexpect
,docutils
,jsmin
,pyopenssl
,service_identity
,appdirs
. All of them, butsmtpsend
which is in the source tree, are installable from pipy in an virtual python environment. -
Backward compatibility is not a goal, but at this moment this version can be used as a replacement of the current Sage Notebook.
-
Some Notebook features could be removed.
-
Removed features:
-
send_mail
disabled under py3. Twisted.mail port needed. -
Openid authentication.
-