Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

dirt is a comprehensive framework for building Python applications which are part of a service oriented architecture

Project Description

dirt provides all the tools required to build long-running Python applications (“services”) which can communicate over RPC.

Specifically, it provides:

  • Tools for exposing methods over RPC (using either a dirt custom protocol or ZeroRPC, including nicities like iPython tab completion).
  • A framework for creating long-running applications, and exposing their methods over RPC.
  • Tools for running multiple applications in one terminal, either for development or in production.
  • A simple syntax for defining applications (currently Django-style files are best supported, but .ini could easily be supported too).

An application can be as simple as:

$ cat
import gevent
import logging

from dirt import DirtApp, runloop

log = logging.getLogger(__name__)

class PingAPI(object):
    def ping(self):
        return "pong"

class PingApp(DirtApp):
    def get_api(self, edge, call):
        return PingAPI()

class LongRunningApp(DirtApp):
    def serve(self):
        ping_app = self.settings.get_api("ping")
        while True:
            result =
  "ping: %r", result)

$ cat
from dirt import logging_default
DIRT_APP_PIDFILE = "/tmp/dirt-example-{app_name}.pid"
LOGGING = logging_default("/tmp/dirt-example-{app_name}.log", root_level="INFO")

class PING:
    app_class = "app.PingApp"
    bind_url = "zrpc+tcp://"
    remote_url = bind_url

    app_class = "app.LongRunningApp"

$ ./run ping long_running
23:20:21.289 ping INFO binding to zrpc+tcp://
23:20:21.477 long_running INFO app: ping: 'pong'
23:20:22.380 long_running INFO app: ping: 'pong'

Some notes:

  • dirt plays well with others, integrating easily into existing projects. See the example_project/ directory for a Django project which uses dirt.
  • dirt depends on gevent==1.0. In theory it should be possible for applications to use operating system threads, but this hasn’t been tested.

Development Status

dirt is used by Luminautics in a production environment, and has been incredibly stable for the last six months.

That said, there will likely be some undocumented assumptions which could affect other users, so some amount of testing should be done before trusting it in your production environment.

Release History

This version
History Node


Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, Size & Hash SHA256 Hash Help File Type Python Version Upload Date
(43.7 kB) Copy SHA256 Hash SHA256
Source None Feb 5, 2013

Supported By

Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Kabu Creative Kabu Creative UX & Design Google Google Cloud Servers Fastly Fastly CDN StatusPage StatusPage Statuspage DigiCert DigiCert EV Certificate