Sage: Ticket #386: Enhance "attach <file>" in the notebook
https://trac.sagemath.org/ticket/386
<p>
I noticed that the natural progression for someone who starts to work with sage is that they start with using the notebook exclusively. Any "def"d functions are simply defined in a cell in the worksheet (with all scrollbar problems that go with it). As they progress, and want to test their routine in different situations, this method becomes cumbersome: they have to copy the cell content to other worksheets if they want to run tests in other worksheets and the usual problems arise by having several copies lying around: Edits in one version are not propagated to the other.
</p>
<p>
This would be the natural moment to explain that the user should put his/her routines in, say, file.sage instead and attach it in any worksheet that is used. Ultimately, the user should probably learn how to use an independent, high quality source code editor to work with the files, but it would be nice if there were an intermediate step: An easy way to create, edit and attach a file within the scope of the notebook, but accessible from all worksheets, much like the "saved objects".
</p>
<p>
A hackish way is the following, assuming that /home/nobody is writable for the notebook UID:
</p>
<pre class="wiki">%sh
cat > /home/nobody/file.sage <<EOFEOFEOF
#######################################
## file.sage
def facto(n):
if n == 1:
return 1
else:
return n*facto(n-1)
EOFEOFEOF
</pre><p>
This causes all kinds of interesting errors, since the cell directory may not exist or may have been deleted by the system for, to me, no apparent reason. In all cases, however, the code has the desired effect of creating the file.
</p>
<p>
Now, after
</p>
<pre class="wiki">attach "/home/nobody/file.sage"
</pre><p>
the user can use the routine "facto" in the worksheet and in fact, editing the %sh cell and executing it will lead to sage rereading file.sage the next time around, effecting the edit in the worksheet.
</p>
<p>
Would it be possible to have a less hackish way of establishing this? In fact, once a full force source code editor is part of sage, perhaps the most useful thing would be if one could open a tab/window on one of those "attach" files rather than having to do the editing in cells.
</p>
<p>
I understand that the security implications of stuff like this are even worse than just the shielded environment and may require some serious thinking to resolve, but lowering the threshold of doing actual programming in sage should increase the number of developers/contributors.
</p>
<p>
While you're at it, why not put the files under mercurial control as well and provide some nice tools in the notebook to view the various revisions?
</p>
en-usSagehttps://trac.sagemath.org/chrome/site/logo_sagemath_trac.png
https://trac.sagemath.org/ticket/386
Trac 1.1.6mabshoffMon, 10 Sep 2007 02:45:46 GMTmilestone set
https://trac.sagemath.org/ticket/386#comment:1
https://trac.sagemath.org/ticket/386#comment:1
<ul>
<li><strong>milestone</strong>
set to <em>sage-3</em>
</li>
</ul>
TicketwasThu, 19 Nov 2009 21:21:49 GMTstatus changed; resolution set
https://trac.sagemath.org/ticket/386#comment:2
https://trac.sagemath.org/ticket/386#comment:2
<ul>
<li><strong>status</strong>
changed from <em>new</em> to <em>closed</em>
</li>
<li><strong>resolution</strong>
set to <em>fixed</em>
</li>
</ul>
<p>
I implemented this already... via the DATA --> Upload or Create File function. That does exactly what this ticket is about. Of course, this ticket has some vague revision control stuff, but that's too vague for a single ticket. So I'm closing this.
</p>
TicketmvnguTue, 08 Dec 2009 23:40:07 GMTupstream set
https://trac.sagemath.org/ticket/386#comment:3
https://trac.sagemath.org/ticket/386#comment:3
<ul>
<li><strong>upstream</strong>
set to <em>N/A</em>
</li>
</ul>
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/386#comment:2" title="Comment 2">was</a>:
</p>
<blockquote class="citation">
<p>
So I'm closing this.
</p>
</blockquote>
<p>
Do you know in which version of Sage was the feature described in this ticket was merged? If it was merged in Sage 4.3, was it alpha0 or alpha1?
</p>
TicketwasWed, 09 Dec 2009 05:31:45 GMT
https://trac.sagemath.org/ticket/386#comment:4
https://trac.sagemath.org/ticket/386#comment:4
<blockquote class="citation">
<p>
Do you know in which version of Sage was the feature described in this ticket was
merged? If it was merged in Sage 4.3, was it alpha0 or alpha1?
</p>
</blockquote>
<p>
It was back in 2008 sometime...
</p>
TicketmvnguSat, 26 Dec 2009 16:55:53 GMTmilestone changed
https://trac.sagemath.org/ticket/386#comment:5
https://trac.sagemath.org/ticket/386#comment:5
<ul>
<li><strong>milestone</strong>
changed from <em>sage-feature</em> to <em>sage-4.3</em>
</li>
</ul>
TicketwasSat, 26 Dec 2009 17:06:41 GMTmilestone changed
https://trac.sagemath.org/ticket/386#comment:6
https://trac.sagemath.org/ticket/386#comment:6
<ul>
<li><strong>milestone</strong>
changed from <em>sage-4.3</em> to <em>sage-4.3.1</em>
</li>
</ul>
TicketwasSat, 26 Dec 2009 17:07:46 GMTmilestone changed
https://trac.sagemath.org/ticket/386#comment:7
https://trac.sagemath.org/ticket/386#comment:7
<ul>
<li><strong>milestone</strong>
changed from <em>sage-4.3.1</em> to <em>sage-4.3</em>
</li>
</ul>
TicketmvnguSun, 27 Dec 2009 00:48:40 GMTmerged set
https://trac.sagemath.org/ticket/386#comment:8
https://trac.sagemath.org/ticket/386#comment:8
<ul>
<li><strong>merged</strong>
set to <em>sage-nb</em>
</li>
</ul>
Ticket