{ "info": { "author": "Laurence Rowe", "author_email": "laurence@lrowe.co.uk", "bugtrack_url": null, "classifiers": [], "description": "=====================\nSubprocess Middleware\n=====================\n\n.. image:: https://travis-ci.org/lrowe/subprocess_middleware.svg?branch=master\n :target: https://travis-ci.org/lrowe/subprocess_middleware\n\nThis package was built to support rendering Python generated JSON into HTML using a nodejs.\nTransform subprocesses are reused, avoiding process startup overhead and allowing the JIT to kick in.\nFor our code this gives a 10x speedup for subsequent responses.\n\nThe protocol is simple and generic, HTTP formatted responses (headers and body) are piped into and out of the transform subprocess.\nTransforms may modify both the response headers and body.\n\nTransforms modifying the response body must ensure the Content-Length header is updated to match.\n\n\nPython 2 and subprocess32\n-------------------------\n\nThe subprocess module in Python 2.7 can leak file descriptors.\nBackported fixes from Python 3.x are available in subprocess32_, and will be used if installed.\n\n.. _subprocess32: https://pypi.python.org/pypi/subprocess32\n\n\nPipe buffering\n--------------\n\nFor small responses, the unix command ``cat`` works as an identity transform.\nOnce a response exceeds the pipe buffer limit (typically 16K or 64K), a deadlock occurs with both processes waiting for the other to read.\nTo avoid this, subprocesses should read in the entirity of each response before writing to stdout and flush stdout at the response end.\n\nWorking around this limitation would require writing and reading from different threads.\n\n\nAlternatives\n============\n\nApache mod_ext_filter\n---------------------\n\nWith mod_ext_filter_, the response body is simply piped through an external program.\nA new process is started for each response, so it suffers from the same limitations as CGI where application setup costs are paid for each request.\n\n.. _mod_ext_filter: http://httpd.apache.org/docs/2.4/en/mod/mod_ext_filter.html\n\n\nFastCGI filter\n--------------\n\nFastCGI_ defines a filter role for transforming responses using long-lived processes.\nUnfortunately the filter role is not supported by Apache mod_fcgid_ and the FastCGI protocol itself is unnecessarily complicated to implement.\n\n.. _FastCGI: http://www.fastcgi.com/devkit/doc/fastcgi-prog-guide/ch1intro.htm\n.. _mod_fcgid: http://httpd.apache.org/mod_fcgid/mod/mod_fcgid.html\n\n\nTransforming HTTP reverse proxy\n-------------------------------\n\nAnother alternative would be to implement the transform as part of an HTTP proxy.\nThis adds significant deployment complexity with multiple hops required to support SSL.\n\n\nPyV8\n----\n\nPyV8_ allows running JavaScript in process.\nIt can be tricky to build whereas nodejs packages are easily available.\n\n.. _PyV8: https://pypi.python.org/pypi/PyV8\n\nuWSGI Transformations\n---------------------\n\nuWSGI_ are working on an rpc plugin for their transformation system.\nThe rpc protocol itself has a 64k request size limit.\n\n.. _uWSGI: http://uwsgi-docs.readthedocs.org/\n", "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/lrowe/subprocess_middleware", "keywords": null, "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "subprocess_middleware", "package_url": "https://pypi.org/project/subprocess_middleware/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/subprocess_middleware/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://github.com/lrowe/subprocess_middleware" }, "release_url": "https://pypi.org/project/subprocess_middleware/0.3/", "requires_dist": null, "requires_python": null, "summary": "Subprocess WSGI middleware and Pyramid tween.", "version": "0.3" }, "last_serial": 1239695, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "5aa41bd875417f89369d1adf3ff89336", "sha256": "e7b548596afb7162e759c553603d44ab8383ebb8a027018fff225cc61db0969a" }, "downloads": -1, "filename": "subprocess_middleware-0.1.zip", "has_sig": false, "md5_digest": "5aa41bd875417f89369d1adf3ff89336", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12683, "upload_time": "2014-05-13T00:45:03", "url": "https://files.pythonhosted.org/packages/1d/c4/783468fbf194b49341b8dd5efebb1c335814d0579b610e52af6ce2c445ee/subprocess_middleware-0.1.zip" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "6005ace5003df436cdff0afed4293bae", "sha256": "4094962e490f6a9fb3e37325ddb560cb670f7efeb35ac9c20d1f1530803a5f90" }, "downloads": -1, "filename": "subprocess_middleware-0.2.zip", "has_sig": false, "md5_digest": "6005ace5003df436cdff0afed4293bae", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13938, "upload_time": "2014-09-25T01:04:45", "url": "https://files.pythonhosted.org/packages/4e/9a/7a8a89d3458dc1bbf0216d14fc67fc87c055586fa36d247beb1b91b5bf46/subprocess_middleware-0.2.zip" } ], "0.3": [ { "comment_text": "", "digests": { "md5": "f784acee2a9faba045ea721a7b2d1a0d", "sha256": "182c3ecd1d5657dbfb2e1d22629835305b26851d8baaf759f10cd1b2e4b4697e" }, "downloads": -1, "filename": "subprocess_middleware-0.3.zip", "has_sig": false, "md5_digest": "f784acee2a9faba045ea721a7b2d1a0d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14521, "upload_time": "2014-09-27T03:02:18", "url": "https://files.pythonhosted.org/packages/56/30/ab3a1f62f706c1081f51b1660167cd877acf7a36c6cf4ba621596f1b34e8/subprocess_middleware-0.3.zip" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "f784acee2a9faba045ea721a7b2d1a0d", "sha256": "182c3ecd1d5657dbfb2e1d22629835305b26851d8baaf759f10cd1b2e4b4697e" }, "downloads": -1, "filename": "subprocess_middleware-0.3.zip", "has_sig": false, "md5_digest": "f784acee2a9faba045ea721a7b2d1a0d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14521, "upload_time": "2014-09-27T03:02:18", "url": "https://files.pythonhosted.org/packages/56/30/ab3a1f62f706c1081f51b1660167cd877acf7a36c6cf4ba621596f1b34e8/subprocess_middleware-0.3.zip" } ] }