This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
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.

Usage

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

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

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

files:
  script: &script
    source: script.py

run:
- 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/script.py and can look like this:

#!/usr/bin/python3
import dapp

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

if __name__ == '__main__':
    MyScript().pingpong()

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.

[1] http://docs.devassistant.org/en/latest/developer_documentation/command_reference.html

Release History

Release History

0.3.0

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.2.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.2.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
dapp-0.3.0.tar.gz (17.7 kB) Copy SHA256 Checksum SHA256 Source Oct 8, 2014

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development 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