{ "info": { "author": "Thomas Rausch", "author_email": "thomas@rauschig.org", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3.6", "Topic :: System :: Networking" ], "description": "PyMQ\n====\n\n[![PyPI Version](https://badge.fury.io/py/pymq.svg)](https://badge.fury.io/py/pymq)\n[![PyPI License](https://img.shields.io/pypi/l/pymq.svg)](https://img.shields.io/pypi/l/pymq.svg)\n[![Build Status](https://travis-ci.org/thrau/pymq.svg?branch=master)](https://travis-ci.org/thrau/pymq)\n[![Coverage Status](https://coveralls.io/repos/github/thrau/pymq/badge.svg?branch=master)](https://coveralls.io/github/thrau/pymq?branch=master)\n\nPyMQ is a simple message-oriented middleware library for implementing Python IPC across machine boundaries. The API\nenables different styles of remoting via Pub/Sub, Queues, and synchronous RPC.\n\nWith PyMQ, developers can integrate Python applications running on different machines in a loosely coupled way over\nexisting transport mechanisms. PyMQ currently provides a Redis backend, and an in-memory backend for testing. The API is\nextensible and other transports can be plugged in.\n\nUsing PyMQ\n----------\n\n### Initialize PyMQ\n\nThe core module manages a global eventbus instance that provides the remoting primitives. The default Redis\nimplementation uses an event loop over a pubsub object. The global eventbus is initialized via `pymq.init` and by\npassing a provider factory.\n\n```python\nimport pymq\nfrom pymq.provider.redis import RedisConfig\n\n# starts a new thread with a Redis event loop\npymq.init(RedisConfig())\n\n# main application control loop\n\npymq.shutdown()\n```\nThis will create an eventbus instance on top of a local Redis server.\n\n### Pub/Sub\n\nPub/Sub allows asynchronous event-based communication. Event classes are used to transport state and identify channels.\n\n```python\nimport pymq\n\n# common code\nclass MyEvent:\n pass\n\n# subscribe code\n@pymq.subscriber\ndef on_event(event: MyEvent):\n print('event received')\n\n# publisher code\npymq.publish(MyEvent())\n```\n\n### Queues\n\nQueues are straight forward, as they are compatible to the Python `queue.Queue` specification.\n\n```python\nimport pymq\n\nqueue = pymq.queue('my_queue') \nqueue.put('obj')\nprint(queue.get()) # outputs 'obj'\n```\n\n### RPC\n\nServer code\n\n```python\nimport pymq\n\n@pymq.remote('product_remote')\ndef product(a: int, b: int) -> int: # pymq relies on type hints for marshalling\n return a * b\n```\n\nClient code\n```python\nimport pymq\n\nproduct = pymq.stub('product_remote')\nproduct(2, 4) # 8\n```\n\nWith a shared code-base, methods can also be exposed and called by passing the callable. For example,\n```python\nimport pymq\n\n# common code\nclass Remote:\n def echo(self, param) -> None:\n return 'echo: ' + param\n\n# server\nobj = Remote()\npymq.expose(obj.echo)\n\n# client\necho = pymq.stub(Remote.echo)\necho('pymq') # \"echo: pymq\"\n```\n\nIf there are multiple providers of the same object, then a stub can be initialized with `multi=True` to get a list of\nresults. It may be useful to use a timeout in this case.\n\n```python\nremote = pymq.stub('remote_method', multi=True, timeout=2)\n\nresult = remote() # result will be a list containing the results of all invocations of available remote objects\n```\n\nKnown Limitations\n-----------------\n\n* JSON serialization relies heavily on type hints. Sending complex types without type hints will cause type errors.\n* There is currently no support for polymorphism with JSON serialization\n* Pattern-based topic matching does not work for the in-memory eventbus\n* Subscriptions by foreign components to RPC channels will cause issues in multi-call scenarios\n* Using the `pymq` singleton in multiprocessing scenarios may not work as expected because the module holds a Thread in\n a global variable. A workaround is to re-start the bus by calling `shutdown()` and `init()` in the forked Process.\n\nBackground\n----------\n\nOriginally part of the [Symmetry](https://git.dsg.tuwien.ac.at/mc2/symmetry) project, was extracted as a standalone\nlibrary.\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "https://pypi.org/project/pymq/", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/thrau/pymq", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "pymq", "package_url": "https://pypi.org/project/pymq/", "platform": "", "project_url": "https://pypi.org/project/pymq/", "project_urls": { "Download": "https://pypi.org/project/pymq/", "Homepage": "https://github.com/thrau/pymq" }, "release_url": "https://pypi.org/project/pymq/0.2.2/", "requires_dist": [ "redis (>=3.2.1)" ], "requires_python": "", "summary": "A simple message-oriented middleware library built for Python IPC across machine boundaries", "version": "0.2.2" }, "last_serial": 5897066, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "5d10c3b64370f1dc172584b23f576ff9", "sha256": "2dd386dee9a1a4aad68a1fbb5ceafa21c3f0646e91769c601d2c5dc4965b920c" }, "downloads": -1, "filename": "pymq-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "5d10c3b64370f1dc172584b23f576ff9", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 21508, "upload_time": "2019-08-20T04:01:55", "url": "https://files.pythonhosted.org/packages/c1/83/9957548e2099ae11648a3685541f13bbbbb7a714cd7721eaa0feb2c46184/pymq-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "090ed183bed13afcbb27a140298d7639", "sha256": "f3ffdca837e2b5d50d7064529879e81f56a9ca0f9310a771b983f27fbb6d9de2" }, "downloads": -1, "filename": "pymq-0.1.0.tar.gz", "has_sig": false, "md5_digest": "090ed183bed13afcbb27a140298d7639", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16770, "upload_time": "2019-08-20T04:02:01", "url": "https://files.pythonhosted.org/packages/d3/d4/6c95339ea3eb4ff9a54677c3a3f153ebd8db6e5e95d629ed1e886d075a1b/pymq-0.1.0.tar.gz" } ], "0.1.0.dev1": [ { "comment_text": "", "digests": { "md5": "4ebb906f314762e75ec634c3f7c6c338", "sha256": "b526fc907ae1124bbec25fd59f89da2bf9cf6fd9a5163de7a2a14d5fbb5df597" }, "downloads": -1, "filename": "pymq-0.1.0.dev1-py3-none-any.whl", "has_sig": false, "md5_digest": "4ebb906f314762e75ec634c3f7c6c338", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 19499, "upload_time": "2019-08-18T21:47:13", "url": "https://files.pythonhosted.org/packages/07/24/f0cdf916a59f500633d7f79adac6dfd2e18b3a721c32c897cd31e21bc019/pymq-0.1.0.dev1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "43c3a650ce35dd8289b88a26b7fd2095", "sha256": "bcc329f992a135bb372c0fbccc15ea2519bce4077df82cee83f340c837306c2c" }, "downloads": -1, "filename": "pymq-0.1.0.dev1.tar.gz", "has_sig": false, "md5_digest": "43c3a650ce35dd8289b88a26b7fd2095", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9830, "upload_time": "2019-08-18T21:47:16", "url": "https://files.pythonhosted.org/packages/02/a6/6f8137225e7be84af482035220312610245845acf34c67e03318ec9633bb/pymq-0.1.0.dev1.tar.gz" } ], "0.1.0.dev2": [ { "comment_text": "", "digests": { "md5": "1d5e9ce694d15916976e66f8b7f1f967", "sha256": "e2b2e5eacf81d6dbde7f0d48df5ff2d6322bd6e440bb356aee661cd3102ccfff" }, "downloads": -1, "filename": "pymq-0.1.0.dev2-py3-none-any.whl", "has_sig": false, "md5_digest": "1d5e9ce694d15916976e66f8b7f1f967", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 18720, "upload_time": "2019-08-19T02:09:07", "url": "https://files.pythonhosted.org/packages/b7/a2/e8300ec612942c81fdfda58bbfdbc2f2c378f86bee98a23e9189ddcb13cc/pymq-0.1.0.dev2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "456cf697aa61065b762348f0e3495759", "sha256": "9991410139a857163805cf8423089c264fa0a478e98bcd941f2ed96e8308d296" }, "downloads": -1, "filename": "pymq-0.1.0.dev2.tar.gz", "has_sig": false, "md5_digest": "456cf697aa61065b762348f0e3495759", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14854, "upload_time": "2019-08-19T02:09:08", "url": "https://files.pythonhosted.org/packages/33/7c/68faf80c41cbe3f3e62b910addf5d3449a3b026a1ce4537711eb48a15c34/pymq-0.1.0.dev2.tar.gz" } ], "0.1.0.dev3": [ { "comment_text": "", "digests": { "md5": "bb9cc52f18bd22d93d3597499f8a4568", "sha256": "89412b1ee4ac2e55eb871196ccdbc34a08abffc1bccee7f13df4038b1f5c2c6a" }, "downloads": -1, "filename": "pymq-0.1.0.dev3-py3-none-any.whl", "has_sig": false, "md5_digest": "bb9cc52f18bd22d93d3597499f8a4568", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 20381, "upload_time": "2019-08-19T07:45:55", "url": "https://files.pythonhosted.org/packages/02/6c/2e1048e2b27f5d25b07462e55da5579d3e08503d20272dfbb3e6887cf7ef/pymq-0.1.0.dev3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "0d07e3515070f32da9de7610372c5f0d", "sha256": "303a5f05e5bec92ff64142ccdeb1d1675ea74ef5123ce268e5f1d1d26176936b" }, "downloads": -1, "filename": "pymq-0.1.0.dev3.tar.gz", "has_sig": false, "md5_digest": "0d07e3515070f32da9de7610372c5f0d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15677, "upload_time": "2019-08-19T07:45:57", "url": "https://files.pythonhosted.org/packages/82/a3/719965abf7ac7821c0c0825181952a88286f68d365c64b39e5b59410d9e2/pymq-0.1.0.dev3.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "7a4878f40d700ec566bf781061dd41ae", "sha256": "82427a822a46efb46eaa2f09df8fd150efd9f301cf13db1a3589a61b1733a511" }, "downloads": -1, "filename": "pymq-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "7a4878f40d700ec566bf781061dd41ae", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 21811, "upload_time": "2019-08-20T05:00:22", "url": "https://files.pythonhosted.org/packages/b1/41/8040ae7ef113ee223484917cb69020c6ae4453ccf175a9cbde7fc30c33f8/pymq-0.1.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a14d88d2d31ea97b25b61705ecbee0d2", "sha256": "ee944075ab1ff6d1a6d9b15479c96dcd9eb6efe02ec3edadd55e9f3df837ef94" }, "downloads": -1, "filename": "pymq-0.1.1.tar.gz", "has_sig": false, "md5_digest": "a14d88d2d31ea97b25b61705ecbee0d2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17427, "upload_time": "2019-08-20T05:00:24", "url": "https://files.pythonhosted.org/packages/23/f9/bf48c2d46d608f86b42cd0d2407122d214b4ff6aa18322f41fe18050026e/pymq-0.1.1.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "36d0c5466b03e7887a0841a36df58eb9", "sha256": "6b587b3f1daf4768c4763e93c2ae045d4199beb24481e7dcc7bef8edda005d23" }, "downloads": -1, "filename": "pymq-0.2.0-py3-none-any.whl", "has_sig": false, "md5_digest": "36d0c5466b03e7887a0841a36df58eb9", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 22945, "upload_time": "2019-08-22T02:18:19", "url": "https://files.pythonhosted.org/packages/11/45/0899b60c159c4be17f480e4ca8eecd4e6414d24c40b88dc80231535cd135/pymq-0.2.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "849eaea2ad4e61fed07c3b5a87a42c76", "sha256": "46c59035910c8db4c39906b265c827836af4559c637400a22b69112f12a3caa0" }, "downloads": -1, "filename": "pymq-0.2.0.tar.gz", "has_sig": false, "md5_digest": "849eaea2ad4e61fed07c3b5a87a42c76", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18293, "upload_time": "2019-08-22T02:18:25", "url": "https://files.pythonhosted.org/packages/53/f0/964968d00f7554552f844f739d35f97a45325a16e7659c565c579e206455/pymq-0.2.0.tar.gz" } ], "0.2.0.dev1": [ { "comment_text": "", "digests": { "md5": "c49e744f931e694a378aed1ae493e086", "sha256": "0d28ce7c23a118ff93511475d18b33cf88672349a7e2bc74fb7e419e678d0e25" }, "downloads": -1, "filename": "pymq-0.2.0.dev1-py3-none-any.whl", "has_sig": false, "md5_digest": "c49e744f931e694a378aed1ae493e086", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 23006, "upload_time": "2019-08-22T02:18:20", "url": "https://files.pythonhosted.org/packages/d6/7e/42c87c72ae2bc16d419c5112997e4164ed9f222793c256950104b3f13e0a/pymq-0.2.0.dev1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c922f7d772c2903219c7a717299e8a00", "sha256": "8d117615dbc20bc56d757e54f0bf486ed66273db40194a40d9eda9bcfaff28e9" }, "downloads": -1, "filename": "pymq-0.2.0.dev1.tar.gz", "has_sig": false, "md5_digest": "c922f7d772c2903219c7a717299e8a00", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18302, "upload_time": "2019-08-22T02:18:23", "url": "https://files.pythonhosted.org/packages/d0/f5/ed18fa968228fe5950a0f5cbd6a8305536e34419837edfd9294dde1cc22a/pymq-0.2.0.dev1.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "289f94b7c4efbcc8aa3d6b058068a34f", "sha256": "2592541b25b339999736a4896e31b5301770798f844c09bb67985df0993b2e18" }, "downloads": -1, "filename": "pymq-0.2.1-py3-none-any.whl", "has_sig": false, "md5_digest": "289f94b7c4efbcc8aa3d6b058068a34f", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 23245, "upload_time": "2019-09-01T01:39:37", "url": "https://files.pythonhosted.org/packages/94/ba/1e49f34e2350c5a5d95a4d8e83251917b85157b716c35de424662316a858/pymq-0.2.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "2c177512c4fde308ea9a02a3097a9c68", "sha256": "f1b03dde30c9b1af9864ea509364496b3adef01a57f7c86111531e2a1f01a2df" }, "downloads": -1, "filename": "pymq-0.2.1.tar.gz", "has_sig": false, "md5_digest": "2c177512c4fde308ea9a02a3097a9c68", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18901, "upload_time": "2019-09-01T01:39:39", "url": "https://files.pythonhosted.org/packages/c6/1a/45e251e1d6320a7354fbb6e82685ecb23a835b09757bd64dce7781b0df6b/pymq-0.2.1.tar.gz" } ], "0.2.2": [ { "comment_text": "", "digests": { "md5": "9b7b57276ecfb711e3b59e6e27ad875e", "sha256": "2063613e946f9489be282814cbf40e4073392eb321612832f3697895b4fcd6dc" }, "downloads": -1, "filename": "pymq-0.2.2-py3-none-any.whl", "has_sig": false, "md5_digest": "9b7b57276ecfb711e3b59e6e27ad875e", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 23337, "upload_time": "2019-09-27T16:53:43", "url": "https://files.pythonhosted.org/packages/c6/ca/2dff1c149fd8c45ac6264efe638c925b4a42938721fc3b965437bff46785/pymq-0.2.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f864d21269ad1080714dbe9643e8f0bb", "sha256": "3161deaaf1389ace80e751f40bfd046d3573e5bd81b87d9352d5788a97bdb543" }, "downloads": -1, "filename": "pymq-0.2.2.tar.gz", "has_sig": false, "md5_digest": "f864d21269ad1080714dbe9643e8f0bb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18983, "upload_time": "2019-09-27T16:53:44", "url": "https://files.pythonhosted.org/packages/42/b7/3788f4beb0ee3f1f5f5860f6a19f04fb7371359da142c28c46c60b856382/pymq-0.2.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "9b7b57276ecfb711e3b59e6e27ad875e", "sha256": "2063613e946f9489be282814cbf40e4073392eb321612832f3697895b4fcd6dc" }, "downloads": -1, "filename": "pymq-0.2.2-py3-none-any.whl", "has_sig": false, "md5_digest": "9b7b57276ecfb711e3b59e6e27ad875e", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 23337, "upload_time": "2019-09-27T16:53:43", "url": "https://files.pythonhosted.org/packages/c6/ca/2dff1c149fd8c45ac6264efe638c925b4a42938721fc3b965437bff46785/pymq-0.2.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f864d21269ad1080714dbe9643e8f0bb", "sha256": "3161deaaf1389ace80e751f40bfd046d3573e5bd81b87d9352d5788a97bdb543" }, "downloads": -1, "filename": "pymq-0.2.2.tar.gz", "has_sig": false, "md5_digest": "f864d21269ad1080714dbe9643e8f0bb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18983, "upload_time": "2019-09-27T16:53:44", "url": "https://files.pythonhosted.org/packages/42/b7/3788f4beb0ee3f1f5f5860f6a19f04fb7371359da142c28c46c60b856382/pymq-0.2.2.tar.gz" } ] }