linking sage cells with different templates (to "hide" code)

25 views
Skip to first unread message

Michael Miller

unread,
Mar 28, 2021, 4:51:16 PM3/28/21
to sage-cell

I'm setting up a sage cell that requires some front-end code to define functions. Rather than requiring my users to scroll through that code, I'd like to "hide" it.

One possibility would be to autoeval the front-end code in a cell with a minimal template and hidden editor, then have my users work in a second (linked) cell with a normal template and editor. But defining cells with different templates seems to require using different div classes, and linked:true seems to work only within a class.

1) Is there a better way to "hide" code?

2) Is there a way to link cells that have different templates?

Thanks!

Ingo Dahn

unread,
Mar 30, 2021, 4:38:19 PM3/30/21
to sage-cell
You may - theoretically - hide code by puttting it into a python file at a URL and including load(URL) into the first sage cell. That code would be loaded when the reader evaluates this cell.
Unfortunately, recently this stopped working when SageCell removed it's Internet support. Hopefully, this will soon be re-established for selected URL, in particular for URLs ponting to Github files.

Michael Miller

unread,
Mar 30, 2021, 6:47:39 PM3/30/21
to sage-cell
Up until a few weeks ago, I loaded/hid sage code in exactly that way.  As you pointed out, that's now broken, so I'm trying to find another path forward.

David Farmer

unread,
Mar 30, 2021, 7:14:00 PM3/30/21
to sage-cell

It also would be nice to have a hidden cell that auto-evaluates,
linked to a regular cell.
> --
> You received this message because you are subscribed to the Google Groups "sage-cell" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
> sage-cell+...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sage-cell/ba1abd16-ccc8-4647-8a46-8e77658969f3n%40googlegroups.com.
>
>

david.g...@gmail.com

unread,
Mar 30, 2021, 9:07:39 PM3/30/21
to sage-cell
I have the following in a sage cell:

import csv
data = csv.reader(open('nexus_2019-10-0313.51.25.csv'))

This definitely used to work. Has this been broken by the removal of internet access also? The file being opened is in the same directory as the html file.

-- David

Andrey Novoseltsev

unread,
Apr 1, 2021, 10:16:32 AM4/1/21
to sage-cell
On Tuesday, 30 March 2021 at 19:07:39 UTC-6 david.g...@gmail.com wrote:
I have the following in a sage cell:

import csv
data = csv.reader(open('nexus_2019-10-0313.51.25.csv'))

This definitely used to work. Has this been broken by the removal of internet access also? The file being opened is in the same directory as the html file.

It is probably related. There are no plans to allow connections to the computer that served the web page, but github should be accessible now!
Reply all
Reply to author
Forward
0 new messages