{ "info": { "author": "Daniel Mueller", "author_email": "deso@posteo.net", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", "Operating System :: POSIX", "Programming Language :: Python", "Programming Language :: Python :: 3", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "execute\n=======\n\nPurpose\n-------\n\n**execute** provides a process execution facility on top of the POSIX\nfork/exec model. It comprises functionality similar to the standard\n*subprocess* package but behind a more intuitive and user-friendly\ninterface. The package is not designed to be compatible with\n*subprocess*. Some functionality, such as asynchronous process\nexecution, is not provided at all. The execution model of a pipeline, on\nthe other hand, passing the output of one program as input to another is\nexpressable in a very natural and efficient way. Similarly, handling of\nenvironment variables is much more simple and safe.\n\nUsage\n-----\n\nThe **execute** package provides the ``execute`` function. This\nprimitive starts a process in a synchronous manner (i.e., waiting for it\nto finish).\n\n::\n\n >>> from deso.execute import execute\n >>> execute(\"/bin/echo\", \"-n\", \"hello\")\n b''\n\nIt is possible to control which streams to read from. By default,\neverything on standard error is reported (the empty byte object seen),\nwhereas standard output is not read. The reason for this behavior is\nthat whenever a program fails (that is, exits with a non-zero status),\nan exception is raised and this exception contains the data printed to\nstandard error. Conversely, \"most\" programs do not write to standard out\nand so by default this data is not captured.\n\nOf course, the user is able to change this default.\n\n::\n\n >>> execute(\"/bin/echo\", \"-n\", \"hello\", stdout=b\"\", stderr=None)\n b'hello'\n\nHere, we read the standard output, appending it to an empty bytes\nbuffer, while simply ignoring any data on standard error. It is also\npossible to stream into a file by supplying a file descriptor.\n\n::\n\n >>> execute(\"/bin/echo\", \"hi\", stdout=sys.stderr.fileno(), stderr=None)\n hi\n\nWe redirect the output of the ``echo`` invocation directly to standard\nerror (which will cause it to be displayed immediately). Note that\n**execute**, by virtue of the abstraction level it works at, does not\nsupport Python's file-like objects: A file descriptor has to be a\nnumeric value.\n\nNot only is it possible to read from the output strings, supplying input\nis possible equally well.\n\n::\n\n >>> execute(\"/bin/tr\", \"e\", \"a\", stdin=b\"hello\", stdout=b\"\", stderr=None)\n b'hallo'\n\nThe ``execute`` function also accepts an ``env`` parameter describing\nthe environment in which to create the new process. By default, the\nentire environment of the parent process is inherited. However, it is\npossible to selectively provide a subset of variables or to specify new\nones.\n\n::\n\n >>> env = {\"VAR\": \"42\"}\n >>> execute(\"/bin/sh\", \"-c\", \"echo ${VAR}\", env=env, stdout=b\"\", stderr=None)\n b'42\\n'\n\nPipelines\n~~~~~~~~~\n\n**execute** provides native support for another execution primitive, a\n*pipeline*. The behavior is similar to the equally named Unix primitive\nwith the output of one process from a list of processes being provided\nas input to the next one.\n\nPipelines are accessible by means of the ``pipeline`` function. A\npipeline in the package's sense is simply a list of commands and their\nparameters. With a command and parameter combination being a list of\nstrings, a pipeline is a list of a list of strings.\n\n::\n\n >>> pipeline([\n ... [\"/bin/echo\", \"-n\", \"hello\"],\n ... [\"/bin/tr\", \"e\", \"a\"],\n ... ], stdout=b\"\", stderr=None\n ... )\n b'hallo'\n\nSprings\n~~~~~~~\n\nThe last execution primitive supported natively by **execute** are so\ncalled *springs*. A spring is a series of data producing sources whose\ndata is accumulated in a sequential fashion. A spring can be seen as a\npipeline with the first element being special in that it can comprise\nmultiple processes supplying data to the remaining ones.\n\n::\n\n >>> spring([\n ... [[\"/bin/echo\", \"hallo\"], [\"/bin/echo\", \"axacuta\"]],\n ... [\"/bin/tr\", \"a\", \"e\"]\n ... ], stdout=b\"\", stderr=None\n ... )\n b'hello\\nexecute\\n'\n\nBecause of their very nature of producing output in the first stage of\nthe pipeline, springs do not support the ``stdin`` keyword parameter.\nThe remaining accepted parameters, however, are similar to ``execute``\nand ``pipeline`` functions.\n\nInstallation\n------------\n\nIn order to use the **execute** package the\n`cleanup `__ Python module\n(contained in the repository in compatible and tested versions) needs to\nbe accessible by Python (typically by installing it in a directory\nlisted in ``PYTHONPATH`` or adjusting the latter to point to it). The\nsame procedure should then be followed for the **execute** package\nitself.\n\nIf you are using `Gentoo Linux `__, there is an\n`ebuild `__ available that\ncan be used directly.\n\nSupport\n-------\n\nThe module is tested with Python 3. There is no work going on to ensure\ncompatibility with Python 2.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/d-e-s-o/execute", "keywords": "execute fork exec pipeline spring process development", "license": "GPLv3", "maintainer": null, "maintainer_email": null, "name": "executed", "package_url": "https://pypi.org/project/executed/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/executed/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/d-e-s-o/execute" }, "release_url": "https://pypi.org/project/executed/0.9.0.2/", "requires_dist": null, "requires_python": null, "summary": "A package providing a process execution facility on top of the POSIX fork/exec model.", "version": "0.9.0.2" }, "last_serial": 2591317, "releases": { "0.9": [ { "comment_text": "", "digests": { "md5": "cf577a0c3e2b8d4cf48ca30c434f38b4", "sha256": "d729cce0da334e47c85ce892fd02cd0afefc458c1d0f38d614abc7fb363566ad" }, "downloads": -1, "filename": "executed-0.9.tar.gz", "has_sig": true, "md5_digest": "cf577a0c3e2b8d4cf48ca30c434f38b4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 35168, "upload_time": "2017-01-21T20:56:36", "url": "https://files.pythonhosted.org/packages/d1/05/f4fa565bfc39cf568cf04221f7e5d75a7fecc79ec4e29b9425dda68135e1/executed-0.9.tar.gz" } ], "0.9.0.1": [ { "comment_text": "", "digests": { "md5": "31bef12effaf0e2c575cef9b501669fa", "sha256": "b714c53817116a09fcb9d1316685199569c7fdd985df6961e0dab720c4262208" }, "downloads": -1, "filename": "executed-0.9.0.1.tar.gz", "has_sig": true, "md5_digest": "31bef12effaf0e2c575cef9b501669fa", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 35175, "upload_time": "2017-01-21T21:04:48", "url": "https://files.pythonhosted.org/packages/3d/b8/b6b53d99a8f8270352f4e6ce391aa9262b814d7846d2cd458863089bdfab/executed-0.9.0.1.tar.gz" } ], "0.9.0.2": [ { "comment_text": "", "digests": { "md5": "579d83d87b7df3f3222c3f2b09667fb2", "sha256": "02695e21aa9c2c3afa2ca0ce909e8ea0cc15dca6732a70562f659ec1ad25d1e4" }, "downloads": -1, "filename": "executed-0.9.0.2.tar.gz", "has_sig": true, "md5_digest": "579d83d87b7df3f3222c3f2b09667fb2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 35528, "upload_time": "2017-01-22T19:36:42", "url": "https://files.pythonhosted.org/packages/c7/ff/ebc521507eb93556efc422a1fae9973a3ae8b0f43302d231ef0a63bb0e82/executed-0.9.0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "579d83d87b7df3f3222c3f2b09667fb2", "sha256": "02695e21aa9c2c3afa2ca0ce909e8ea0cc15dca6732a70562f659ec1ad25d1e4" }, "downloads": -1, "filename": "executed-0.9.0.2.tar.gz", "has_sig": true, "md5_digest": "579d83d87b7df3f3222c3f2b09667fb2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 35528, "upload_time": "2017-01-22T19:36:42", "url": "https://files.pythonhosted.org/packages/c7/ff/ebc521507eb93556efc422a1fae9973a3ae8b0f43302d231ef0a63bb0e82/executed-0.9.0.2.tar.gz" } ] }