What should be the present working directory for sage -notebook=ipython ?

401 views
Skip to first unread message

Sébastien Labbé

unread,
Oct 13, 2014, 9:25:01 AM10/13/14
to sage-...@googlegroups.com
Hi sage-devel,

At http://trac.sagemath.org/ticket/16996#comment:47, we had this discussion about what should be the present working directory (pwd) for sage -notebook=ipython ? Personally, I really like the behavior of the sage command line where the pwd is just the present working directory:

$ pwd
/Users/slabbe/the/folder/where-I-want-to-work/
$ sage
sage: pwd
/Users/slabbe/the/folder/where-I-want-to-work/

I was expecting the same for the new ipython notebook for Sage. But as #16996 will go in now, the default directory will always be DOT_SAGE/notebooks_ipython/ which follows the style for the sagenb notebook where worksheets were hidden in some DOT_SAGE folder.

Note: With #16996, it is possible to start in the current directory with sage -notebook=ipython --notebook-dir=.

Time to vote. What do you prefer as default directory for the ipython notebook?

 - pwd
 - DOT_SAGE/notebooks_ipython/

Sébastien

Eric Gourgoulhon

unread,
Oct 13, 2014, 9:41:16 AM10/13/14
to sage-...@googlegroups.com
Hi Sébastien,

I vote for
- DOT_SAGE/notebooks_ipython/

Best wishes,

Eric.


Clemens Heuberger

unread,
Oct 13, 2014, 11:06:02 AM10/13/14
to sage-...@googlegroups.com
Am 2014-10-13 um 15:25 schrieb Sébastien Labbé:
> Note: With #16996, it is possible to start in the current directory with sage
> -notebook=ipython --notebook-dir=.
>
> Time to vote. What do you prefer as default directory for the ipython notebook?
>
> - pwd

+ 1

When I first read of http://ipython.org/notebook.html
"These notebooks are normal files that can be shared with colleagues,
converted to other formats such as HTML or PDF, etc."

and http://ipython.org/ipython-doc/stable/notebook/notebook.html

"In this way, notebook files can serve as a complete computational
record of a session, interleaving executable code with explanatory
text, mathematics, and rich representations of resulting objects. These
documents are internally JSON files and are saved with the .ipynb
extension. Since JSON is a plain text format, they can be version-
controlled and shared with colleagues."

I felt that the ipython notebook would much more suit my workflow (everything
belonging to a particular paper or course is in its own directory structure,
under version control).

So IMHO having it all in DOT_SAGE somehow breaks the ipython notebook philosophy.

Regards, CH

Felix Salfelder

unread,
Oct 13, 2014, 11:17:54 AM10/13/14
to sage-...@googlegroups.com
On Mon, Oct 13, 2014 at 06:25:01AM -0700, Sébastien Labbé wrote:
> - pwd

obviously.

thanks for catching this, it will be hard to fix afterwards. can you
name a single (mature?) program that breaks with this convention?

cheers
felix

Volker Braun

unread,
Oct 13, 2014, 11:30:58 AM10/13/14
to sage-...@googlegroups.com
Also, if you vote "yes" then you volunteer for fixing the current notebook to match the behavior ;-)

Volker Braun

unread,
Oct 13, 2014, 11:36:36 AM10/13/14
to sage-...@googlegroups.com, clemens....@aau.at
On Monday, October 13, 2014 4:06:02 PM UTC+1, Clemens Heuberger wrote:
I felt that the ipython notebook would much more suit my workflow (everything
belonging to a particular paper or course is in its own directory structure,
under version control).

Just to be clear, IPython stores a flat file with base64-encoded images inside. Its ok but not perfect with version control, at least if you don't want chunks of binary data (potentially changing with each run) in your history. 

Clemens Heuberger

unread,
Oct 13, 2014, 12:16:12 PM10/13/14
to sage-...@googlegroups.com
Am 2014-10-13 um 17:30 schrieb Volker Braun:
> Also, if you vote "yes" then you volunteer for fixing the current notebook to
> match the behavior ;-)
>

I do not think that this is necessary: one the one hand, it would lead to big
deprecation; on the other hand, the current sage notebook with its user
management is perhaps not fully comparable with the approach of the ipython
notebook which seems to be strictly single user.

regards, CH

Volker Braun

unread,
Oct 13, 2014, 4:31:03 PM10/13/14
to sage-...@googlegroups.com, clemens....@aau.at
The ipython roadmap is definitely to have a multi-user capable notebook (https://github.com/jupyter/jupyterhub). 

Nicolas M. Thiery

unread,
Oct 15, 2014, 11:03:06 AM10/15/14
to sage-...@googlegroups.com
On Mon, Oct 13, 2014 at 06:25:01AM -0700, Sébastien Labbé wrote:
> Time to vote. What do you prefer as default directory for the ipython
> notebook?
> - pwd
> - DOT_SAGE/notebooks_ipython/

pwd without hesitation! That's one of my main gripe about the sage
notebook. And I had trouble with this just this morning in my class.

Cheers,
Nicolas
--
Nicolas M. Thiéry "Isil" <nth...@users.sf.net>
http://Nicolas.Thiery.name/

Emmanuel Charpentier

unread,
Oct 18, 2014, 12:02:50 PM10/18/14
to sage-...@googlegroups.com
pwd : I'd love to know *WHERE* I stored such and such plots I had trouble to extract from Sage (and couldn't do otherwise...), without having to scratch my guesses through a directory bush (i. e something aspiring to the dignity of tree but starting in a gazillion directions at once with no usable names...).

BTW : any hope to be able to invoke sage with a worksheet as an argument ? I'd love to save a worksheet to some file and be able to edit it by just saying "sage somefile.someext" (hint : think git...). The current notebook does not allow for that, alas : you have to explicitely import your worksheet (seems to be a compressed archive of a directory tree), and to explicitely export it after saving it.

HTH,

--
Emmanuel Charpentier

Robert Bradshaw

unread,
Oct 19, 2014, 2:08:59 AM10/19/14
to sage-devel
+1 to pwd. I've forgotten to copy over my sage notebooks more than
once when moving to a new computer, and even when I remember to it's a
pain to navigate that huge tree to figure out which ones you care
about.
> --
> You received this message because you are subscribed to the Google Groups
> "sage-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-devel+...@googlegroups.com.
> To post to this group, send email to sage-...@googlegroups.com.
> Visit this group at http://groups.google.com/group/sage-devel.
> For more options, visit https://groups.google.com/d/optout.

Sébastien Labbé

unread,
Oct 23, 2014, 9:51:08 AM10/23/14
to sage-...@googlegroups.com

kcrisman

unread,
Oct 23, 2014, 2:20:52 PM10/23/14
to sage-...@googlegroups.com
BTW : any hope to be able to invoke sage with a worksheet as an argument ? I'd love to save a worksheet to some file and be able to edit it by just saying "sage somefile.someext" (hint : think git...). The current notebook does not allow for that, alas : you have to explicitely import your worksheet (seems to be a compressed archive of a directory tree), and to explicitely export it after saving it.


I think you can use something along the lines of 

sage -n option=worksheet.txt/rst/html/...

but I forget the exact syntax.

"sage --advanced" says

  -n, -notebook [...] -- start the Sage notebook (options are the same
                         as for the notebook command in Sage)

so it must be fairly doable.  Oh yeah, here we go:

     * "upload" -- string (default: None) Full path to a local file
        (sws, txt, zip) to be uploaded and turned into a worksheet(s).
        This is equivalent to manually uploading a file via
        "http://localhost:8080/upload" or to fetching
        script except that (hopefully) you will already be logged in.

so 

sage -n upload='full/path/to/file/"

*should* work.     I remember using this while testing some of the stuff in the Mac app a few years back so hopefully you'll be in luck.


- kcrisman

Sébastien Labbé

unread,
Oct 23, 2014, 10:10:34 PM10/23/14
to sage-...@googlegroups.com


On Sunday, October 19, 2014 2:08:59 AM UTC-4, Robert Bradshaw wrote:
+1 to pwd.

#17203 now needs review
Reply all
Reply to author
Forward
0 new messages