{ "info": { "author": "Daniel Lindsley", "author_email": "daniel@toastdriven.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3" ], "description": "==========\nFriendlyDB\n==========\n\n``friendlydb`` is a small & fast following/followers database written in\nPython. It can be either used directly from your Python code or over HTTP\nwith small web API.\n\nFriendlyDB isn't meant to be a full user system; it should be used to augment\nan existing system to track relationships.\n\n\nWARNING\n=======\n\nStarting with v2.0.0, FriendlyDB is **NOT** backward-compatible with v0.4.0 &\nbefore. Prior to v2.0.0, data was stored on the filesystem, but in v2.0.0 &\nlater, data is stored in Redis.\n\nIt was rewritten to use Redis for several reasons:\n\n* Better performance\n* Less wear/tear on hard disks\n* Simpler code\n\nHowever, this does mean you will need to run your own version of the Redis\nserver (2.6.4+ recommended).\n\nSee below if you need to migrate from an older install to v2.0.0.\n\n\nUsage\n=====\n\nUsing FriendlyDB from Python looks like::\n\n from friendlydb.db import FriendlyDB\n\n # Start using the DB (assumes Redis default host/port/db).\n fdb = FriendlyDB()\n # Alternatively, ``fdb = FriendlyDB(host='127.0.0.2', port=7100, db=3)``\n\n # Grab a user by their username.\n daniel = fdb['daniel']\n\n # Follow a couple users.\n daniel.follow('alice')\n daniel.follow('bob')\n daniel.follow('joe')\n\n # Check the following.\n daniel.following()\n # Returns:\n # [\n # 'alice',\n # 'bob',\n # 'joe',\n # ]\n\n # Check joe's followers.\n fdb['joe'].followers()\n # Returns:\n # [\n # 'daniel',\n # ]\n\n # Unfollow.\n daniel.unfollow('bob')\n\n # Check the following.\n daniel.following()\n # Returns:\n # [\n # 'alice',\n # 'joe',\n # ]\n\n # Dust off & nuke everything from orbit.\n fdb.clear()\n\nUsing FriendlyDB from HTTP looks like (all trailing slashes are optional)::\n\n # In one shell, start the server.\n python friendlydb/server.py -d /tmp/friendly\n\n # From another, run some URLs.\n curl -X GET http://127.0.0.1:8008/\n # {\"version\": \"0.3.0\"}\n\n curl -X GET http://127.0.0.1:8008/daniel/\n # {\"username\": \"daniel\", \"following\": [], \"followers\": []}\n\n curl -X POST http://127.0.0.1:8008/daniel/follow/alice/\n # {\"username\": \"daniel\", \"other_username\": \"alice\", \"followed\": true}\n curl -X POST http://127.0.0.1:8008/daniel/follow/bob/\n # {\"username\": \"daniel\", \"other_username\": \"bob\", \"followed\": true}\n curl -X POST http://127.0.0.1:8008/daniel/follow/joe/\n # {\"username\": \"daniel\", \"other_username\": \"joe\", \"followed\": true}\n\n curl -X POST http://127.0.0.1:8008/daniel/unfollow/joe/\n # {\"username\": \"daniel\", \"other_username\": \"joe\", \"unfollowed\": true}\n\n curl -X GET http://127.0.0.1:8008/daniel/\n # {\"username\": \"daniel\", \"following\": [\"alice\", \"bob\"], \"followers\": []}\n\n curl -X GET http://127.0.0.1:8008/daniel/is_following/alice/\n # {\"username\": \"daniel\", \"other_username\": \"alice\", \"is_following\": true}\n\n curl -X GET http://127.0.0.1:8008/alice/is_followed_by/daniel/\n # {\"username\": \"alice\", \"other_username\": \"daniel\", \"is_followed_by\": true}\n\n curl -X GET http://127.0.0.1:8008/alice/is_followed_by/joe/\n # {\"username\": \"alice\", \"other_username\": \"joe\", \"is_followed_by\": false}\n\n\nRequirements\n============\n\n* Python 2.6+ or Python 3.3+\n* redis.py >= 2.7.2\n* (Optional) gevent for the HTTP server\n* (Optional) unittest2 for running tests\n\n\nInstallation\n============\n\nUsing pip, you can install it with ``pip install friendlydb``.\n\n\nPerformance\n===========\n\nYou can scope out FriendlyDB's performance for yourself by running the\nincluded ``benchmark.py`` script.\n\nIn tests on a 2011 MacBook Pro (i7), the benchmark script demonstrated:\n\n* created 1,000,000 relationships between 10,000 users: 179 seconds (~2.5X faster than 0.4.0)\n* avg time to fetch a user's followers: 0.0016 seconds\n* never exceeding 41Mb of RAM RSS\n\n\nMigrating from v0.4.0 to 2.0.0\n==============================\n\nFirst, install & run the Redis server.\n\nSecond, run ``pip install redis>=2.7.2``.\n\nTo migrate your data, the easiest way is to leave your old install of FriendlyDB\nin place (using the HTTP server), create a new install w/ Redis, then run\ncode like::\n\n import requests\n import json\n # The new version.\n from friendlydb import FriendlyDB\n\n old_url = 'http://127.0.0.1:8008/'\n fdb = FriendlyDB()\n\n for username in users:\n user = fdb[username]\n\n # Following.\n resp = requests.get(\"{0}/{1}/following/\".format(old_url, username))\n data = json.loads(resp.content)\n\n for f_username in data.get(\"following\", []):\n user.follow(f_username)\n\nYou should create your own script & verify your data post-migration. No promises\nare made about the effectiveness/accuracy of the above code.\n\n\nRunning Tests\n=============\n\n``friendlydb`` is maintained with passing tests at all times. Simply run::\n\n python -m unittest2 tests\n\n\nContributions\n=============\n\nIn order for a contribution to be considered for merging, it must meet the\nfollowing requirements:\n\n* Patch cleanly solves the problem\n* Added test coverage (now passing) to expose the bug & check for regression\n* If the behavior affects end-users, there must be docs on the changes\n* The patch/tests must be compatibly licensed with New BSD\n\nThe best way to submit contributions is by forking the project on Github,\napplying your changes *on a new branch*, pushing those changes back to GH &\nsubmitting a pull request through the GitHub interface.\n\n\nLicense\n=======\n\nNew BSD license.\n\n:author: Daniel Lindsley\n:version: 2.0.0\n:date: 2013-01-17", "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/toastdriven/friendlydb", "keywords": null, "license": "UNKNOWN", "maintainer": null, "maintainer_email": null, "name": "friendlydb", "package_url": "https://pypi.org/project/friendlydb/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/friendlydb/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://github.com/toastdriven/friendlydb" }, "release_url": "https://pypi.org/project/friendlydb/2.0.0/", "requires_dist": null, "requires_python": null, "summary": "A small & fast following/followers database.", "version": "2.0.0" }, "last_serial": 934507, "releases": { "0.2.0": [ { "comment_text": "", "digests": { "md5": "184dd1225af0ec040dd9a4f6fa760d2d", "sha256": "37b64d412087f0a67f4c0bb4d5c78980b130dfc64004d6cd649c8988e33693b6" }, "downloads": -1, "filename": "friendlydb-0.2.0.tar.gz", "has_sig": false, "md5_digest": "184dd1225af0ec040dd9a4f6fa760d2d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5720, "upload_time": "2012-01-07T07:02:51", "url": "https://files.pythonhosted.org/packages/b4/86/733bc71de1c4f5aa7f47d65c3b1eac44e65de5d3f5f1304e61684a826eef/friendlydb-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "97e938e51ec54fd680cacd67104081ab", "sha256": "1df4e968f7960353774b0fd5f9949eaa05ab22b3a70cadd528b1f62e6d11bc67" }, "downloads": -1, "filename": "friendlydb-0.2.1.tar.gz", "has_sig": false, "md5_digest": "97e938e51ec54fd680cacd67104081ab", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5714, "upload_time": "2012-01-07T08:11:51", "url": "https://files.pythonhosted.org/packages/07/64/2c769e71ea2bc471fbce29663eaa4eb254c29b3588258632b169cc673886/friendlydb-0.2.1.tar.gz" } ], "0.2.2": [ { "comment_text": "", "digests": { "md5": "02fbf3399e98a3d1e8137068849e6ad2", "sha256": "416b3941f45d6444134622f41bf6ae5a84537c800af6e2b64bc66e839b792434" }, "downloads": -1, "filename": "friendlydb-0.2.2.tar.gz", "has_sig": false, "md5_digest": "02fbf3399e98a3d1e8137068849e6ad2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5929, "upload_time": "2012-01-07T08:11:58", "url": "https://files.pythonhosted.org/packages/ad/2b/9db4bcdd6aaac268a0d50e74bcf9d2fe0b35439c400afc8d74fef16cf5e0/friendlydb-0.2.2.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "fa69baaca5fd702ba41b639718e01a65", "sha256": "270d92117959b1c746122c5a8c515cd8df7944efbaefd60f99c81a7efd5f0f62" }, "downloads": -1, "filename": "friendlydb-0.3.0.tar.gz", "has_sig": false, "md5_digest": "fa69baaca5fd702ba41b639718e01a65", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7493, "upload_time": "2012-01-07T09:51:06", "url": "https://files.pythonhosted.org/packages/d3/7f/88de4c154babaf88f9969289feaba7d205d664c7bcf107a4c54f17bce6e8/friendlydb-0.3.0.tar.gz" } ], "0.3.1": [ { "comment_text": "", "digests": { "md5": "3b46b09b20b902064d647ca9a8e73084", "sha256": "7d220f6d8690b1072d787e1990f3675d18af16d25178c20255f121293c70b255" }, "downloads": -1, "filename": "friendlydb-0.3.1.tar.gz", "has_sig": false, "md5_digest": "3b46b09b20b902064d647ca9a8e73084", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7493, "upload_time": "2012-01-07T21:27:30", "url": "https://files.pythonhosted.org/packages/f4/46/3100b6636e337baf9f68bc718c16a631c8513e10f6195c6b01b84b3366e9/friendlydb-0.3.1.tar.gz" } ], "0.4.0": [ { "comment_text": "", "digests": { "md5": "c804e377cddc668fce648cdb0ac205e0", "sha256": "22aca8424b6343f43e7d38759a25c603becabfdc6f729310f84d593dec344f08" }, "downloads": -1, "filename": "friendlydb-0.4.0.tar.gz", "has_sig": false, "md5_digest": "c804e377cddc668fce648cdb0ac205e0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7648, "upload_time": "2012-01-30T14:19:16", "url": "https://files.pythonhosted.org/packages/4e/4d/f9b34ed4ae0a3f67041262b49abef6b1e8d6041ba5a2539cc83e425abe04/friendlydb-0.4.0.tar.gz" } ], "2.0.0": [ { "comment_text": "", "digests": { "md5": "17f329ac3f42a52f1f8133c99dba096c", "sha256": "ff1518a1ca46bd232047e606e26cf50c140f2a7585db46fa97f15004efb948e8" }, "downloads": -1, "filename": "friendlydb-2.0.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "17f329ac3f42a52f1f8133c99dba096c", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 10071, "upload_time": "2013-12-03T09:46:31", "url": "https://files.pythonhosted.org/packages/49/ce/c32122d48be16f4f87b7368dbfe1c223f697aa36db6e934d13c8ec75f473/friendlydb-2.0.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "5d83e363f4e1e8d3446e0afb9df3f926", "sha256": "adff800b9fa956e55d4f2e50ba33b37aabf1f5692d2a7e1806a96db74608212a" }, "downloads": -1, "filename": "friendlydb-2.0.0.tar.gz", "has_sig": false, "md5_digest": "5d83e363f4e1e8d3446e0afb9df3f926", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7094, "upload_time": "2013-01-17T10:54:23", "url": "https://files.pythonhosted.org/packages/d0/20/b6fe8ae1bb115b93d4f58cdc5e17c8bb83de54fe4bb88f30a3008ff5f8bf/friendlydb-2.0.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "17f329ac3f42a52f1f8133c99dba096c", "sha256": "ff1518a1ca46bd232047e606e26cf50c140f2a7585db46fa97f15004efb948e8" }, "downloads": -1, "filename": "friendlydb-2.0.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "17f329ac3f42a52f1f8133c99dba096c", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 10071, "upload_time": "2013-12-03T09:46:31", "url": "https://files.pythonhosted.org/packages/49/ce/c32122d48be16f4f87b7368dbfe1c223f697aa36db6e934d13c8ec75f473/friendlydb-2.0.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "5d83e363f4e1e8d3446e0afb9df3f926", "sha256": "adff800b9fa956e55d4f2e50ba33b37aabf1f5692d2a7e1806a96db74608212a" }, "downloads": -1, "filename": "friendlydb-2.0.0.tar.gz", "has_sig": false, "md5_digest": "5d83e363f4e1e8d3446e0afb9df3f926", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7094, "upload_time": "2013-01-17T10:54:23", "url": "https://files.pythonhosted.org/packages/d0/20/b6fe8ae1bb115b93d4f58cdc5e17c8bb83de54fe4bb88f30a3008ff5f8bf/friendlydb-2.0.0.tar.gz" } ] }