On Mon, Mar 30, 2009 at 7:29 PM, William Stein <wst...@gmail.com> wrote:
>
> On Mon, Mar 30, 2009 at 5:54 PM, Ondrej Certik <ond...@certik.cz> wrote:
>>
>> Hi,
>>
>> I was looking a bit at what actually has to be done to get a useful
>> notebook.spkg, that can be installed without installing
>> sage-3.4.1.alpha0.spkg and most of it's dependencies. E.g. that is
>> useful for the windows port as well, as far as I understand.
>>
>> It seems to me that the sage notebook is pure python, so if I go to
>
> It doesn't depend at all on any real mathematics.  But it does depend
> a little maybe on some *cython* code, which isn't pure Python.  E.g.,
> the misc directory and sage_object.pyx.
>
>> sage/server and do:
>>
>> $ ipython
>> Python 2.6.1+ (r261:67515, Mar 19 2009, 14:08:48)
>> Type "copyright", "credits" or "license" for more information.
>>
>> IPython 0.9.1 -- An enhanced Interactive Python.
>> ?         -> Introduction and overview of IPython's features.
>> %quickref -> Quick reference.
>> help      -> Python's own help system.
>> object?   -> Details about 'object'. ?object also works, ?? prints more.
>>
>> In [1]: from notebook.all import notebook
>> ---------------------------------------------------------------------------
>> ImportError                               Traceback (most recent call last)
>>
>> /home/ondrej/ext/sage-3.4.1.alpha0/spkg/standard/sage-3.4.1.alpha0/sage/server/<ipython
>> console> in <module>()
>>
>> /home/ondrej/ext/sage-3.4.1.alpha0/spkg/standard/sage-3.4.1.alpha0/sage/server/notebook/all.py
>> in <module>()
>>     13 from sage_email import email
>>     14
>> ---> 15 from notebook_object import notebook, inotebook
>>     16
>>     17 from interact import interact, input_box, slider,
>> range_slider, selector, checkbox, input_grid, text_control
>>
>> /home/ondrej/ext/sage-3.4.1.alpha0/spkg/standard/sage-3.4.1.alpha0/sage/server/notebook/notebook_object.py
>> in <module>()
>>     17 import time, os, shutil, signal, tempfile
>>     18
>> ---> 19 import notebook as _notebook
>>     20
>>     21 import run_notebook
>>
>> /home/ondrej/ext/sage-3.4.1.alpha0/spkg/standard/sage-3.4.1.alpha0/sage/server/notebook/notebook.py
>> in <module>()
>>     20
>>     21 # Sage libraries
>>
>> ---> 22 from   sage.structure.sage_object import SageObject, load
>>     23 from   sage.misc.misc       import (alarm, cancel_alarm,
>>     24                                     tmp_dir, pad_zeros, cputime)
>>
>> ImportError: No module named sage.structure.sage_object
>>
>> In [2]:
>>
>> then all that has to be done is to take some things from Sage, e.g.
>> sage.structure.sage_object.SageObject and similar. Those are in
>> Cython.
>>
>> I am doing it right now, I'll see if more problems pop up, or if it's
>> just this. I'll report here.
>>
>
> You might find sage/server/notebook/run_notebook.py very interesting,
> in particular the part that starts:
> -----
>        config.write("""
> ####################################################################
> # WARNING -- Do not edit this file!   It is autogenerated each time
> # the notebook(...) command is executed.
> ####################################################################
> from twisted.internet import reactor
> ....
> -----
>
> You'll see what from the Sage notebook gets imported when the actual
> server is run, i.e., when the twistedconf.tac file is fed to the
> twisted daemon script.
>
> Regarding longterm maintainable, what I recommend is:
>   (1) that you make a new setup.py file
>   (2) that you refactor a little code in interfaces/expect.py so that
> it doesn't depend on the sage math library.
>
> You could do 1-2 after you just get stuff to work.  The cool thing is
> that with this approach one can just do something like
>
>   python setup-notebook.py sdist
>
> and get a source tarball for the notebook part of Sage, and this can
> 100% coexist with the current Sage library distribution.

Ok, I reduced the whole sage spkg package just to:

$ ls
all_cmdline.py  all_notebook.py  all.py  categories  ext  __init__.py
__init__.pyc  misc  server  structure  version.py

and it still seems to build and the notebook works. I'll now strip it
even further. And later implement (1) and (2) as you suggested.

Ondra

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to