{ "info": { "author": "Bohuslav \"Slavek\" Kabrda", "author_email": "bkabrda@redhat.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)", "Operating System :: POSIX :: Linux", "Programming Language :: Python" ], "description": "DevAssistant PingPong\n=====================\n\nLibrary implementing protocol used for communication between DevAssistant and PingPong\nscripts (a.k.a. executable assistants). The protocol specification can be found at TODO:link.\n\nNote that this library implements both \"server\" and \"client\" side. The \"server\" side\nis only used by DevAssistant itself. If you're considering implementing a DevAssistant\nPingPong library for another language, you just need to implement the \"client\" side.\n\nUsage\n-----\n\nTo write a simple PingPong script, you need to create a minimal Yaml assistant,\nthat specifies metadata, dependencies needed to run the PingPong script (which\nis a Python 3 script in this case)::\n\n fullname: PingPong script example\n description: A simple PingPong script using DevAssistant PingPong protocol\n\n dependencies:\n # TODO: once dapp library is on PyPI/packaged in Fedora, it should also be added to list of deps\n - rpm: [python3]\n\n args:\n name:\n flags: [-n, --name]\n help: Please provide your name.\n\n files:\n script: &script\n source: script.py\n\n run:\n - pingpong: python3 *script\n\nLet's assume that the above assistant is ``~/.devassistant/assistants/crt/test.yaml``. The\ncorresponding PingPong script has to be ``~/.devassistant/files/crt/test/script.py``\nand can look like this::\n\n #!/usr/bin/python3\n import dapp\n\n class MyScript(dapp.DAPPClient):\n def run(self, ctxt):\n if 'name' in ctxt:\n name = ctxt['name'].capitalize()\n else:\n name = 'Stranger'\n self.call_command(ctxt, 'log_i', 'Hello {n}!'.format(n=name))\n return (True, 'I greeted him!')\n\n if __name__ == '__main__':\n MyScript().pingpong()\n\nThings to Note\n--------------\n\n- The PingPong script class has to subclass ``dapp.DAPPClient``.\n- The ``run`` method has to accept two arguments, ``self`` (Python specific argument pointing to\n the object) and ``ctxt``. The ``ctxt`` is a dict (Python mapping type) that holds the global\n context of the Yaml DSL (e.g. it contains the ``name`` argument, if it was specified by user\n on command line/in GUI).\n- You can utilize DevAssistant commands [1] by calling ``call_command`` method. This takes three\n arguments - global context, *command type* and *command input*. The first is (possibly modified)\n context that was passed to the ``run`` method and the other two are the same as explained at [1].\n- The ``ctxt`` dict can possibly get modified by running the command, check documentation of every\n specific command to see what it does and whether it modifies anything in the global context.\n- The ``call_command`` method returns a 2-tuple - *logical result* and *result* of the command.\n Again, these are documented for all commands at [1].\n- The ``run`` method has to return a 2-tuple - a *logical result* (e.g. ``True/False``) and a\n *result*, just as any other command would.\n- If you want the assistant to modify the global context, just modify the ``ctxt`` variable.\n All commands that you possibly run after ``pingpong`` in the Yaml file will then see all\n the modifications that you did.\n- Note, that to actually start the PingPong script, you have to call ``pingpong()`` method\n of the script class, **not** the ``run()`` method.\n\n\n[1] http://docs.devassistant.org/en/latest/developer_documentation/command_reference.html", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "UNKNOWN", "keywords": "devassistant,pipe,protocol,pingpong", "license": "GPLv2+", "maintainer": null, "maintainer_email": null, "name": "dapp", "package_url": "https://pypi.org/project/dapp/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/dapp/", "project_urls": { "Download": "UNKNOWN", "Homepage": "UNKNOWN" }, "release_url": "https://pypi.org/project/dapp/0.3.0/", "requires_dist": null, "requires_python": null, "summary": "Library implementing DevAssistant PingPong protocol", "version": "0.3.0" }, "last_serial": 1251801, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "19b238b8a5e69a0997e3b7a9d225eecd", "sha256": "cf361614b557acd89fc95df819e0027e40f99512d0f04f39520c72c8c527636e" }, "downloads": -1, "filename": "dapp-0.1.0.tar.gz", "has_sig": false, "md5_digest": "19b238b8a5e69a0997e3b7a9d225eecd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16871, "upload_time": "2014-10-04T10:03:11", "url": "https://files.pythonhosted.org/packages/8d/9a/fc9cf0225e7ffde656a34a14d0857017a7ca5b244e77540897907c45b6af/dapp-0.1.0.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "ec8bfaeb5977cb3ad567f44f097b37d6", "sha256": "0851fe6c9687d845a1e9d6e6557b1f4abb568ce3d265fab1c13223390a8d77e3" }, "downloads": -1, "filename": "dapp-0.2.0.tar.gz", "has_sig": false, "md5_digest": "ec8bfaeb5977cb3ad567f44f097b37d6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17678, "upload_time": "2014-10-06T09:39:29", "url": "https://files.pythonhosted.org/packages/79/78/d0a6228057738b5dd9df91e2b0905335f2f91207a67cdae30aa1fc0fb588/dapp-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "047b6ff4a20533a7cb7fe3e61c880b29", "sha256": "9d322bcf9773a1700fcbcbbfb8f1e6b7ee58c7be7181d625557ec8909b3fa09f" }, "downloads": -1, "filename": "dapp-0.2.1.tar.gz", "has_sig": false, "md5_digest": "047b6ff4a20533a7cb7fe3e61c880b29", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17708, "upload_time": "2014-10-06T11:42:37", "url": "https://files.pythonhosted.org/packages/2b/54/8eecbab33d2f6328efb743225e9d81ab047d30756b8eb614c98d739f353a/dapp-0.2.1.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "b0ef41b04cac206a888de7c29adf3c26", "sha256": "ff69da1f3f562db7a000b1a492bbfcedbc104c020c33e22540df7deb9b0709d0" }, "downloads": -1, "filename": "dapp-0.3.0.tar.gz", "has_sig": false, "md5_digest": "b0ef41b04cac206a888de7c29adf3c26", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17690, "upload_time": "2014-10-08T13:26:45", "url": "https://files.pythonhosted.org/packages/22/9b/641450341fa0033cba8689a8c8bd827f761a28c19ef3a85946fcf0ba6fac/dapp-0.3.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "b0ef41b04cac206a888de7c29adf3c26", "sha256": "ff69da1f3f562db7a000b1a492bbfcedbc104c020c33e22540df7deb9b0709d0" }, "downloads": -1, "filename": "dapp-0.3.0.tar.gz", "has_sig": false, "md5_digest": "b0ef41b04cac206a888de7c29adf3c26", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17690, "upload_time": "2014-10-08T13:26:45", "url": "https://files.pythonhosted.org/packages/22/9b/641450341fa0033cba8689a8c8bd827f761a28c19ef3a85946fcf0ba6fac/dapp-0.3.0.tar.gz" } ] }