Download

Take Sython for a Spin

We currently have a working prototype of Sython based on Python 2.3.4.

sython.tgz - Source for an OS X or Unix compile.

Installation Instructions

At this time, Sython is only distributed as source code. These instructions give a basic discription for installation only. For more detailed instructions please refer to the Sython Manual.

  1. To install Sython, unpack the sython.tgz download into a temporary directory. This can be accomplished with the command line command
    tar -zxvf sython.tgz
  2. Next configure the build system for your machine by executing the command
    ./configure
  3. The build step comes next. Enter the command
    make
    to build Sython.
  4. After Sython has been built it must be installed. To do this enter
    sudo make install
    This command installs Sython into the dictory /usr/local/ and will prompt non super users for their password.
  5. The Sython Daemon must also be installed. To do this first copy the sythond/ directory that was unpacked into a more permanent place such as /usr/local.
  6. The Sython Daemon directory contains an installer script. From the sythond/ directory type
    ./install_syd
    You may be promted again for the administrator password.
Note to MacOSX 10.4 Users: after executing instruction number 2, the file pyconfig.h must be edited. Find the line
/* #undef HAVE_BROKEN_POSIX_SEMAPHORES */
and change it to
#define HAVE_BROKEN_POSIX_SEMAPHORES 1

Getting Started

The quick start installation instructions above will install Sython without database support. If database support is desired, please follow the installation instructions in the Sython Manual. Once Sython has been successfully installed, use this section to quickly get up to speed. You will be instructed on how to start sython and sythond and how to use some of new Sython features.

To start the daemon, type sythond -c from the terminal window. Typing sythond -h will display all of the command line parameters. The -c parameter starts it in an interactive console mode. Now, open a new terminal window and type sython.

We will begin by allocating a new sython variable. This is done via the line $x=syalloc('i'). This line allocates a new variable x. The variable is a handle for an integer that is stored in the Sython Daemon. The value was randomly assigned. The function syalloc() is one of a number of new built-in functions. Consult the Sython Manual for a complete list. Try to determine the value of x by typing print x and hitting Return. Only the memory location of the syobj handle is revealed. The actual value isn't even stored in Sython--it is in sythond's protected memory. Next we will allocate another secure variable. Type in $y=syalloc('i',(10,20)). This will allocate a new variable y which will be a handle to another integer in the Sython Daemon. This integer will be randomly chosen from the range ten to twenty. Just like normal Python variables, secure variables support mathematic operations, type $z=x+y. The variable z now contains the sum of x and y. A useful debugging tool in Sython is the new built-in function syval(). This function returns a string representation of a secure variable. The string will stay the same between calls as long as the secure variable itself does not change. If the variable changes, the return value may or may not change, too. To see syval() in action, type syval(z).

This has been a brief tutorial on using the new features of Sython. It has been far from exhaustive. Users are urged to read the Sython Manual for a more complete description of all new Sython features. Also, the Python built-in help is a valuable resource. Simply type help("syalloc") into the Sython interpreter prompt to see help about syalloc() (or any other new Sython function).