Skip to main content

The PreTeXt Guide

Subsection 4.21.1 Sage Cell Server Design

The ability to execute, and edit, chunks of Sage code is provided by a distinct project, the Sage Cell Server 1 . Simplifying somewhat, the Sage code a reader sees (or has edited!) is shipped out to a running instance of Sage (on a server somewhere) and the code is executed there. The results of that computation are shipped back to the reader for display below the code.
Two implications of this design are
  • It is not within your power to add additional packages for the supported languages.
  • You cannot read a (data) file hosted on your project’s site.
Fortunately, there are workarounds.
If your code needs a Python package, or an R package, or similar, and it is a standard open source package, then make a request on the Sage Cell 2  Google Group. Likely, it can be added/installed.
Unfortunately, the ability to read files anywhere on the internet was abused, so this capability had to be restricted to a finite list of servers. These include DropBox 3  and GitHub 4  where you might find it convenient to place files supporting your code. Note that for GitHub, you likely want to use a URL which is a “raw” file such as for the PreTeXt repository README 5  file, written with Markdown.
sagecell.sagemath.org/
groups.google.com/g/sage-cell
www.dropbox.com
github.com
github.com/PreTeXtBook/pretext/raw/master/README.md