{ "info": { "author": "Nathan Farrington", "author_email": "nfarring@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Other Environment", "Intended Audience :: Developers", "License :: OSI Approved :: GNU General Public License (GPL)", "Operating System :: OS Independent", "Programming Language :: Python", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: Software Development :: Object Brokering", "Topic :: System :: Distributed Computing" ], "description": "RedisRPC\n========\n\nby Nathan Farrington\n`http://nathanfarrington.com `_\n\nRedisRPC is the easiest to use RPC library in the world. (No small\nclaim!) It has implementations in Ruby, PHP, and Python.\n\nIntroduction\n------------\n\n`Redis `_ is a powerful in-memory data structure\nserver that is useful for building fast distributed systems. Redis\nimplements message queue functionality with its use of list data\nstructures and the ``LPOP``, ``BLPOP``, and ``RPUSH`` commands. RedisRPC\nimplements a lightweight RPC mechanism using Redis message queues to\ntemporarily hold RPC request and response messages. These messages are\nencoded as `JSON `_ strings for portability.\n\nMany other RPC mechanisms are either programming language specific (e.g.\n`Java\nRMI `_) or\nrequire boiler-plate code for explicit typing (e.g.\n`Thrift `_). RedisRPC was\ndesigned to be extremely easy to use by eliminating boiler-plate code\nwhile also being programming language neutral. High performance was not\nan initial goal of RedisRPC and other RPC libraries are likely to have\nbetter performance. Instead, RedisRPC has better programmer performance;\nit lets you get something working immediately.\n\nCalculator Example\n------------------\n\nEach library implementation uses the same client and server example\nbased off of a mutable calculator object. The clients and servers from\ndifferent languages are interoperable.\n\n.. figure:: http://github.com/nfarring/redisrpc/raw/master/docs/redisrpc_example.png\n :align: center\n :alt: \n\n#. The client issues an RPC Request by using the Redis ``RPUSH`` command\n to push an RPC Request message into a Redis list called ``calc``.\n#. The server retrieves the RPC Request message by using the Redis\n ``BLPOP`` command.\n#. The server dispatches the RPC Request to a local object, which in\n this case is a Calculator object.\n#. The server accepts the return value (or exception) from the\n Calculator object.\n#. The server issues an RPC Response by using the Redis ``RPUSH``\n command to push an RPC Response message into a Redis list called\n ``calc:rpc:``, which was chosen by the client.\n#. The client retrieves the RPC Response message by using the Redis\n ``BLPOP`` command.\n\n*Note that the server or client can be made non-blocking by using the\nRedis LPOP command instead of BLPOP. I currently do not need this\nfeature and have not added support for this, but patches are welcome.*\n\nThat's all there is to it!\n\nRuby Usage\n----------\n\nclient.rb\n~~~~~~~~~\n\n::\n\n redis_server = Redis.new\n message_queue = 'calc'\n calculator = RedisRPC::Client.new redis_server, 'calc'\n calculator.clr\n calculator.add 5\n calculator.sub 3\n calculator.mul 4\n calculator.div 2\n assert calculator.val == 4\n\nserver.rb\n~~~~~~~~~\n\n::\n\n redis_server = Redis.new\n message_queue = 'calc'\n local_object = Calculator.new\n server = RedisRPC::Server.new redis_server, message_queue, local_object\n server.run\n\nPHP Usage\n---------\n\n*Note that the PHP library does not currently support named function\narguments.*\n\nclient.php\n~~~~~~~~~~\n\n::\n\n $redis_server = new Predis\\Client();\n $message_queue = 'calc';\n $calculator = new RedisRPC\\Client($redis_server, $message_queue);\n $calculator->clr();\n $calculator->add(5);\n $calculator->sub(3);\n $calculator->mul(4);\n $calculator->div(2);\n assert($calculator->val() == 4);\n\nserver.php\n~~~~~~~~~~\n\n::\n\n $redis_server = new Predis\\Client();\n $message_queue = 'calc';\n $local_object = new Calculator();\n $server = new RedisRPC\\Server($redis_server, $message_queue, $local_object);\n $server->run();\n\nPython Usage\n------------\n\nclient.py\n~~~~~~~~~\n\n::\n\n redis_server = redis.Redis()\n message_queue = 'calc'\n calculator = redisrpc.Client(redis_server, message_queue)\n calculator.clr()\n calculator.add(5)\n calculator.sub(3)\n calculator.mul(4)\n calcaultor.div(2)\n assert calculator.val() == 4\n\nserver.py\n~~~~~~~~~\n\n::\n\n redis_server = redis.Redis()\n message_queue = 'calc'\n local_object = calc.Calculator()\n server = redisrpc.Server(redis_server, message_queue, local_object)\n server.run()\n\nInstallation\n------------\n\nRuby Installation\n~~~~~~~~~~~~~~~~~\n\nThe `redis-rb `_ library is\nrequired. Install using RubyGems:\n\n::\n\n gem install redisrpc\n\nPHP Installation\n~~~~~~~~~~~~~~~~\n\nThe `Predis `_ library is required.\n\nThe RedisRPC PHP library is available from\n`Packagist `_ at:\n`http://packagist.org/packages/nfarring/redisrpc `_.\nYou can use `Composer `_ to\ninstall into your PHP project.\n\nPython Installation\n~~~~~~~~~~~~~~~~~~~\n\nThe `redis-py `_ library is\nrequired.\n\nThe RedisRPC Python library is available from\n`PyPI `_ at:\n`http://pypi.python.org/pypi/redisrpc `_.\nYou can install with `pip `_.\n\n::\n\n pip install redisrpc\n\nInternal Message Formats\n------------------------\n\nAll RPC messages are JSON objects. User code will never see these\nobjects because they are handled by the RedisRPC library.\n\nRPC Request\n~~~~~~~~~~~\n\nAn RPC Request contains two members: a ``function_call`` object and a\n``response_queue`` string.\n\nA ``function_call`` object has one required member: a ``name`` string\nfor the function name. It also has two optional members: (a) an ``args``\nlist for positional function arguments, and (b) a ``kwargs`` object for\nnamed function arguments.\n\nThe ``response_queue`` string is the name of the Redis list where the\ncorresponding RPC Response message should be pushed by the server. This\nqueue is chosen programmatically by the client to be collision free in\nthe Redis namespace. Also, this queue is used only for a single RPC\nResponse message and is not reused for future RPC Response messages.\n\n::\n\n { \"function_call\" : {\n \"args\" : [ 1, 2, 3 ],\n \"kwargs\" : { \"a\" : 4, \"b\" : 5, \"c\" : 6 },\n \"name\" : \"foo\"\n },\n \"response_queue\" : \"calc:rpc:X7Y2US\"\n }\n\nRPC Response (Successful)\n~~~~~~~~~~~~~~~~~~~~~~~~~\n\nIf an RPC is successful, then the RPC Response object will contain a\nsingle member, a ``return_value`` of some JSON type.\n\n::\n\n { \"return_value\" : 4.0 }\n\nRPC Response (Exception)\n~~~~~~~~~~~~~~~~~~~~~~~~\n\nIf an RPC encounters an exceptional condition, then the RPC Response\nobject will contain a single member, an ``exception`` string. Note that\nthe value of the ``exception`` string might not have any meaning to the\nclient since the client and server might be written in different\nlanguages or the client might have no knowledge of the server's wrapped\nobject. Therefore the best course of action is probably to display the\n``exception`` value to the user.\n\n::\n\n { \"exception\" : \"AttributeError(\\\\\"\\'Calculator\\' object has no attribute \\'foo\\'\\\\\",)\" }\n\nSource Code\n-----------\n\nSource code is available at\n`http://github.com/nfarring/redisrpc `_.\n\nLicense\n-------\n\nThis software is available under the\n`GPLv3 `_ or later.\n\nChangelog\n---------\n\nVersion 0.3.4\n\n- Client now supports optional timeout.\n- Server now deletes message queue when starting.\n- PHP: Fixed exception handling.\n\nVersion 0.3.3\n\n- Ruby: Added a Ruby library implementation.\n\nVersion 0.3.2\n\n- Fixed some formatting in README.markdown that was causing problems\n when converted to reStructredText.\n- Added version information to README.markdown.\n- Added installation instructions to README.markdown.\n- Python: Added RPC message logging using the logging module.\n- Python: Added redis as an installation dependency.\n- Python: Now using Distribute instead of distutils.\n\nVersion 0.3.1\n\n- PHP: Changed composer.json predis dependency version.\n\nVersion 0.3.0\n\n- Empty function call args and kwargs are no longer transmitted.\n- PHP: Added support for the PHP language.\n- PHP: Now installable with PHP Composer.\n- Python: Shortened the Client and Server class names.\n- Python: Debugging modified to print JSON representation.\n- Python: Switched the README file back to ReStructred Text.\n\nVersion 0.2.1\n\n- Python: Fixed MANIFEST.in to reflect filename changes.\n\nVersion 0.2.0\n\n- Simplified the JSON RPC message format.\n- Documented the JSON RPC message format.\n- Python: Using HTML file for README, will it work?\n- Python: Renamed calc\\_client to client.py.\n- Python: Renamed calc\\_server to server.py.\n- Python: Added a RemoteException class, which can be raised by the\n client.\n\nVersion 0.1.2\n\n- Python: Fixed the download\\_url in setup.py.\n- Python: Renamed the README file to README.rst to support browsing on\n Github.\n\nVersion 0.1.1\n\n- Python: Added README.\n- Python: Added long\\_description to setup.py.\n- Python: Added MANIFEST.in file.\n- Python: Added examples/ subdirectory to MANIFEST.\n- Python: Modified examples/ directory to be consistent with README\n file.\n- Python: Fixed the download\\_url in setup.py.\n\nVersion 0.1.0\n\n- Changed to the GPL license.\n- Python: Removed unused functionality from python/redisrpc.py.\n- Python: Added a setup.py installer script.", "description_content_type": null, "docs_url": null, "download_url": "https://github.com/downloads/nfarring/redisrpc/redisrpc-python-0.3.4.tar.gz", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/nfarring/redisrpc", "keywords": "Redis,RPC", "license": "UNKNOWN", "maintainer": null, "maintainer_email": null, "name": "redisrpc", "package_url": "https://pypi.org/project/redisrpc/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/redisrpc/", "project_urls": { "Download": "https://github.com/downloads/nfarring/redisrpc/redisrpc-python-0.3.4.tar.gz", "Homepage": "http://github.com/nfarring/redisrpc" }, "release_url": "https://pypi.org/project/redisrpc/0.3.4/", "requires_dist": null, "requires_python": null, "summary": "Lightweight RPC using Redis", "version": "0.3.4" }, "last_serial": 803298, "releases": { "0.1.2": [], "0.2.1": [], "0.3.1": [], "0.3.2": [], "0.3.4": [] }, "urls": [] }