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!

Library implementing DevAssistant PingPong protocol

Project Description

Library implementing protocol used for communication between DevAssistant and PingPong scripts (a.k.a. executable assistants). The protocol specification can be found at TODO:link.

Note that this library implements both “server” and “client” side. The “server” side is only used by DevAssistant itself. If you’re considering implementing a DevAssistant PingPong library for another language, you just need to implement the “client” side.


To write a simple PingPong script, you need to create a minimal Yaml assistant, that specifies metadata, dependencies needed to run the PingPong script (which is a Python 3 script in this case):

fullname: PingPong script example
description: A simple PingPong script using DevAssistant PingPong protocol

# TODO: once dapp library is on PyPI/packaged in Fedora, it should also be added to list of deps
- rpm: [python3]

    flags: [-n, --name]
    help: Please provide your name.

  script: &script

- pingpong: python3 *script

Let’s assume that the above assistant is ~/.devassistant/assistants/crt/test.yaml. The corresponding PingPong script has to be ~/.devassistant/files/crt/test/ and can look like this:

import dapp

class MyScript(dapp.DAPPClient):
    def run(self, ctxt):
        if 'name' in ctxt:
            name = ctxt['name'].capitalize()
            name = 'Stranger'
        self.call_command(ctxt, 'log_i', 'Hello {n}!'.format(n=name))
        return (True, 'I greeted him!')

if __name__ == '__main__':

Things to Note

  • The PingPong script class has to subclass dapp.DAPPClient.
  • The run method has to accept two arguments, self (Python specific argument pointing to the object) and ctxt. The ctxt is a dict (Python mapping type) that holds the global context of the Yaml DSL (e.g. it contains the name argument, if it was specified by user on command line/in GUI).
  • You can utilize DevAssistant commands [1] by calling call_command method. This takes three arguments - global context, command type and command input. The first is (possibly modified) context that was passed to the run method and the other two are the same as explained at [1].
  • The ctxt dict can possibly get modified by running the command, check documentation of every specific command to see what it does and whether it modifies anything in the global context.
  • The call_command method returns a 2-tuple - logical result and result of the command. Again, these are documented for all commands at [1].
  • The run method has to return a 2-tuple - a logical result (e.g. True/False) and a result, just as any other command would.
  • If you want the assistant to modify the global context, just modify the ctxt variable. All commands that you possibly run after pingpong in the Yaml file will then see all the modifications that you did.
  • Note, that to actually start the PingPong script, you have to call pingpong() method of the script class, not the run() method.


Release History

This version
History Node


History Node


History Node


History Node


Download Files

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

File Name & Hash SHA256 Hash Help Version File Type Upload Date
(17.7 kB) Copy SHA256 Hash SHA256
Source Oct 8, 2014

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting