Open stevelinton opened 5 years ago
I have a prototype implementation of this which seems to work at least sometimes:
templateNotebook := "/Users/sal/gap_jupyter_template.ipynb";
Notebook := function(arg...)
local name, dir;
if Length(arg) >= 1 then
name := arg[1];
else
name := "GAP";
fi;
Append(name,".ipynb");
dir := DirectoryTemporary();
name := Filename(dir,name);
Exec(Concatenation( "cp ",templateNotebook, " ", name));
Exec(Concatenation("cd ",Filename(dir,"."),"; jupyter notebook ",name));
end;
calling jupyter notebook foo.ipynb
will start a new GAP session inside Jupyter. If that is intended, fine.
Connecting the current gap session to a jupyter notebook will require more doing (you have to start the jupyter part of the notebook, get the ports and encryption keys, and then fire up the jupyter kernel, which will then fork gap, etc...)
@markuspf I realise it starts a new session. This is the same as SageMath, I think. It's still quite useful. Ideally I'd save a workspace from the current session and get the session inside JuPyter to load that. One could even provide a way to close down the notebook save a workspace and load that into the terminal-based session, so you could basically return with the global-variable state from the notebook intact.
As SAGEMath does, it would be nice to be able to start a notebook from within a terminal GAP session. Something like
or
or something of the kind. As far as I can see this should be easy.
Notebook
essentially just needs to copy a template.ipynb
file into a scratch directory and calljupyter notebook foo.ipynb
Maybe it should also be possible to invoke a GAP notebook directly from the shell
and