Moving Worksheets?

11 views
Skip to first unread message

jonhanke

unread,
Nov 28, 2007, 8:47:24 PM11/28/07
to sage-support
Hi,

I am moving between versions of SAGE (2.8.12 -> 2.8.14), and would
like to move my old worksheets to the new installation. In principle
I could move my old worksheets to the new version by exporting them to
files, and then loading them in, however I can't get the old SAGE to
build/run to do this. I was wondering if I can just copy the
unprocessed worksheet files directly to their new home, and where they
are located? Also, if I could get the server running, is there a way
to migrate all worksheets at once? Thanks,

-Jon
=)

William Stein

unread,
Nov 28, 2007, 10:59:14 PM11/28/07
to sage-s...@googlegroups.com

Luckily, the format of the sage notebook hasn't changed at all in 6
months -- You should
just be able to use all your Sage notebooks from any version of sage from
the last 6 months with any other one automatically.

If you want to make a copy or move a sage_notebook directory, just copy
or move it.

Apologies if I misunderstand your questions -- if so, please clarify.

William

jonhanke

unread,
Nov 28, 2007, 11:30:35 PM11/28/07
to sage-support

On Nov 29, 4:59 am, "William Stein" <wst...@gmail.com> wrote:
> On Nov 28, 2007 5:47 PM, jonhanke <jonha...@gmail.com> wrote:
>
> > I am moving between versions of SAGE (2.8.12 -> 2.8.14), and would
> > like to move my old worksheets to the new installation. In principle
> > I could move my old worksheets to the new version by exporting them to
> > files, and then loading them in, however I can't get the old SAGE to
> > build/run to do this. I was wondering if I can just copy the
> > unprocessed worksheet files directly to their new home, and where they
> > are located? Also, if I could get the server running, is there a way
> > to migrate all worksheets at once? Thanks,
>
> Luckily, the format of the sage notebook hasn't changed at all in 6
> months -- You should
> just be able to use all your Sage notebooks from any version of sage from
> the last 6 months with any other one automatically.
>
> If you want to make a copy or move a sage_notebook directory, just copy
> or move it.

Great, but now where are they? I looked around (in the file system
and in the documentation), but couldn't find where the worksheet data
is stored. For instance, none of the following seem very promising:

jonhanke@[~/Documents/sage-2.8]: find . -name sage_notebook
./devel/doc-2.8/overviews/a_tour_of_sage/sage_notebook
./devel/doc-main/.hg/data/overviews/a_tour_of_sage/sage_notebook
./devel/doc-main/overviews/a_tour_of_sage/sage_notebook

> Apologies if I misunderstand your questions -- if so, please clarify.

I was also wondering if there was a way to allow for migrating
worksheets in there were changes to the notebook format between
versions. I assumed that the "save worksheet to file" option would
automatically account for such format changes when importing a saved
worksheet from an older version of Sage, so this would be the correct
(i.e. safe) way of migrating worksheets. If this is true, then it
would be nice to have a "save all worksheets to a file" option, and if
not then I'm asking if there is a safe way of migrating worksheets
between Sage versions.

Thanks,

-Jon
=)

William Stein

unread,
Nov 28, 2007, 11:41:05 PM11/28/07
to sage-s...@googlegroups.com
On Nov 28, 2007 8:30 PM, jonhanke <jonh...@gmail.com> wrote:
>
>
> On Nov 29, 4:59 am, "William Stein" <wst...@gmail.com> wrote:
> > On Nov 28, 2007 5:47 PM, jonhanke <jonha...@gmail.com> wrote:
> >
> > > I am moving between versions of SAGE (2.8.12 -> 2.8.14), and would
> > > like to move my old worksheets to the new installation. In principle
> > > I could move my old worksheets to the new version by exporting them to
> > > files, and then loading them in, however I can't get the old SAGE to
> > > build/run to do this. I was wondering if I can just copy the
> > > unprocessed worksheet files directly to their new home, and where they
> > > are located? Also, if I could get the server running, is there a way
> > > to migrate all worksheets at once? Thanks,
> >
> > Luckily, the format of the sage notebook hasn't changed at all in 6
> > months -- You should
> > just be able to use all your Sage notebooks from any version of sage from
> > the last 6 months with any other one automatically.
> >
> > If you want to make a copy or move a sage_notebook directory, just copy
> > or move it.
>
> Great, but now where are they?

Worksheets are stored in a the directory sage_notebook (or whatever you
called it). The state of the whole notebook and associated data files
is stored in that directory.

> I looked around (in the file system
> and in the documentation), but couldn't find where the worksheet data
> is stored. For instance, none of the following seem very promising:

E.g., if you do

cd my_favoriate_directory

then

sage -notebook

a directory

my_favoriate_directory/sage_notebook

is created and inside of that the notebook state is stored. I have
probably a dozen different sage_notebook directories just on my laptop.
E.g., if I'm working on a paper I often make a sage_notebook directory
in the same directory as the paper, and gather all relevant worksheets
there.

>
> jonhanke@[~/Documents/sage-2.8]: find . -name sage_notebook
> ./devel/doc-2.8/overviews/a_tour_of_sage/sage_notebook
> ./devel/doc-main/.hg/data/overviews/a_tour_of_sage/sage_notebook
> ./devel/doc-main/overviews/a_tour_of_sage/sage_notebook
>
> > Apologies if I misunderstand your questions -- if so, please clarify.
>
> I was also wondering if there was a way to allow for migrating
> worksheets in there were changes to the notebook format between
> versions.

You can take a sage_notebook directory from any version of the
notebook that I have ever released and type

sage -notebook

and it should work with no loss of data. There was exactly one format
change in the history of the notebook in I think June, and if your notebook
is older than this, it will be migrated and the old worksheets will appear
under "published".

> I assumed that the "save worksheet to file" option would
> automatically account for such format changes when importing a saved
> worksheet from an older version of Sage, so this would be the correct
> (i.e. safe) way of migrating worksheets. If this is true, then it
> would be nice to have a "save all worksheets to a file" option, and if
> not then I'm asking if there is a safe way of migrating worksheets
> between Sage versions.

You just don't have to worry about any of that -- Sage should (and does)
read old worksheets. By the way, worksheets themselves are just
stored as plain text files. E.g., if I do

cd /Users/was/sage_notebook/worksheets/admin/0

on my laptop, there is a file worksheet.txt with these contents:

justin
system:sage

{{{id=0|
def CompSum(a,b):
return a+b
}}}

{{{id=1|
CompSum(3,4)
///
7
}}}

{{{id=3|
2+2
///
4
}}}

{{{id=4|
Q.<i,j,k>=QuaternionAlgebra(QQ,-3,4)
...
}}}

So you needn't be afraid of worksheets being stored in some
weird internal database or binary file -- they're just in
the directory sage_notebook/worksheets/username/number/worksheet.txt

One nice benefit of this is if you want to find all worksheets on your computer
in any directory that contain "this worksheet proves the Riemann Hypothesis",
say, then you can just do a full text search and you'll find them.

William

jonhanke

unread,
Nov 29, 2007, 12:11:26 AM11/29/07
to sage-support


On Nov 29, 5:41 am, "William Stein" <wst...@gmail.com> wrote:
Great! That's exactly what I wanted to know. =)

William Stein

unread,
Nov 29, 2007, 12:22:39 AM11/29/07
to sage-s...@googlegroups.com
On Nov 28, 2007 9:11 PM, jonhanke <jonh...@gmail.com> wrote:
> > So you needn't be afraid of worksheets being stored in some
> > weird internal database or binary file -- they're just in
> > the directory sage_notebook/worksheets/username/number/worksheet.txt
> >
> > One nice benefit of this is if you want to find all worksheets on your computer
> > in any directory that contain "this worksheet proves the Riemann Hypothesis",
> > say, then you can just do a full text search and you'll find them.
> >
> > William
>
> Great! That's exactly what I wanted to know. =)

Could you think back about when/how/where you might have looked or
thought to look in the documentation for this sort of information? It's of
course not anywhere in the documentation, but if you could explain where
you think it should have been, we could stick it here. Even better, you
could even put it there and submit a patch.

William

jonhanke

unread,
Nov 29, 2007, 1:36:16 AM11/29/07
to sage-support


On Nov 29, 6:22 am, "William Stein" <wst...@gmail.com> wrote:
Yes, I googled for """sage notebook data files""", which gave me the
following Sage Reference Manual links:

http://modular.math.washington.edu/sage/doc/html/ref/module-sage.server.notebook.twist.html
http://www.sagemath.org/doc/html/inst/node10.html
http://modular.math.washington.edu/sage/doc/html/prog/node73.html

and the talk of Alex Clemesha:

http://modular.math.washington.edu/sage/talks/2006-11-17-alex-clemesha/sage-talk-notebook.pdf

Not surprisingly, the Sage Days talk notes tend to be very useful
references for core functionality (and I would suggest possibly making
a home for some of them by topic on sagemath under Documentation).

This should really be mentioned in two separate places:

1) Describing structure (and location) of the sage_notebook
directory
[Programming Guide]

2) Migration from a previous version
[Users Guide]

(The Users Guide to me is something between the Tutorial and the
Reference Manual, and describes common operations and questions. The
topics here should initially come from complete answers given in the
sage-support list, as well as common-knowledge practices for power
users.)

I'm maintaining for myself a list of common tasks that I have to do,
and would be happy to assemble these in a document and add it
somewhere. Is there any good documentation documentation? I found
this thread:

http://groups.google.com/group/sage-devel/browse_thread/thread/40b31802dd3405a3/126b407a062cda63?hl=en&lnk=gst&q=documentation#126b407a062cda63

but it only describes how to dynamically update a local copy of the
Reference manual. What about changing the Tutorial/Programming Guide?

Thanks,

-Jon
=)

William Stein

unread,
Nov 29, 2007, 2:09:13 AM11/29/07
to sage-s...@googlegroups.com

For the tutorial edit
SAGE_ROOT/devel/doc/tut/tut.tex
and for the programming guide edit
SAGE_ROOT/devel/doc/prog/prog.tex
Once you edit one of those files do
cd SAGE_ROOT/devel/doc/tut/
./build_dvi
to build the dvi version in the current directory, or ./build_pdf to
build a pdf.
Make sure it looks good. Then do hg_doc.ci(); hg_doc.export(...) or
hg_doc.send(...)
etc.

-- William

Reply all
Reply to author
Forward
0 new messages