{ "info": { "author": "Keybase Engineering Team", "author_email": "alex@keyba.se", "bugtrack_url": null, "classifiers": [ "Framework :: Robot Framework :: Library", "Framework :: Robot Framework :: Tool", "License :: OSI Approved :: BSD License", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3 :: Only" ], "description": "# pykeybasebot\n\n[![PyPI](https://img.shields.io/pypi/v/pykeybasebot)](https://pypi.org/project/pykeybasebot/)\n\nThis is the officially support Keybase Python library. It is an unopinionated, simple wrapper around the Keybase CLI API for creating an interactive bot or general scripting. This library does not attempt to do intent parsing or manage state at all. You'll have to build that yourself, but with the examples, this library will hopefully make whatever you want to build much much easier `:)`.\n\nThere are also similar libraries for [JavaScript](https://github.com/keybase/keybase-bot) and [Go](https://github.com/keybase/pykeybasebot).\n\nThis library is very far from exhaustively covering the complete Keybase API, but it is our hope that it will be easy to add to (see chat_client.py for the pattern). It currently does reading from channels and writing messages/reactions pretty well. That's enough for the vast majority of basic functionality. Future work can add teams behavior, more wallet functionality (e.g. sending money), ...\n\n## Installation\n\n```\npip install pykeybasebot\n```\n\nPython 3.7 or greater, please. And it's all async, so you'll need to call into it with that in mind.\n\n## Setup\n\nGenerally speaking, here's what you need to do:\n\n1. Create a handler function that takes event objects and does something with them. This function will get called with your bot instance (described below) and the KbEvent instance.\n2. Create a bot. You _must_ initialize this with the handler function to call with each event. You _may_ optionally pass in: (1) the username and/or paperkey for the bot's identity (it'll default to the currently logged-in user otherwise), (1) the event loop that you want new tasks to be sent to (this is necessary if you want to lock on async behavior -- see the examples), (2) the location of the running keybase app (defaults to `keybase` which is fine if it's in your PATH), your user's home directory, or pid_file. These three are more useful for complicated local development with multiple accounts and less useful if you're running in a docker container or as the only user on your system.\n3. If you are not already running on a logged-in device, you need to do that. We recommend doing this with the `oneshot` command. It's in the examples.\n4. start the bot inside the asyncio event loop. This bot command wraps `keybase chat api-listen`, (and it takes basically the same exact options) and fires off events to your handler function.\n\n## Examples\n\nDefinitely definitely check out the examples. We're really counting on them to make it clear how to use this library.\n\n## Contributing\n\nPRs are extremely welcome. To start:\n\n```\ngit clone https://github.com/keybase/pykeybasebot\ncd pykeybasebot\n```\n\nWe use [Poetry](https://poetry.eustace.io/) to handle our packaging. Go check out their website for installation instructions. To start Poetry, you'll need the `python` executable in your path to link to Python 3.7. We recommend using [pyenv](https://github.com/pyenv/pyenv) to handle different versions of Python on your machine. With pyenv installed, it should automatically set `python` to 3.7 when you `cd` into this repo.\n\nOnce you have the right Python version, you can run:\n\n```\npip install poetry\npoetry install\n```\n\nThis will set up a virtualenv for you and install all the dependencies needed into it!\n\n### Static code analysis tools\n\nWe use a few different static analysis tools to perform linting, type-checking, formatting, etc. The correct versions should be install when you run `poetry install`, but you'll probably want to configure your editor to work with:\n\n- [mypy](http://www.mypy-lang.org/) (Type checking)\n- [black](https://github.com/psf/black) (code formatting)\n- [isort](https://github.com/timothycrosley/isort) (import formatting)\n- [flake8](http://flake8.pycqa.org) (linting)\n\n#### pre-commit hooks\n\nWe check all git commits with the above tools with\n[pre-commit.com](http://pre-commit.com) pre-commit hooks.\nTo enable use of these pre-commit hooks:\n\n- [Install](http://pre-commit.com/#install) the `pre-commit` utility.\n- Remove any existing pre-commit hooks via `rm .git/hooks/pre-commit`\n- Configure via `pre-commit install`\n\nThen proceed as normal.\n\n### Testing\n\nTo run tests, type\n\n```\nmake test\n```\n\nTests are admittedly weak. You could change that!\n\n### Types\n\nMost of the types the bot uses are generated from definitions defined in the [`protocol/`](https://github.com/keybase/client/tree/master/protocol) directory inside the Keybase client repo. This ensures that the types that the bot uses are consistent across bots and always up to date with the output of the API.\n\nTo build the types for the Python bot, you'll need to clone the `client` repo. This requires [Go](https://golang.org/) and your [GOPATH](https://github.com/golang/go/wiki/SettingGOPATH) to be set up.\n\n```shell\ngo get github.com/keybase/client/go/keybase\n```\n\nand install the necessary dependencies for compiling the protocol files. This requires [node.js](https://nodejs.org) and [Yarn](https://yarnpkg.com).\n\n```shell\ncd client/protocol\nyarn install\n```\n\nThen you can generate the types by using the provided Makefile in this repo.\n\n```shell\ncd path/to/keybase-bot\nmake types\n```\n\nShould you need to remove all the types for some reason, you can run `make clean`.\n\n### Publishing\n\nPoetry can build and publish packages to PyPI. We've run into some issues with uploading to PyPI and Poetry, though, so for now we're recommending building with Poetry and uploading with Twine.\n\n```shell\npoetry build\n# Upload to Test PyPi. You only need to run the first command once\npoetry config repositories.testpypi https://test.pypi.org/legacy/\npoetry publish -r testpypi\n# Upload to real PyPi\npoetry publish\n```\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/keybase/pykeybasebot", "keywords": "", "license": "BSD-3-Clause", "maintainer": "Keybase Engineering Team", "maintainer_email": "alex@keyba.se", "name": "pykeybasebot", "package_url": "https://pypi.org/project/pykeybasebot/", "platform": "", "project_url": "https://pypi.org/project/pykeybasebot/", "project_urls": { "Homepage": "https://github.com/keybase/pykeybasebot" }, "release_url": "https://pypi.org/project/pykeybasebot/0.1.6/", "requires_dist": [ "dataclasses-json (>=0.3.2,<0.4.0)", "typing-extensions (>=3.7,<4.0)" ], "requires_python": ">=3.7,<4.0", "summary": "Officially supported Keybase python bot client library", "version": "0.1.6" }, "last_serial": 5850815, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "fade03eb2ae18337df067d5abca4e29b", "sha256": "9d68bb1c035dc02f3456917730b9bb223e66743d317575963788c566dae3cd8d" }, "downloads": -1, "filename": "pykeybasebot-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "fade03eb2ae18337df067d5abca4e29b", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 9594, "upload_time": "2019-06-05T15:18:13", "url": "https://files.pythonhosted.org/packages/6c/e2/f293f64ac6396a35af39b768200c9c91969cff56f2c43007ad548f7c86ae/pykeybasebot-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a8b7d0f95c7b7cbf7129c35197b9ef07", "sha256": "d0a7a218574ae3e57af24c95d86e79f793b7a836a29cb7d0415fadbfa7a12845" }, "downloads": -1, "filename": "pykeybasebot-0.1.0.tar.gz", "has_sig": false, "md5_digest": "a8b7d0f95c7b7cbf7129c35197b9ef07", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7532, "upload_time": "2019-06-05T15:18:16", "url": "https://files.pythonhosted.org/packages/47/94/aa73ee5f48d3626e0013329a2cefc115c84401fb8200f20a25120f0919f9/pykeybasebot-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "9844a1097861f6caeba336e4d4d8640c", "sha256": "dba4fe7fb8effef98ba3ac3a5900a149e63916c103123e8a32ca2772a1dbcbb2" }, "downloads": -1, "filename": "pykeybasebot-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "9844a1097861f6caeba336e4d4d8640c", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 8899, "upload_time": "2019-06-05T15:49:50", "url": "https://files.pythonhosted.org/packages/8f/c1/6bae585073740153e4e6f36b0d483e8bd70d048414a5c94db446f764e05c/pykeybasebot-0.1.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "9d12754b7149062c1ece4d2fc464af4e", "sha256": "4711d9aeab784baacbd31a2e67f3a76d9c61082e01a1aae0040d6ede67d95991" }, "downloads": -1, "filename": "pykeybasebot-0.1.1.tar.gz", "has_sig": false, "md5_digest": "9d12754b7149062c1ece4d2fc464af4e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6803, "upload_time": "2019-06-05T15:49:51", "url": "https://files.pythonhosted.org/packages/cd/c7/46155e057d16271c4d6b32fd10544d49aafeb659e7094590d08a6e3d7751/pykeybasebot-0.1.1.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "9462fc3a8dc43a2e903f3d13250dafaf", "sha256": "03baf130b166d38ab35b859674811ff226a59663d9b9cdd98e70140ca9f02822" }, "downloads": -1, "filename": "pykeybasebot-0.1.3-py3-none-any.whl", "has_sig": false, "md5_digest": "9462fc3a8dc43a2e903f3d13250dafaf", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.7,<4.0", "size": 71491, "upload_time": "2019-09-06T19:46:12", "url": "https://files.pythonhosted.org/packages/7d/63/c0fc245d00e35e7b5c8d22060d7e7a4975c8aecf77bdc3d555c9a0b2741d/pykeybasebot-0.1.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "98506e6d46c243d662b7035eea7d786e", "sha256": "3aa59f57421c738b01888b1ee76dfe15d36fa6b464fffe44ff10145cf699a406" }, "downloads": -1, "filename": "pykeybasebot-0.1.3.tar.gz", "has_sig": false, "md5_digest": "98506e6d46c243d662b7035eea7d786e", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.7,<4.0", "size": 71497, "upload_time": "2019-09-06T19:46:14", "url": "https://files.pythonhosted.org/packages/0c/a8/a9e55d46ade6f96699e0c7c1865198641bc9b80f0b38496d3a73b247bf6a/pykeybasebot-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "b9c511a623b3b4b839c7d2fcb7c4b66f", "sha256": "6637ce7a8231920f9638c048326fe85e77500d4593e142bf42790eb6ba98fb0c" }, "downloads": -1, "filename": "pykeybasebot-0.1.4-py3-none-any.whl", "has_sig": false, "md5_digest": "b9c511a623b3b4b839c7d2fcb7c4b66f", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.7,<4.0", "size": 71570, "upload_time": "2019-09-07T20:02:56", "url": "https://files.pythonhosted.org/packages/4b/6c/467ec27b77ba70b322011a3b618829ec93534dd2a7e2f22fb39ca4b9743b/pykeybasebot-0.1.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "46459a43778af17edde9e3e3d6c3ceb2", "sha256": "ae639f45319597fce2e28ef9e4d94195adc38c8dce0b545b7841743eb40afbdd" }, "downloads": -1, "filename": "pykeybasebot-0.1.4.tar.gz", "has_sig": false, "md5_digest": "46459a43778af17edde9e3e3d6c3ceb2", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.7,<4.0", "size": 71581, "upload_time": "2019-09-07T20:02:58", "url": "https://files.pythonhosted.org/packages/b4/54/394c8f71ac8fa70910444e51ca99d78dc4636c093e5c8198e9b13b2219db/pykeybasebot-0.1.4.tar.gz" } ], "0.1.5": [ { "comment_text": "", "digests": { "md5": "8ee2683c9626e245f1c185443f193fd5", "sha256": "c9c5f3c06a2cbe9dfddba6c81f3f36cac8a4931ee6f0b088fdbd24f645a0f0b0" }, "downloads": -1, "filename": "pykeybasebot-0.1.5-py3-none-any.whl", "has_sig": false, "md5_digest": "8ee2683c9626e245f1c185443f193fd5", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.7,<4.0", "size": 71533, "upload_time": "2019-09-12T22:09:45", "url": "https://files.pythonhosted.org/packages/3e/39/34bc51e0446a55815650329b8c5300b5c9e43a8a4daf26e47026701b0fcd/pykeybasebot-0.1.5-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7978d918a19eb3a4b4715eec4d447eaa", "sha256": "253a67c8033fae9f99c11a26b7cf20c4c062c975752a8435145be3e0d608cc79" }, "downloads": -1, "filename": "pykeybasebot-0.1.5.tar.gz", "has_sig": false, "md5_digest": "7978d918a19eb3a4b4715eec4d447eaa", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.7,<4.0", "size": 71590, "upload_time": "2019-09-12T22:09:47", "url": "https://files.pythonhosted.org/packages/e9/84/1d79a8cc4d60424b99dec0a374d21b6256aaccd9745b483066bc13cb6d57/pykeybasebot-0.1.5.tar.gz" } ], "0.1.6": [ { "comment_text": "", "digests": { "md5": "a5cee597c706eff1b7b2bafee2a78fe5", "sha256": "eb2b3966790e20b84af7230069fb404a81d047c36f411153cfa75876220d38dd" }, "downloads": -1, "filename": "pykeybasebot-0.1.6-py3-none-any.whl", "has_sig": false, "md5_digest": "a5cee597c706eff1b7b2bafee2a78fe5", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.7,<4.0", "size": 71578, "upload_time": "2019-09-18T15:01:56", "url": "https://files.pythonhosted.org/packages/b7/e3/8b0f31974930ffe7c0ea4929d09125517441568de301371d1b94bf999c7d/pykeybasebot-0.1.6-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "1e2d46601a065a5c757e6f30603fe05e", "sha256": "4d06ab13d17be9a9bb2728d29c810ebb6a5cfd37c524d05f4e7d92026cb154ea" }, "downloads": -1, "filename": "pykeybasebot-0.1.6.tar.gz", "has_sig": false, "md5_digest": "1e2d46601a065a5c757e6f30603fe05e", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.7,<4.0", "size": 71700, "upload_time": "2019-09-18T15:01:58", "url": "https://files.pythonhosted.org/packages/89/b1/b3de3f66795682f04c42c344bb8b4bf84e820731964d69a347212705b6b8/pykeybasebot-0.1.6.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "a5cee597c706eff1b7b2bafee2a78fe5", "sha256": "eb2b3966790e20b84af7230069fb404a81d047c36f411153cfa75876220d38dd" }, "downloads": -1, "filename": "pykeybasebot-0.1.6-py3-none-any.whl", "has_sig": false, "md5_digest": "a5cee597c706eff1b7b2bafee2a78fe5", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.7,<4.0", "size": 71578, "upload_time": "2019-09-18T15:01:56", "url": "https://files.pythonhosted.org/packages/b7/e3/8b0f31974930ffe7c0ea4929d09125517441568de301371d1b94bf999c7d/pykeybasebot-0.1.6-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "1e2d46601a065a5c757e6f30603fe05e", "sha256": "4d06ab13d17be9a9bb2728d29c810ebb6a5cfd37c524d05f4e7d92026cb154ea" }, "downloads": -1, "filename": "pykeybasebot-0.1.6.tar.gz", "has_sig": false, "md5_digest": "1e2d46601a065a5c757e6f30603fe05e", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.7,<4.0", "size": 71700, "upload_time": "2019-09-18T15:01:58", "url": "https://files.pythonhosted.org/packages/89/b1/b3de3f66795682f04c42c344bb8b4bf84e820731964d69a347212705b6b8/pykeybasebot-0.1.6.tar.gz" } ] }