An application development framework for creating robust, reliable interactive installations.

Download & docs

What is Sparked?

Like twisted, Sparked is a python library and an application runner in once. Some of its features follow here:

  • Robust startup and restart of the program; if it crashes, it's started again.
  • Logging: keeps a rotated logfile for debugging purposes.
  • Pidfile management for making sure your app starts only once.
  • A GUI status window (based on GTK) for monitoring the state of the application and the state of the system (network, power supply, ...). Easy to add your own monitors.
  • Fullscreen graphics display for creating interactive displays, based on the clutter library.
  • Eventing system for broadcasting messages between spark modules.
  • A state machine for guiding the application through different states, with callback functions.

Why did you create Sparked?

Sparked was created out of frustration with current projects: over the past few years I have developed and helped others developing various interactive installations and artpieces, but I kept switching between different code bases and techniques on how to do things. In my work at Mediamatic, over the last year these technologies converged somewhat in the use of Python+Twisted and the linux application stack, as I developed IkCam, an RFID-enabled photo booth.

As IkCam was not open source, I decided to generalize the ideas that emerged there and combine them into a generic application runner on which it would be easy to build various interactive installations; with or without webcams, with or without displays, etc.

Why is it named Sparked?

A spark is the beginning of something. Literally, as in the start of a fire, but also the start of something new, something with "inspiration".  To spark means to set in motion, to rouse to action. The spark program is used to launch installations, artworks, and so in that sense its name can be taken quite literally.

Sparked is the past participle of the verb spark, and is named like that because in its architecture it shares similarities to Twisted: the famous asynchrounous network programming library for Python.


If you have Ubuntu, it's dead easy:

sudo add-apt-repository ppa:arjan-scherpenisse/spark
sudo apt-get update
sudo apt-get install python-sparked

that should give you the 'sparkd' executable.

How do I use it?

You start sparkd, the runner application for Sparked, and give it the "application" argument of your app. The sparked application is started as follows:

~# sparkd --help
sparkd [options] <application> [app_options]
 -d, --debug          Debug mode
 -N, --no-subprocess  Do not start a subprocess for crash prevention
 --id=            Application id (defaults to the sparked module name)
 --pidfile=       Pidfile location (defaults to /tmp/<app-id>/
 --logfile=       Pidfile location (defaults to /tmp/<app-id>/sparkd.log)
 --help           Display this help and exit.

The <application> argument specifies a Python module which is executed as the
main sparked class. To see which options hold for an application, start:

# sparkd <application> --help

A sparked example application

In the source distribution of spark, the contains the following:

# Copyright (c) 2010 Arjan Scherpenisse
# See LICENSE for details.

Example runner class for sparked.

from sparked import application

class Options(application.Options):
  optFlags = [["fast", "f", "Run fast"]]

__version__ = "0.1.0"

class Application(application.Application):

  title = "Sparked example"

  def startService(self):

    if self.appOpts['fast']:
      self.delay = 1
      self.delay = 10

  def enter_start(self):
    self.state.setAfter("ping", self.delay)

  def enter_ping(self):
    self.state.setAfter("start", self.delay)

  def createStage(self):
    return False