Skip to main content
Help us improve Python packaging – donate today!

Event driven concurrent framework for Python

Project Description

Event driven concurrent framework for python. Tested in Windows and Linux, it requires python 2.6 and up, including python 3. With pulsar you can write asynchronous servers performing one or several activities in different threads and/or processes.

An example of a web server written with pulsar application framework which responds with “Hello World!” for every request:

from pulsar.apps import wsgi

def hello(environ, start_response):
    '''Pulsar HTTP "Hello World!" application'''
    data = b'Hello World!\n'
    status = '200 OK'
    response_headers = (
        ('Content-type','text/plain'),
        ('Content-Length', str(len(data)))
    )
    start_response(status, response_headers)
    return [data]


if __name__ == '__main__':
    return wsgi.WSGIServer(callable=hello).start()

Pulsar’s goal is to provide an easy way to build scalable network programs. In the “Hello world!” web server example above, many client connections can be handled concurrently. Pulsar tells the operating system (through epoll or select) that it should be notified when a new connection is made, and then it goes to sleep.

Pulsar uses the multiprocessing module from the standard python library and it can be configured to run in multi-processing or multi-threading mode.

Installing

Pulsar is a stand alone python library which works for python 2.6 up to python 3.3. Installing pulsar can be done via pip:

pip install pulsar

easy_install or downloading the tarball from pypi.

Applications

Pulsar design allows for a host of different applications to be implemented in an elegant and efficient way. Out of the box it is shipped with the the following

  • Socket servers.
  • WSGI server (with a JSON-RPC handler too).
  • A distributed task queue.
  • Pulsar shell for asynchronous scripting (posix only).
  • Asynchronous test suite.

Examples

Check out the examples directory for various working applications created using pulsar alone.

Design

Pulsar internals are based on actors primitive. Actors are the atoms of pulsar’s concurrent computation, they do not share state between them, communication is achieved via asynchronous inter-process message passing, implemented using the standard python socket library.

Two special classes of actors are the Arbiter, used as a singletone, and the Monitor, a manager of several actors performing similar functions. The Arbiter runs the main eventloop and it controls the life of all actors. Monitors manage group of actors performing similar functions, You can think of them as a pool of actors.

More information about design and philosophy in the documentations.

Add-ons

Pulsar check if some additional python libraries are available, either during installation or at runtime, and uses them to add new functionalities.

  • setproctitle. If installed, pulsar will used to change the processes names. To install:

    pip install setproctitle
    
  • psutil. If installed, a system key is available in the dictionary returned by Actor info method.

Running Tests

Pulsar test suite uses the pulsar test applications. If you are using python 2.6 you need to install unittest2. To run the tests:

python runtests.py

For options and help type:

python runtests.py -h

Kudos

Pulsar project started as a fork of gunicorn (from where the arbiter idea) and has been developed using ideas from nodejs (api design), twisted (the deferred implementation), tornado web server (the event-loop implementation), celery (the task queue application) and many other open-source efforts.

Release history Release notifications

History Node

2.0.2

History Node

2.0.1

History Node

2.0.0

History Node

1.6.4

History Node

1.6.3

History Node

1.6.2

History Node

1.6.1

History Node

1.6.0

History Node

1.5.5

History Node

1.5.4

History Node

1.5.3

History Node

1.5.2

History Node

1.5.1

History Node

1.5.0

History Node

1.4.1

History Node

1.4.0

History Node

1.3.6

History Node

1.3.5

History Node

1.3.4

History Node

1.3.3

History Node

1.3.2

History Node

1.3.1

History Node

1.3.0

History Node

1.2.0

History Node

1.1.3

History Node

1.1.2

History Node

1.1.1

History Node

1.1.0

History Node

1.0.7

History Node

1.0.6

History Node

1.0.5

History Node

1.0.4

History Node

1.0.3

History Node

1.0.2

History Node

1.0.1

History Node

1.0.0

History Node

0.9.2

History Node

0.9.1

History Node

0.9.0

History Node

0.8.4

History Node

0.8.3

History Node

0.8.2

History Node

0.8.1

History Node

0.8.0

History Node

0.7.4

History Node

0.7.3

History Node

0.7.2

History Node

0.7.1

History Node

0.7.0

History Node

0.6.0

History Node

0.5.2

History Node

0.5.1

History Node

0.5.0

History Node

0.4.6

History Node

0.4.5

History Node

0.4.4

History Node

0.4.3

History Node

0.4.2

History Node

0.4.1

History Node

0.4

This version
History Node

0.4c1

History Node

0.3

History Node

0.2.1

History Node

0.2.0

History Node

0.1.0

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
pulsar-0.4c1.tar.gz (232.1 kB) Copy SHA256 hash SHA256 Source None Sep 7, 2012

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page