{ "info": { "author": "Krist\u00f3f T\u00f3th", "author_email": "mrtoth@strongds.hu", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: POSIX", "Programming Language :: Python :: 3" ], "description": "# pipe-io-server\nA trivial to use IPC solution based on POSIX named pipes and newlines.\n\n## Why?\nWhen it comes to communication between processes, we often find that\nall we need is the simple abstraction of a text based message queue with\na blocking `send()` and `recv()` to connect 2 processes.\n\nWe could use sockets for instance, but that requires writing lots of\nboilerplate. This can especially be a hassle if you want to support many\nprogramming languages, as you would have to develop and maintain your\nown bindings implementing your custom messaging protocol across all of them\n(turning the abstraction of a byte stream into a queue of messages).\n\nYou could also use a message broker like RabbitMQ or Redis, but that would\nforce you to run a daemon in the background.\nYou could choose something like ZeroMQ, but all abstractions come with costs\n(i.e how would you send a message to a ZMQ socket from a bash shell, or an\nenvironment where ZMQ bindings are not easily available?).\n\nWhat if you didn't have to maintain _any_ language bindings to\nintegrate with different languages?\nWhat if you could rely on an API so trivial, that virtually every programming\nlanguage already provides it?\n\nSome developers like doing IPC by writing and reading lines of text to and from named pipes.\nIt turns out that since a named pipe is like a file without `seek()`\n(`stdin` or `stdout` _are_ pipes), you can use the readline and print utilities\nof programming languages to use them.\nOpening a pipe will block until the other side opens it and reading from it\nalso blocks until data is available. Just what we want!\n\nThe only issue is that writing a server for pipe based IO is not that\ntrivial if you wish to avoid blocking your main thread:\nyou have to start a thread for each pipe, avoid losing messages\nwhen clients are opening and closing your pipes, deal with race conditions and so on.\nIt is especially hard to properly stop such a server: deadlocks are very easy to encounter\nwhen juggling around with threads blocking on pipe operations.\nThis gets even more difficult if you wish your server to be resilient against irregular\nclient behaviour, such as the deletion of a named pipe while a thread is blocking on it.\nThis may sound discouraging, but this is the exact reason why I've written this package:\nso you won't have to.\nAnd solving all these issues are worth it in the end: writing clients is as trivial as it gets.\n\n## What?\nThis package provides robust, asynchronous servers capable of IO over a text-based,\nnewline delimited protocol using named pipes.\nThis makes it extremely easy to integrate any external process as a plugin\ninto your application: clients can just open file descriptors for reading/writing\nwithout worrying about anything else.\n\n## Examples\n\nA few lines of code are worth a 100 lines of API documentation.\nYou can find a simple usage example of this package in `echo_server.py`.\n\nA client replying to each message of the server in just a few lines of bash\n(`send` and `recv` are the paths of the pipes):\n```\nwhile IFS= read -r message; do\n printf \"Received: ${message}\\n\"\n # ... do something ...\n printf \"Some response\\n\" > \"send\"\ndone < \"recv\"\n```\n\nSome more examples:\n- `pipe_io_server/clients` contains examples on how to use pipes in different languages\n- `pipe_io_server/test_pipe_io_server.py` contains a relatively comprehensive suite of unit tests\n\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://git.strongds.hu/mrtoth/pipe-io-server", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "pipe-io-server", "package_url": "https://pypi.org/project/pipe-io-server/", "platform": "", "project_url": "https://pypi.org/project/pipe-io-server/", "project_urls": { "Homepage": "https://git.strongds.hu/mrtoth/pipe-io-server" }, "release_url": "https://pypi.org/project/pipe-io-server/1.0.3/", "requires_dist": null, "requires_python": "", "summary": "A trivial to use IPC solution based on pipes and newlines", "version": "1.0.3" }, "last_serial": 5791906, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "c0f114ef92a9733186943901aeef400d", "sha256": "0059e01fb11afc342a2536c36557f4a108bf78530ec2f3931053fdcdc285f75b" }, "downloads": -1, "filename": "pipe_io_server-1.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "c0f114ef92a9733186943901aeef400d", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 17621, "upload_time": "2019-08-05T15:45:38", "url": "https://files.pythonhosted.org/packages/fc/50/add1d7f508764aa3e2b70d87aa2cb1c8c152c2c209562e2bddfcbb70a03b/pipe_io_server-1.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d75c792a722788eba262f2db90eb1dc4", "sha256": "ed898171a53415445c2a4e387179d93b42db9cb980116b151da9da08210c7488" }, "downloads": -1, "filename": "pipe_io_server-1.0.0.tar.gz", "has_sig": false, "md5_digest": "d75c792a722788eba262f2db90eb1dc4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11657, "upload_time": "2019-08-05T15:45:39", "url": "https://files.pythonhosted.org/packages/32/28/14be1e49b73f130e526961c5da4ae7549f5f04f3db460523595456b1a07e/pipe_io_server-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "c1c50b87eb635de6b166b76a30ce9284", "sha256": "3df5044dbb39812271a9aa02e2d7214f1dea6aa4945340432168b1f9a07c0d0e" }, "downloads": -1, "filename": "pipe_io_server-1.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "c1c50b87eb635de6b166b76a30ce9284", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 17713, "upload_time": "2019-08-06T15:14:27", "url": "https://files.pythonhosted.org/packages/2d/21/3a07af6659b7af9a0bf3b918547bd09a3be4cf380aa5f7b36f3c189bdec9/pipe_io_server-1.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "5124e82685483154041acdd490185aa4", "sha256": "cb480b333c994fa5ea427c25071e31be85980afb473480d1042aeb1a973657c1" }, "downloads": -1, "filename": "pipe_io_server-1.0.1.tar.gz", "has_sig": false, "md5_digest": "5124e82685483154041acdd490185aa4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11798, "upload_time": "2019-08-06T15:14:29", "url": "https://files.pythonhosted.org/packages/1b/25/a4cf232e24815212be8a1a300fb28437c681df168a95b2a6ef8945a3838c/pipe_io_server-1.0.1.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "781c25988258bab8b29a6cdd10dc9cd4", "sha256": "c401759bcb5fdc57f0bd405b84672f21f284159ad10bb59838b6dad81f240387" }, "downloads": -1, "filename": "pipe_io_server-1.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "781c25988258bab8b29a6cdd10dc9cd4", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 17791, "upload_time": "2019-09-05T13:37:49", "url": "https://files.pythonhosted.org/packages/e2/5a/6b6eaee1da3df372384d62c27d43ec124e359afb30c759857608bf269fb5/pipe_io_server-1.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b326310a539b1c04748d8bfe34602b4f", "sha256": "5e25f3a254546c9b6199ba4f7e20a52819911d2719381ed12c53af584c73eced" }, "downloads": -1, "filename": "pipe_io_server-1.0.2.tar.gz", "has_sig": false, "md5_digest": "b326310a539b1c04748d8bfe34602b4f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11886, "upload_time": "2019-09-05T13:37:52", "url": "https://files.pythonhosted.org/packages/d9/e3/25c094e2c6d2bb5ffa8b64fa6d597a8f6e6b494fd4c0c9f242d7d6668b1d/pipe_io_server-1.0.2.tar.gz" } ], "1.0.3": [ { "comment_text": "", "digests": { "md5": "7acd5f8b0078f285821f46a614c3cc98", "sha256": "cabbb5a5fcec2874f7b9c4f095b9fdca3a059ae6141fd1c68f7814f0a85b4890" }, "downloads": -1, "filename": "pipe_io_server-1.0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "7acd5f8b0078f285821f46a614c3cc98", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 17816, "upload_time": "2019-09-06T12:12:58", "url": "https://files.pythonhosted.org/packages/86/9b/bcdddc5db19f965062c97c61add38da3ed263fd15e6c529e192abda3f4fd/pipe_io_server-1.0.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3aa90ed0458eab2d8492fbbb5e7ae48f", "sha256": "75a93b1507e962102b1afd521d47c459aec5a7706cdfe24b6d5c6ffef04ceca8" }, "downloads": -1, "filename": "pipe_io_server-1.0.3.tar.gz", "has_sig": false, "md5_digest": "3aa90ed0458eab2d8492fbbb5e7ae48f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11890, "upload_time": "2019-09-06T12:12:59", "url": "https://files.pythonhosted.org/packages/42/e2/4d8f23e857bcf058e10b800a633eb5bd1adee0703c0a6fe194c01f923dfe/pipe_io_server-1.0.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "7acd5f8b0078f285821f46a614c3cc98", "sha256": "cabbb5a5fcec2874f7b9c4f095b9fdca3a059ae6141fd1c68f7814f0a85b4890" }, "downloads": -1, "filename": "pipe_io_server-1.0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "7acd5f8b0078f285821f46a614c3cc98", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 17816, "upload_time": "2019-09-06T12:12:58", "url": "https://files.pythonhosted.org/packages/86/9b/bcdddc5db19f965062c97c61add38da3ed263fd15e6c529e192abda3f4fd/pipe_io_server-1.0.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3aa90ed0458eab2d8492fbbb5e7ae48f", "sha256": "75a93b1507e962102b1afd521d47c459aec5a7706cdfe24b6d5c6ffef04ceca8" }, "downloads": -1, "filename": "pipe_io_server-1.0.3.tar.gz", "has_sig": false, "md5_digest": "3aa90ed0458eab2d8492fbbb5e7ae48f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11890, "upload_time": "2019-09-06T12:12:59", "url": "https://files.pythonhosted.org/packages/42/e2/4d8f23e857bcf058e10b800a633eb5bd1adee0703c0a6fe194c01f923dfe/pipe_io_server-1.0.3.tar.gz" } ] }