sagemath / sagenb Goto Github PK
View Code? Open in Web Editor NEWSage Notebook (flask), docs in $SAGE_LOCAL/share/doc/sagenb/index.html
License: Other
Sage Notebook (flask), docs in $SAGE_LOCAL/share/doc/sagenb/index.html
License: Other
When viewing a worksheet, the links of div#share-publish-buttons must have class="control-select" if active or class="control" if not.
This fails for Worksheet and Revisions options.
This is minor bug I've encounter when customizing my sage server look with a SAGE_DOT/notebook.css file. This issue can be fixed with the little patch:
From 6ede9d0dd8778f460a26f0d187b9e76510e76734 Mon Sep 17 00:00:00 2001
From: "J. Miguel Farto" <[email protected]>
Date: Sun, 17 Feb 2013 15:55:38 +0100
Subject: [PATCH] Fix a.control-select bug in div#share-publish-buttons for
Worksheet and Revisions
---
sagenb/data/sage/html/notebook/base.html | 2 +-
sagenb/data/sage/html/notebook/worksheet_page.html | 2 ++
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/sagenb/data/sage/html/notebook/base.html b/sagenb/data/sage/html/notebook/base.html
index e8a9169..3bdfaa4 100644
--- a/sagenb/data/sage/html/notebook/base.html
+++ b/sagenb/data/sage/html/notebook/base.html
@@ -175,7 +175,7 @@ INPUT:
<a class="{{ cls('use') }}" title="{{ gettext('Interactively use this worksheet') }}" href="./">{{ gettext('Worksheet') }}</a>
<a class="{{ cls('edit') }}" title="{{ gettext('Edit text version of this worksheet') }}" href="edit">{{ gettext('Edit') }}</a>
<a class="{{ cls('text') }}" title="{{ gettext('View plain text version of this worksheet') }}" href="text">{{ gettext('Text') }}</a>
- <a class="{{ cls('undo') }}" title="{{ gettext('View changes to this worksheet over time') }}" href="revisions">{{ gettext('Revisions') }}</a>
+ <a class="{{ cls('revisions') }}" title="{{ gettext('View changes to this worksheet over time') }}" href="revisions">{{ gettext('Revisions') }}</a>
<a class="{{ cls('share') }}" title="{{ gettext('Let others edit this worksheet') }}" href="share">{{ gettext('Share') }}</a>
<a class="{{ cls('publish') }}" title="{{ gettext('Make this worksheet publicly viewable') }}" href="publish">{{ gettext('Publish') }}</a>
{% endif %}
diff --git a/sagenb/data/sage/html/notebook/worksheet_page.html b/sagenb/data/sage/html/notebook/worksheet_page.html
index cef89a6..cfe2a33 100644
--- a/sagenb/data/sage/html/notebook/worksheet_page.html
+++ b/sagenb/data/sage/html/notebook/worksheet_page.html
@@ -9,6 +9,8 @@ INPUT:
{% block page_id %}user-worksheet-page{% endblock %}
{% block body_classes %}active-worksheet{% endblock %}
+{% set select = "use" %}
+
{% block worksheet_main %}
{% set toggle=true %}
<div class="worksheet" id="worksheet">
--
1.7.10.4
This came up in the OpenSSL discussion, and still applies to the flask notebook. Basically, right now, the notebook will only run at the document root, i.e.,
It would be nice if this wasn't required, so that we could run it out of e.g.,
for two reasons:
Nice web applications shouldn't assume that they have control of the whole virtual host.
It would make an SSL reverse proxy easier in one particular case, since we could simply map,
http://math.example.edu/sagenb/ -> http://localhost:8080/sagenb/
Most other applications just define a variable in the config file called e.g. document_root that defaults to '/'. Then it's only a matter if fixing the URL-generation code to append to the document_root.
See http://trac.sagemath.org/sage_trac/ticket/13070 and http://stackoverflow.com/questions/10775775/the-bug-in-sage-math-notebook-when-using-r and http://ask.sagemath.org/question/1400/may-there-is-a-bug-in-notebook
Basically, even when the system is switched from Sage to R in the notebook, tab-completion still uses Sage-underscore syntax instead of R syntax. It seems likely that this would happen with other systems as well, but this is where it was observed.
steps to reproduce:
rm -r $DOT_SAGE/sagenb_notebook.sagenb
produces the following error:
Traceback (most recent call last): File "/opt/sage/local/bin/sage-notebook", line 36, in <module> notebook(port=8000) File "/home/rob/dev/sagenb/sagenb/notebook/notebook_object.py", line 206, in __call__ return self.notebook(*args, **kwds) File "/home/rob/dev/sagenb/sagenb/notebook/run_notebook.py", line 311, in notebook_twisted admin = nb.user_manager().user('admin') File "/home/rob/dev/sagenb/sagenb/notebook/user_manager.py", line 110, in user return self._user(username) File "/home/rob/dev/sagenb/sagenb/notebook/user_manager.py", line 556, in _user raise KeyError, "no user '%s'"%username KeyError: "no user 'admin'"
how to fix:
pretty simple, just change one line in sagenb/notebook/run_notebook.py
as seen here: rmartinjak@bda2d9e
The first Help page of the notebook states: ``Load is relative to
the path you started the notebook in.''
However this is not the case. Even though load_attach_path
contains ".", it seems "." is relative to the temporary directory
for the execution of the cell.
As a workaround, one can do::
sage: load_attach_path(DIR)
and then things work as claimed.
If you do foo? or foo?? followed by SHIFT-ENTER and the docstring contains a Traceback, then the output gets corrupted. Doing the same followed by TAB, which gives a pop-out-able result, works perfectly.
def foo():
r"""
sage: 2+2
Traceback (most recent call last):
...
NotImplementedError
"""
When you view the list of all worksheets, currently they are all displayed on a single page. This can be daunting. Implement pagination, so the worksheets are listed 25 (or so) per page.
Note that configuring the number of worksheets per page is something one wants, but should be part of another ticket, since it requires slightly painful changes in multiple places, which causes one to want to refactor code.
This bug is reported in the Google docs bug reports.
"if you rename your worksheet to <script>alert(1)</script>
you can effectively inject javascript, especially when you publish your worksheet.
The script gets executed when you open the worksheet."
This is quite serious IMO.
Sage Trac #12299. Include the Jmol enhancements.
I hope this is self-explanatory. This can cause real confusion when distributing published worksheets, because most people will probably not read carefully enough even if one gives explicit instructions - our expectation with web apps is that they will remember this information.
If you are logged in and open a URL like
http://localhost:8080/?next=http%3A%2F%2Flocalhost%3A8080%2Fupload_worksheet%3Furl%3Dfile%3A%2F%2F%2FUsers%2Fgvol%2FSageStuff%2FGAP%2520test.sws
then it will simply redirect to the "home page" i.e. http://localhost:8080/home/admin/
instead of the ?next=
page, in this case uploading a sws file.
This causes problems when starting a server and uploading a file at the same time since there is a race condition in which login can happen too late for the page itself to work, and too early for the ?next=
page to work. See comments on issue #31.
It appears that the new setup.py file does not have the jmol script listed in the 'scripts' line. Does this mean that the jmol script is not copied to $SAGE_ROOT/local/bin? If so, it might happen that when only the new flask notebook is installed (e.g., the original standard sagenb spkg is actually the flask notebook), the command line jmol stops working.
To test, I guess we should make a source distribution of Sage, then replace the sagenb spkg with the sagenb 0.9.0 spkg.
See http://permalink.gmane.org/gmane.comp.mathematics.sage.devel/64045
https://sage-devel.googlegroups.com/attach/8dc9df288af90fd6/sage_nb.png?view=1&part=4
Steps to reproduce (eg in Sage 5.5 or 5.6.beta*): open a fresh worksheet, a new cell, and evaluate
fibonacci?
there.
You'll see extra red '(' ')' surrounding otherwise good-looking
mathjax-processed formulae.
Should not be hard to fix, IMHO.
Seen on Linux and on MacOSX 10.6.8 with Google Chrome and Safari,
so this looks platform-independent to me.
See http://trac.sagemath.org/sage_trac/ticket/10637, which has some good work on this. This should be added. There isn't a pull request available yet, though.
I noticed recently that it is now possible to import ReST files as
worksheets. This is a great improvement! For our needs (distributing
the tutorials sheets that we write in ReST), there just remains one
step and our workflow will be perfect: having the import support
most/all of the Sage-documentation specific ReST features:
x\in X
is currentlyxinX
.Thanks!
Nicolas
Hi.
Recently I've found this error trying to load a worksheet from a different machine in my home network. I loaded the same worksheet on the local sagenb machine and everything works perfect but on another
machine I get the page shown below.
I opened tha javascript console and I found two mistakes:
Am I the only one with these two errors? If not, How can I fix it? I must say that I started the sage notebook vía the sage cli using notebook(interface='', server_pool=['user@localhost'], accounts=True, ulimit='v 100000', secure=True)
and when I put ssh user@localhost
on the terminal everything works good. All the required ports are open.
Thanks in advance.
See http://trac.sagemath.org/sage_trac/ticket/11080#comment:49, where jdemeyer lists tickets that we should check to make sure they are merged in the new sagenb. In particular, please double-check that following tickets really have been merged in the new sagenb:
#10052 fixed at 88a1cea
#10860 gh-8
#11106 fixed at 01d4caf
#11121 gh-7
#11732 gh-17
#11343 underlying issue fixed at gh-11
#10620 gh-9
#10642 gh-10
In pull requests for these, reference this issue (i.e., this is a meta-issue). When the last ticket above is merged, close this issue.
The interface
argument to notebook()
should accept the actual names of network interfaces instead of only IP addresses.
Please see https://groups.google.com/d/msg/sage-support/8P3xO8I7hyQ/W7cHXXKUCNUJ
Basically, the following code in sagenb:
import csv
o=open('test.csv','wb')
output=csv.writer(o)
data=[[1,2],[3,4],[5,6]]
for r in data: output.writerow(r)
o.close()
creates a link to empty test.csv (and yes, the csv file in .sage/.../home/... does get created but has length 0)
If one does instead o=open('/tmp/test.csv','wb') then /tmp/test.csv gets created just fine.
Look at this thread. I think we can also remove the directory sagenb/data/mathjax/fonts/HTML-CSS/TeX/svg
and save over 1M of unnecessary fonts.
I think it should be done on master, using some procedure @jasongrout wrote in the pull request of the new notebook, so that the history is leaner.
i recently upgraded my install to sage 5.0 and this version of sage notebook. now some cells spit out internal interpreter calls, for example:
import os;os.chdir("/tmp/tmpbsTzdL");
execfile("_sage_input_1.py")
import os;os.chdir("/tmp/tmpXIgZdJ");
execfile("_sage_input_2.py")
Python 2.7.2 (default, May 14 2012, 14:19:29)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
import os;os.chdir("/tmp/tmpbsTzdL");
execfile("_sage_input_1.py")
START1
and then more of that.
any idea how to fix this, or should i go back to the non-flask version that came with sage?
There are several people that would like a sagenb spkg without the dependencies included. It would be easy for make spkg
to copy the sagenb directory before dependencies are added, and slightly change the spkg-install file, so that just sagenb was distributed in a second sagenb_no_dependencies spkg.
Sage is moving away from ZODB3, which is the only thing requiring zope.interface in Sage. So when we eventually retire ZODB3, zope.interface will also be removed. But apparently twisted in the sagenb spkg depends on zope.interface, so you have to package the dependency yourself in the long run.
See also: http://trac.sagemath.org/10352
With the following example in a ReST documentation file:
sage: class blah:
...
... def f(x): return 1
only the first line appears in the input cell in the live notebook
documentation; the rest appears below as if it was an output. On the
other hand, this looks correctly in the static documentation.
Reported by Andre during Bobo 2012.
Cheers,
Nicolas
import numpy
x = numpy.linspace(0, 10, 2**10)
y = numpy.sin(x)
results in
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "_sage_input_3.py", line 10, in <module>
exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("aW1wb3J0IG51bXB5CnggPSBudW1weS5saW5zcGFjZSgwLCAxMCwgMioqMTApCnkgPSBudW1weS5zaW4oeCk="),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))
File "", line 1, in <module>
File "/tmp/tmpsQxYfT/___code___.py", line 5, in <module>
exec compile(u'y = numpy.sin(x)
File "", line 1, in <module>
AttributeError: sin
From sage-support on 11/23/12
When I start a notebook without giving a directory parameter everything works fine. But when I try to add a directory parameter sage refuses to start a webinterface server:
sage: notebook(directory="/home/sage/s",interface='')
..
Executing twistd --pidfile="s/sagenb.pid" -ny "s.sagenb/twistedconf.tac"
/\/\/\/\/\/\
2012-11-23 21:31:23+0100 [-] File "/opt/sage/sage-5.4.1-linux-32bit-ubuntu_12.04.1_lts-i686-Linux/local/lib/python2.7/site-packages/Twisted-12.1.0-py2.7-linux-i686.egg/twisted/scripts/_twistd_unix.py", line 293, in setupEnvironment
2012-11-23 21:31:23+0100 [-] f = open(pidfile,'wb')
2012-11-23 21:31:23+0100 [-] IOError: [Errno 2] No such file or directory: '/home/sage/s/sagenb.pid'
..
I guess the pidfile should be
/home/sage/s.sagenb/sagenb.pid,
/\/\/\/\/\/\/\/\/\/\
Liebe Grüße aus einen nebeligen Seewinkel, regards
Andre
The size of private key needs to be increased from 512 to 1024 or some such value, to please modern browsers (e.g. Chrome).
The expriration_days cannot be 10000, it is too much (8999 works).
See https://groups.google.com/d/topic/sage-support/eDP69_FBoQk/discussion
At least not from the worksheet itself. From the Google spreadsheet issue list:
Hi!
When I have a notebook open in Safari, and do File... Save to worksheet, the .sws file does not appear in the searchable file system.
When I open the same notebook in Chrome, and follow the same procedure, the .sws file appears as expected.
Yes, I'm running the most recent version of Safari. (Who knows how old my Chrome is.)
This will be a problem for my students, I expect---Sage doesn't do graphics in Chrome any more (Java version issue) so they'll have to use Safari or the like.
It seems that sagenb/misc/ipaddr.py is just the google ipaddr library: http://pypi.python.org/pypi/ipaddr/2.1.7
If we do indeed use this, we should just make it a dependency and delete the file.
During the Sage days in Bobo, we were distributing the tutorial sheets as static html files produced with sage -docbuild, to be imported as worksheets. See e.g.:
http://combinat.sagemath.org/doc/thematic_tutorials/tutorial-notebook-and-help-long.html
However the students encountered instabilities. Sorry, we were running
around so we did not get necessarily sufficient time to take good
notes of a good reproducible test case for each of them. Nevertheless
here are my notes:
The link in the notebook in trac links like
:trac:`1234`
should open the documentation in a new tab. Otherwise, there is a huge potential of someone losing all their work just because they forgot to shift-click or something.
See http://trac.sagemath.org/sage_trac/ticket/13310#comment:2
Currently when trying to run the notebook without Sage, one gets the following dependency error:
File "sagenb/sagenb/notebook/interact.py", line 158, in
from sage.misc.cachefunc import cached_method
ImportError: No module named sage.misc.cachefunc
How to reproduce: in a new worksheet, type:
{{{
n = 10
n.factor?
}}}
Then, the end of the inline documentation after ``Traceback ...'' gets folded.
I use fairly intensively the live documentation for doing Sage demonstrations and classes. An annoying thing is that the Sage session times out after only two minutes. I see the rational, but this timeout is too short: basically, whenever I take a bit of time explaining something about an example and come back to proceed through this example, I have to reevaluate everything. Also, there is no explicit feedback stating the session timed out; it took me a while to figure out why my variables were not defined anymore.
I suggest to:
diff --git a/sagenb/notebook/server_conf.py b/sagenb/notebook/server_conf.py
--- a/sagenb/notebook/server_conf.py
+++ b/sagenb/notebook/server_conf.py
@@ -13,7 +13,7 @@ from flaskext.babel import gettext, lazy
defaults = {'word_wrap_cols':72,
'max_history_length':250,
- 'idle_timeout':120, # 2 minutes
+ 'idle_timeout':600, # for a live documentation worksheet: quit the compute process if it has been idle for 10 minutes
'idle_check_interval':360,
'save_interval':360, # seconds
The problem came up in this ask.sagemath thread and IIRC also in the sage-notebook ML a couple of months back.
The problem is that people need to use the exact same URL that they used earlier to login to any notebook server. I think quite a few people got bit by this or may get bitten by this, especially given the way browser autocomplete works nowadays.
One solution suggested by blutack in the ask.sagemath thread is to put a warning like: "If you are a returning user, please use the exact same URL for this notebook server as you used to log in previously. For example, do not use www.sagenb.org if you used sagenb.org earlier."
This is basically the upstream report for http://trac.sagemath.org/sage_trac/ticket/12060
Maybe this has already been done in the Sage cell interact? Although it doesn't appear so - https://github.com/sagemath/sagecell/blob/master/interact_sagecell.py
Recently the notebook has stopped taking directory=name
argument as valid and it instead requires directory=name.sagenb
(i.e with the suffix .sagenb
). This is a backwards incompatible change and I would not have been left scratching my head if I could read a Changelog or NEWS file which recorded these major backwards incompatible changes.
So, we need to maintain a Changelog or NEWS file which records only the major changes that are made to the notebook. For other stuff, there is the github log.
Currently (c384b4e), we have two failing doctests:
sage -t -force_lib "devel/sagenb-main/sagenb/misc/sphinxify.py"
**********************************************************************
File "/Users/grout/sage-trees/sage-5.4/devel/sagenb-main/sagenb/misc/sphinxify.py", line 57:
sage: sphinxify('`x=y`')
Expected:
'\n<div class="docstring">\n \n <p><span class="math">\\(x=y\\)</span></p>\n\n\n</div>'
Got:
'\n<div class="docstring">\n \n <p><span class="math">x=y</span></p>\n\n\n</div>'
**********************************************************************
1 items had failures:
1 of 9 in __main__.example_1
***Test Failed*** 1 failures.
For whitespace errors, see the file /Users/grout/.sage//tmp/sphinxify_78034.py
[3.1 s]
sage -t -force_lib "devel/sagenb-main/sagenb/misc/support.py"
**********************************************************************
File "/Users/grout/sage-trees/sage-5.4/devel/sagenb-main/sagenb/misc/support.py", line 246:
sage: D = docstring("r.lm", globs=globals())
Exception raised:
Traceback (most recent call last):
File "/Users/grout/sage-trees/sage-5.4/local/bin/ncadoctest.py", line 1231, in run_one_test
self.run_one_example(test, example, filename, compileflags)
File "/Users/grout/sage-trees/sage-5.4/local/bin/sagedoctest.py", line 38, in run_one_example
OrigDocTestRunner.run_one_example(self, test, example, filename, compileflags)
File "/Users/grout/sage-trees/sage-5.4/local/bin/ncadoctest.py", line 1172, in run_one_example
compileflags, 1) in test.globs
File "<doctest __main__.example_4[3]>", line 1, in <module>
D = docstring("r.lm", globs=globals())###line 246:
sage: D = docstring("r.lm", globs=globals())
File "/Users/grout/sage-trees/sage-5.4/devel/sagenb/sagenb/misc/support.py", line 275, in docstring
return html_markup(s.decode('utf-8'))
File "/Users/grout/sage-trees/sage-5.4/devel/sagenb/sagenb/misc/support.py", line 280, in html_markup
return sphinxify(s)
File "/Users/grout/sage-trees/sage-5.4/devel/sagenb/sagenb/misc/sphinxify.py", line 79, in sphinxify
filed.write(docstring)
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2018' in position 370: ordinal not in range(128)
**********************************************************************
1 items had failures:
1 of 5 in __main__.example_4
***Test Failed*** 1 failures.
It seems that the sphinxify.py one is left over from gh-97, and should have been fixed there.
It seems that the support.py one should have something to do with http://trac.sagemath.org/sage_trac/ticket/12415 and gh-84, maybe? That test got added in http://trac.sagemath.org/sage_trac/ticket/10860.
I am allowing myself to create a new issue here, since I see no activity on http://trac.sagemath.org/sage_trac/ticket/13535. Is there anyone following the notebook component on trac? Otherwise, shall we close that component, and advertise proeminently that notebook issues should be posted there?
Thanks!
Nicolas
Worksheets deleted by other users still appear in the main list when logged as admin.
Also, the admin cannot delete those worksheets.
Installed in sage 5.2.beta1 as per sage trac#13121 creating a new worksheet generates a worksheet named "untitled" with the contents of another worksheet in it rather than being empty.
If you try to recover your user password through the "forgot password" option, you always get a "invalid username" error.
I have tried to change line 292 in autentication.py from
user = g.notebook.user(request.values[username])
to
user = g.notebook.user(username)
Then the error message does not appear anymore, and you get a new password. But it seems that the stored password is not changed. The server keeps the old password.
class Prun(object):
def eval(self, cmd, sage_globals, locals=None):
import cProfile
return cProfile.run(cmd)
prun = Prun()
Then, you'd be able to do things like
%prun
Partitions(6).list()
and get the output like on the command-line.
There should be an easy way for an administrator to send an urgent message to all current users (for example, the message could appear in big red print at the top of each page, or be sent as a flash message). I'm thinking of things like: "We are upgrading the server in 10 minutes, so it will be down for about 2 minutes then."
Error message
Please activate JavaScript to enable the search functionality.
is displayed, there is no search field to input request. For the reference, JavaScript is enabled.
Search field should be shown, no error messages.
Sage 5.0.1 (installed from sage-5.0.1-OSX-64bit-10.6-x86_64-Darwin.dmg) , Safari 5.1.7, Mac OS X 10.6.8.
Corresponding piece of HTML and JavaScript is
<div id="fallback" class="admonition warning">
<script type="text/javascript"><span class="math">('#fallback').hide();</script> <p> Please activate JavaScript to enable the search functionality. </p> </div>
In log is
SyntaxError: Unexpected token '<'
I believe <span>
was accidentally put into JavaScript code and has broken it.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.