{ "info": { "author": "Eric Florenzano", "author_email": "floguy@gmail.com", "bugtrack_url": null, "classifiers": [ "Environment :: Web Environment", "Programming Language :: Python", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "AwesomeStream\n=============\n\nAwesomeStream is a set of tools for creating a \"stream server\". That is, a\nserver which can store information about events that happen, and can query back\nthose events in reverse-chronological order, sliced in interesting ways.\n\nExample and Use Case\n====================\n\nSay that you run a website like GitHub, where people interact in various\ndifferent ways. People can create repositories, fork them, watch or unwatch\nrepositories, add friends, etc. There are all kinds of things that a user\ncan do on the site. Let's look at how AwesomeStream can help.\n\nFirst, we'll set up a simple redis-based server:\n\n >>> from awesomestream.backends import RedisBackend\n >>> from awesomestream.jsonrpc import create_app, run_server\n >>> backend = RedisBackend(\n ... keys=['user', 'kind', 'repo'],\n ... host='127.0.0.1',\n ... port=6379\n ... )\n >>> \n >>> app = create_app(backend)\n >>> run_server(app, 8080)\n\nThis simple script sets up a Redis-based AwesomeStream server--one that pays\nspecial attention to the 'user', 'kind', and 'repo' keys. This will make a\nbit more sense in a bit.\n\nIn another console, we're going to instantiate a client.\n\n >>> from awesomestream.jsonrpc import Client\n >>> c = Client('http://127.0.0.1:8080/')\n\nOK, now that we've set up our client, lets start logging user actions. Look,\na user has just created a new repo!\n\n >>> c.insert({\n ... 'kind': 'create-repo',\n ... 'repo': 17,\n ... 'user': 291,\n ... 'name': 'frist',\n ... 'description': 'This is my first repo ever!',\n ... })\n >>> \n\nBut the user made a mistake, and named it 'frist' instead of 'first'. So they\ngo ahead and delete it:\n\n >>> c.insert({\n ... 'kind': 'delete-repo',\n ... 'repo': 17,\n ... 'user': 291,\n ... 'reason': 'Made a typo :(',\n ... })\n >>> \n\nThen they give up and decide to watch another user's repo instead:\n\n >>> c.insert({'kind': 'watch', 'repo': 2842, 'user': 291, 'owner': 23})\n\nAnd finally they add that user as a friend:\n\n >>> c.insert({'kind': 'friend', 'user': 291, 'friend': 23})\n \nThat second user notices that someone is following them, and follows back:\n\n >>> c.insert({'kind': 'friend', 'user': 23, 'friend': 291})\n\nNow that we have data inserted into the stream server, we can query it to get\nback the full stream. Here's how something like that might look:\n\n >>> c.items()\n [{'kind': 'friend', 'user': 23, 'friend': 291},\n {'kind': 'friend', 'user': 291, 'friend': 23},\n {'repo': 2842, 'owner': 23, 'kind': 'watch', 'user': 291},\n {'repo': 17, 'kind': 'delete-repo', 'reason': 'Made a typo :(', 'user': 291},\n {'repo': 17, 'kind': 'create-repo', 'user': 291, 'name': 'frist', 'description': 'This is my first repo ever!'}\n ]\n\nAs you can see, we got the entire stream back, in reverse chronological order.\nBut let's say we want to filter this out, to only see 'friend' requests. We\ncan do that easily:\n\n >>> c.items(kind='friend')\n [{'kind': 'friend', 'user': 23, 'friend': 291},\n {'kind': 'friend', 'user': 291, 'friend': 23}\n ]\n\nNotice that they are still in reverse chronological order. We can also combine\nour predicates, to get only friend requests made by a specific user.\n\n >>> c.items(kind='friend', user=23)\n [{'kind': 'friend', 'user': 23, 'friend': 291}]\n\nBut an extremely common case is that you want to see only your activity\nthat is generated by your friends. With AwesomeStream, that's simple:\n\n >>> c.items(user=[23, 291])\n [{'kind': 'friend', 'user': 23, 'friend': 291},\n {'kind': 'friend', 'user': 291, 'friend': 23},\n {'repo': 2842, 'owner': 23, 'kind': 'watch', 'user': 291},\n {'repo': 17, 'kind': 'delete-repo', 'reason': 'Made a typo :(', 'user': 291},\n {'repo': 17, 'kind': 'create-repo', 'user': 291, 'name': 'frist', 'description': 'This is my first repo ever!'}\n ]\n\nAs you can see, every user ID passed into that list is retrieved. By default,\nthe items() function retrieves 20 items, but often times we'll need to\ncustomize that. Here's how that would look:\n\n >>> c.items(user=[23, 291], start=1, end=3)\n [{'kind': 'friend', 'user': 291, 'friend': 23},\n {'repo': 2842, 'owner': 23, 'kind': 'watch', 'user': 291}\n ]\n\nSupported Backends\n==================\n\n * In-Memory (mostly for testing)\n * SQL\n * Redis\n\nPlanned Support\n===============\n\n * CouchDB\n * Cassandra\n\nMaturity\n========\n\nI'm writing this for eventual deployment on http://radiosox.com/, but have not\nyet deployed it in production. Do so at your own risk.\n\nRequirements\n============\n\nShort Summary:\n\n Use pip, and do `pip install -U -r requirements.txt`\n\nLonger Summary:\n\n Strictly speaking, the only requirement is *simplejson*. That being said,\n if you want redis support, you need *redis* installed. If you want SQL\n support, you need *SQLAlchemy* installed. If you want support for creating\n a WSGI app to expose this over HTTP, you'll need *werkzeug* installed.\n Finally, if you want a simple, pure-python way of running that WSGI app,\n you'll want to install *cherrypy*.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/ericflo/awesomestream", "keywords": "json-rpc,stream,feed,werkzeug,cherrypy,sqlalchemy,redis", "license": "BSD", "maintainer": null, "maintainer_email": null, "name": "awesomestream", "package_url": "https://pypi.org/project/awesomestream/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/awesomestream/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://github.com/ericflo/awesomestream" }, "release_url": "https://pypi.org/project/awesomestream/0.1/", "requires_dist": null, "requires_python": null, "summary": "AwesomeStream makes awesome streams", "version": "0.1" }, "last_serial": 786647, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "faba9ebcb66b08373258337d8ce8dd8f", "sha256": "d8d8463063873d48a7f3febe026b759276362c055b66d8a6ec563acd56190887" }, "downloads": -1, "filename": "awesomestream-0.1.tar.gz", "has_sig": false, "md5_digest": "faba9ebcb66b08373258337d8ce8dd8f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8445, "upload_time": "2009-12-14T10:37:14", "url": "https://files.pythonhosted.org/packages/22/86/af5110968a47e0606ad1c54012db7b456b2e4a30a10b6ac032cdc5c42ba8/awesomestream-0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "faba9ebcb66b08373258337d8ce8dd8f", "sha256": "d8d8463063873d48a7f3febe026b759276362c055b66d8a6ec563acd56190887" }, "downloads": -1, "filename": "awesomestream-0.1.tar.gz", "has_sig": false, "md5_digest": "faba9ebcb66b08373258337d8ce8dd8f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8445, "upload_time": "2009-12-14T10:37:14", "url": "https://files.pythonhosted.org/packages/22/86/af5110968a47e0606ad1c54012db7b456b2e4a30a10b6ac032cdc5c42ba8/awesomestream-0.1.tar.gz" } ] }