The Sage Distribution
A Monolithic Distribution
- A self-contained distribution of software
- A new (rather large) Python/Cython program that ties it all
- together and provides a smooth user experience.
This lecture is mainly about 1.
When you download and install Sage, you get a complete self-contained collection of programs. You can install multiple copies of Sage right next to each, with no interference. Also, (as much as possible) the other programs and libraries such as Python, Maxima, etc., that you have installed on your system don't interact in any way with Sage.
Some Linux hackers do not like 1 (it is hard to predict which people though, or why), but many more people love it, since it means that Sage "just works" on a wider range of platforms.
Definitely this self-contained approach is less work for the developers of Sage. It is also not unique, as there are several other similar distributions, including EPD (from Enthought), PythonXY, ActiveState's Python, etc. However, there is ongoing work by Debian, Gentoo, Mandriva, and other developers to get a version of Sage without all dependencies integrated into their package systems. In the case of Debian, this didn't go very well, but with other systems it is going better. (Tell story about Tim Abbott doing a herculean job, then starting a company, and having no more time to help -- this illustrates how for longterm success at a project, building a community is a more important skill than being brilliant and incredibly hardworking.)
Sage itself contains a large test suite with over a hundred thousand lines of input tests:
- flat:~ wstein$ sage -grep "sage:" |wc -l 123976
An extremely important advantage of distributing all components of Sage together is that we can regularly test together -- on two dozen platforms -- the exact versions we distribute. Such testing reveals subtle and surprising issues, e.g., a small change in one component can result in a surprising change in an seemingly totally unrelated function. (Tell Monsky-Washnitzer story, where suddenly a very subtle test in some p-adic cohomology function started breaking. It turned out to be caused by a subtle bug in the version of znpoly included in FLINT, which was included in Sage. The FLINT test suite didn't catch the bug, but Sage did.) This story is not uncommon; often upgrading a component of Sage reveals new bugs introduced in that component, which we either fix or report "upstream". In some cases we then wait for the next version of the component to be released.
You can run the Sage suite for your own Sage install by typing
- make test
in the root directory of your Sage install. (Can also mention "make testlong".)
What is included in Sage? See
for a list of all standard packages included in every copy of Sage. (Spend some time browsing this page.)
Open up a console and cd to SAGE_ROOT/spkg/standard/ and list the spkg's:
flat:standard wstein$ ls -1 *.spkg |wc -l
New packages get added to Sage at most a few times per year, after much discussion and voting, and careful investigation into their copyright license to make sure it is "GPL v3+ compatible".
Show the file
which contains a list of all packages, their copyright licenses, and the actual licenses... in theory -- it's actually probably out of date.
There are also many optional spkg's, which aren't shipped with Sage. You install them by typing
- sage -i package_name
They are listed here:
- Big specialized databases (the packages begining in "database_")
- Programs that we cannot legally distribute together with Sage as a single work, e.g.,
- GNUplot -- which is *NOT* GPL compatibly licensed graphviz -- also not GPL-compatible nauty -- can't be used by military valgrind -- just installing it rebuilds python with debugging symbols, etc. kash3-2008-07-31 -- a closed source binary
As you can see, you shouldn't just install every optional spkg.
Look Inside an Spkg
An spkg file is simply a bzip2'd tarfile, which means you can extract it by typing
- tar jxvf filename.spkg
(Next pick some spkg, say the Cython one, and look inside.)
The structure of the spkg is documented here, along with how to make and work with them:
The format is meant to be simple to learn and get your head around.
Sage has its own package management system, which keeps track of dependencies in a very simple way via the following makefile:
It does not track what files are installed as part of an spkg, so there is no way to uninstall an spkg.
You can see a list of installed standard packages via:
- sage -standard
and a list of installed and available optional spkg's via:
- sage -optional