About

Pysig is a framework designed to manage event dispatching between two or more registered endpoints. The main philosophy behind a signaling framework, like pysig is, is to simplify the process by whitch a certain endpoint receives events from another, in an efficient and simple way.

One of the most interesting features of pysig is that it has the ability to dispatch messages over network, between different machines or different processes running on the same machine.

Feature set

To make a very short summary of what pysig can do, we could list the followings:

  • it enables subscription mechanisms that are able to:
    • register for a specific event triggered by a specific sender
    • register for broadcast events triggered by any event fired by a specific sender
    • register for broadcast events triggered by any event of any sender
    • register for channel events triggered by those senders that share same event
    • register listeners without depending on the sender registration
  • supports firing on-demand requests to connected senders, for accessing data on reply

  • stateful sender connection, automatically firing connect and disconnect events

  • distribute events intra-process, inter-process or over a given network

  • built-in TCP server and TCP client implementation with customizable date encoding (default JSON)

  • permits custom transport carrier implementation for dispatching events over different communication mediums (like serial connections) or for transporting them under a different format

Installation

You can install pysig library using python pip installer:

pip install pysig

Or checkout the latest version from bitbucket using:

hg clone https://bitbucket.org/madlex/pysig

Previously released versions are tagged on hg, so to list them use:

hg tags

For example, for checking the code corresponding to 0.7.1 version:

hg update 0.7.1

Using latest

To always use the latest version in your python applications, or a version of your choice, on Linux you can add a symlink in the location where python keeps it’s packages.

For example:

mkdir ~/code
cd ~/code
hg clone https://bitbucket.org/madlex/pysig
# hg update <insert_your_desired_version_here> # optional
sudo ln -s ~/code/pysig/sig /usr/local/lib/python2.7/dist-packages/sig

Next time you update your repository at ~/code/pysig all your python applications will automatically import the latest sig module.

Examples

Throughout this documentation, several examples are provided inline, but most of them are stored in the /examples folder, as ready to use applications.

For signaling events locally please see this:

Example

For examples on how to implement a pysig server or a pysig client, how to register a sender that triggers an event over a network, a sender that supports responding to requests and last but not least, how to register remote listeners please check this section:

Examples

Changelog

The current version of pysig is 0.7.3.

0.7.3
  • improved overall documentation
  • refactored requests support
  • added generic_client_request.py example
  • when a sender connects/disconnects the automatically triggered #connect/#disconnect event promotes the list of events and requests the sender supports using the data parameter (use data[“events”] and data[“requests”] to fetch the list)
0.7.1
  • Initial version

Future roadmap

Until pysig reaches it’s first stable version, which will be 1.0.0, the author reserves the right of changing the API if it’s necessary. From version 1.0.0 all the versions of pysig sharing the same major number will be API compatible.

The modifications targeted for 1.0.0 version are:

  • improve coverage of unit-tests
  • improve multi-threading support
  • improve ServerRouter and ClientRouter implementation
  • improve CarrierTCPClient and CarrierTCPServer implementation
  • improve examples
  • improve overall documentation structure
  • add validation of communication protocol between ServerRouter and ClientRouter
  • add SSL support to built-in TCP carriers
  • add support for using multiple carriers at once for the very same server

Far fetched objectives:

  • add ACL (Access Control List) support, for allowing access only to some listeners

Licence

The pysig library is released under the terms and conditions of MIT Licence. For further documentation please check the LICENCE.txt file located at the root of the repository.

Authors

Library develop and maintained by Alex Mircescu.

For feature requests or comments please address to mircescu [at] gmail.com.