{ "info": { "author": "Thomas Mignot", "author_email": "tmig@yourlabs.org", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Environment :: Console", "License :: OSI Approved :: MIT License" ], "description": "ProcessController: a kind of replacement for that old pexpect.\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n\nFast Start\n==========\n\nInstall the package:\n\n.. code:: bash\n\n pip install --user processcontroller\n\n\nImport the main class:\n\n.. code:: python\n\n from processcontroller import ProcessController\n\n\nCreate a new instance:\n\n.. code:: python\n\n process_controller = ProcessController()\n\n\nThe ProcessController() instance\n================================\n\nMethods\n-------\n\n* The run() method:\n\n Run a program (command and options detailed below)\n\n.. code:: python\n\n process_controller.run(command, options)\n\n\n\n* The send() method:\n\n Send a string or bytearray to the subprogram stdin, you will usually use it inside a callback or in detached state\n\n.. code:: python\n\n process_controller.send(str|bytes)\n\n\n* The close() method:\n\n Close the stdin of the subprogram so it reaches EOF, you will usually use it inside a callback or in detached state\n\n.. code:: python\n\n process_controller.close()\n\n\n\n* The kill() method:\n\n Sends signal SIGKILL to the subprogram, the return_value should be (pid, 9) after that.\n (this should not be so used to be honest)\n\n.. code:: python\n\n process_controller.kill()\n\n\n\n* The wait() method:\n\n Used to synchronise the caller with the detached instance of ProcessController\n Waits for the queue buffer to be handled and emptied.\n If your process reads stdin such as bash or things like cat, be sure to call close() or you'll end up with an infinite loop here\n\n.. code:: python\n\n process_controller.wait()\n\n\nAttributes\n----------\n\n* return_value\n\n is the return value of the subprogram it will be\n - (0, 0) if running\n - (pid, status) if terminated\n\n\nFunction Parameters\n===================\n\nProcessController.run()\n-----------------------\n\ncommand\n_______\n\nThe command parameter must be an array like:\n\n.. code:: python\n\n ['/usr/bin/python', 'file.py']\n\n\noptions\n_______\n\nCurrently, it supports the following keys, 'when', 'input', 'echo' and 'detached'\n\n* when:\n\nThis key is used to listen to events occuring on the STDOUT of the subprogram\nThe value have to be an array of events\nThe \"event\" is in fact a match for some pattern:\n\n.. code:: python\n\n 'when': [\n ['^SomeRegex.*\\n', callback],\n ['^An other one.\\n', cb]\n ['^prompt>\\$ $', cb]\n ]\n\nBe careful about the ending line, the match will be called each time a char is added to the buffer, this helps matching prompts\nmaybe I'll add an option to avoid such an expansive operation in the future\nEvery time a '\\n' char is found, the line is treated once and reseted to ''\n\n\nThe callbacks will be called with two arguments: the ProcessController instance, and the matched string:\n\n.. code:: python\n\n def callback(processcontroller, string)\n\nYou can automates user inputs in your callback when required by the subprogram using the *send* function of your ProcessController instance:\n\n.. code:: python\n\n def cb(p, s):\n c.send('some input')\n\n\n* input:\n\nThis key is used to pre-fill the stdin of a subprogram before running it:\n\n.. code:: python\n\n pc = ProcessController()\n pc.run(['/bin/bash'], {\n 'input': 'echo test && exit'\n })\n\nYou can set an array of input:\n\n.. code:: python\n\n 'input': ['one', 'two', 'three'] # sends \"one\\ntwo\\nthree\\n\"\n\nYou can input str or bytes, conversion is handled for you\n\n* echo:\n\nThis key is a boolean that defaults to False.\nWhen set to True, the ProcessController will print the input sent to your subprogram where it has been asked\n\n\n* detached:\n\nThis key is used to make the program run in its own thread, making the call to run non-blocking:\n\n.. code:: python\n\n process_controller.wait()\n\n pc = ProcessController()\n pc.run(['/bin/bash'], {\n 'detached': True\n })\n pc.send('echo test') # will print test to stdout\n pc.close() # close stdin of subprogram, so that bash will read EOF\n\n\n* private:\n\nThis key is used to prevent the writing of your subprogram STDOUT on your main STDOUT,\nOne can still print what he wants with the help of a when event listener, indeed, the outputed lines will remain in the parameters of the callbacks functions\n\n\n* readmode:\n\nUse this key to read the sub STDOUT char by char, or line by line (default)\nIt's value can be 'line' or 'char'\nUseful to read prompts or anything that does not end with an EOL\n\n\n* decode:\n\nThis option is used to tell processcontroller to decode or not what is read from the subprogram, True by default\n\n\nDon't forget that you have to create a new instance a ProcessController everytime you want to execute a new subprogram\n\nPlease feel free to read the tests and code for a better understanding\n\nENJOY", "description_content_type": "text/x-rst", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://yourlabs.io/oss/processcontroller", "keywords": "pexpect subprocess", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "processcontroller", "package_url": "https://pypi.org/project/processcontroller/", "platform": "", "project_url": "https://pypi.org/project/processcontroller/", "project_urls": { "Homepage": "https://yourlabs.io/oss/processcontroller" }, "release_url": "https://pypi.org/project/processcontroller/1.5.0/", "requires_dist": null, "requires_python": ">=3", "summary": "Alternative pexpect for linux and python3", "version": "1.5.0" }, "last_serial": 4472385, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "3d107a1b5eb64b609639235c9412bb19", "sha256": "df83f9b5b3889884ee112e426f6ba7b240c669f3cade01cb9e31d9979933d64b" }, "downloads": -1, "filename": "processcontroller-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "3d107a1b5eb64b609639235c9412bb19", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3", "size": 3790, "upload_time": "2018-11-02T12:25:15", "url": "https://files.pythonhosted.org/packages/dc/d9/4b4ff734045e4b6ae70e4eb6891999a7d98f33e78449459428c58683a47c/processcontroller-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "192a73f63e2b9a0de71dda5eb794a2c8", "sha256": "74290b77edec0197fc0a58bfb903305719c143c1a9b39c623478988c8fc0b896" }, "downloads": -1, "filename": "processcontroller-0.0.1.tar.gz", "has_sig": false, "md5_digest": "192a73f63e2b9a0de71dda5eb794a2c8", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3", "size": 2775, "upload_time": "2018-11-02T12:25:16", "url": "https://files.pythonhosted.org/packages/ec/87/1a8891afe0c3af35abecf82787c1d2a51a17bdbcd7a77759759a5c5b3ccc/processcontroller-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "ea13f0b7987cd36a61fe690e9e217b5d", "sha256": "fe09bc93bb2f8f58b679f4273f1d11eb6a08c2369e2bf46d2f63e132c982aa06" }, "downloads": -1, "filename": "processcontroller-0.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "ea13f0b7987cd36a61fe690e9e217b5d", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3", "size": 4805, "upload_time": "2018-11-02T21:14:26", "url": "https://files.pythonhosted.org/packages/a5/40/ea20c8abab760bf11969e6f257217bf9e472299cdc00c302472ab1fd3695/processcontroller-0.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c758e79923fa801865df582c88acabc0", "sha256": "1e777c55c16a5fc477db0590f61ac88596f5931d6fa1b4ec5d2599e41259c0d7" }, "downloads": -1, "filename": "processcontroller-0.0.2.tar.gz", "has_sig": false, "md5_digest": "c758e79923fa801865df582c88acabc0", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3", "size": 4013, "upload_time": "2018-11-02T21:14:28", "url": "https://files.pythonhosted.org/packages/17/c5/07736c9471746c6009780e3fc72096e72b15de5cc3b78c62f5e500f31faa/processcontroller-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "f615b138ec9fbe52e67a0ce2354eea2f", "sha256": "576856a8e89b210b8dbb8937b64ced54755bca7940a915983500288f0f6f8bb4" }, "downloads": -1, "filename": "processcontroller-0.0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "f615b138ec9fbe52e67a0ce2354eea2f", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3", "size": 4991, "upload_time": "2018-11-04T00:32:29", "url": "https://files.pythonhosted.org/packages/4a/b4/2ffe3e39bccfbd51f3be3f4266ab2cbf1e0fe7f2d78bff31b8b1d817e812/processcontroller-0.0.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b2ef3a645d72ce2dd59a9768c7cdb920", "sha256": "0dd20b6a27352e44b4ee53a95b1784e23396795fe91b97053de478acaba52bf9" }, "downloads": -1, "filename": "processcontroller-0.0.3.tar.gz", "has_sig": false, "md5_digest": "b2ef3a645d72ce2dd59a9768c7cdb920", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3", "size": 4213, "upload_time": "2018-11-04T00:32:37", "url": "https://files.pythonhosted.org/packages/a4/68/00530b8b5c92ff1c7701490495e63214fdfed3753c969879d8141b8dba45/processcontroller-0.0.3.tar.gz" } ], "0.1.0": [ { "comment_text": "", "digests": { "md5": "de19e6d086c1773b64d45fbb4eb4f15c", "sha256": "995c8017ea22de0ad96a0b065c28dfca46e3c2950e561078fd54a7f61b41202f" }, "downloads": -1, "filename": "processcontroller-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "de19e6d086c1773b64d45fbb4eb4f15c", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3", "size": 5329, "upload_time": "2018-11-07T14:32:24", "url": "https://files.pythonhosted.org/packages/cf/78/457536c6edec585226b5358aeb1621d06f4f8a266afb00bd1f52c76dab84/processcontroller-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "50eefea53b7864c8c48e9f0cb02c7438", "sha256": "6cec4ad8b415cdc106aa6ca1aa1bd0b2b31106aecbe66ec535e411d74db3dbfc" }, "downloads": -1, "filename": "processcontroller-0.1.0.tar.gz", "has_sig": false, "md5_digest": "50eefea53b7864c8c48e9f0cb02c7438", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3", "size": 4685, "upload_time": "2018-11-07T14:32:26", "url": "https://files.pythonhosted.org/packages/bc/c3/262e1a2f0a288656c6f75552c22e631378d3610f6a1d03efb3e3b2fdfdf7/processcontroller-0.1.0.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "105caf93aa3d090a929bd73f1cb9cbbc", "sha256": "fe6aa09bd140643f95c4224619bb73bc2701d64be2617db4816cc01b96a797a9" }, "downloads": -1, "filename": "processcontroller-0.3.0.tar.gz", "has_sig": false, "md5_digest": "105caf93aa3d090a929bd73f1cb9cbbc", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3", "size": 4616, "upload_time": "2018-11-09T23:20:30", "url": "https://files.pythonhosted.org/packages/91/e2/7ff08ad3db96e508c339bfb106407c5f4d557b7a46acc80e34042b5dad42/processcontroller-0.3.0.tar.gz" } ], "0.4.0": [ { "comment_text": "", "digests": { "md5": "fbe921eb0949722084fa781f137a5b67", "sha256": "526986d0f47e0267c984120aa39cbb0758e7d2d652f41ad6851a230cea961113" }, "downloads": -1, "filename": "processcontroller-0.4.0.tar.gz", "has_sig": false, "md5_digest": "fbe921eb0949722084fa781f137a5b67", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3", "size": 4692, "upload_time": "2018-11-10T11:34:34", "url": "https://files.pythonhosted.org/packages/90/40/7a38ee753b14efdaca78f654162faf7fcd12d8bc0867a37bd6e71d45b3f5/processcontroller-0.4.0.tar.gz" } ], "0.4.4": [ { "comment_text": "", "digests": { "md5": "9c39c5c3573c0b0e1eb4b2a083cd329a", "sha256": "ab6b3944a390cb1cd1feb1d7476394360826589a5043ebd34dee681e4626062a" }, "downloads": -1, "filename": "processcontroller-0.4.4.tar.gz", "has_sig": false, "md5_digest": "9c39c5c3573c0b0e1eb4b2a083cd329a", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3", "size": 4706, "upload_time": "2018-11-10T02:40:19", "url": "https://files.pythonhosted.org/packages/fe/8b/18e7a04df73d3e92bc453da7024e3700793d41d4cafb5e74dbe4552c881d/processcontroller-0.4.4.tar.gz" } ], "1.0.0": [ { "comment_text": "", "digests": { "md5": "e747eefd5c8a5ecbddd6c5262dca95be", "sha256": "776d1e480e0e31b900945283bafd1e5cdcadff1c6c38b0a3c48046ff2c7ba291" }, "downloads": -1, "filename": "processcontroller-1.0.0.tar.gz", "has_sig": false, "md5_digest": "e747eefd5c8a5ecbddd6c5262dca95be", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3", "size": 4694, "upload_time": "2018-11-10T13:35:49", "url": "https://files.pythonhosted.org/packages/77/50/c50aff3e9ca7ed043d2ca55dc850a7509a0104be52f7f0ac535c45cd378f/processcontroller-1.0.0.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "745dba8ef702295564e86143f778e243", "sha256": "523aa7206256b18634503b06fee76b3dcdb01790b43006eef501bdbad6ae8834" }, "downloads": -1, "filename": "processcontroller-1.1.0.tar.gz", "has_sig": false, "md5_digest": "745dba8ef702295564e86143f778e243", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3", "size": 4694, "upload_time": "2018-11-10T13:36:40", "url": "https://files.pythonhosted.org/packages/74/93/636e271d93739ff15b1675216e3ebab31550aede2ce5e748b0993e029879/processcontroller-1.1.0.tar.gz" } ], "1.4.0": [ { "comment_text": "", "digests": { "md5": "c9732a4dbfc93222fcfabc735b0f80d1", "sha256": "7cb7f16a9566a71d67a37d27dc062759530dc9290906647e8458b234dcd75e89" }, "downloads": -1, "filename": "processcontroller-1.4.0.tar.gz", "has_sig": false, "md5_digest": "c9732a4dbfc93222fcfabc735b0f80d1", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3", "size": 4680, "upload_time": "2018-11-10T14:17:21", "url": "https://files.pythonhosted.org/packages/9f/9e/1f5551af26c58c63f6788fd1ab3cfaf6121109c4d09c685adb15043ccbd2/processcontroller-1.4.0.tar.gz" } ], "1.4.1.dev1": [ { "comment_text": "", "digests": { "md5": "88e1293cf5b22e9a4840790f4e6c74a3", "sha256": "8c0fe71edf100748346b72ae2b8c3dc1b75f3244637b2ecdf56391e04fb7cfbd" }, "downloads": -1, "filename": "processcontroller-1.4.1.dev1.tar.gz", "has_sig": false, "md5_digest": "88e1293cf5b22e9a4840790f4e6c74a3", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3", "size": 4693, "upload_time": "2018-11-10T14:29:50", "url": "https://files.pythonhosted.org/packages/cb/39/3d2a12bf3ac77c4b61b2a3f677d3ea3e48555785b392077318630e84b159/processcontroller-1.4.1.dev1.tar.gz" } ], "1.5.0": [ { "comment_text": "", "digests": { "md5": "85295916b2e787d2d0273768c060c6f0", "sha256": "6d9a13ac90d0cd3d2bfeff0661ad73e2ee5f5e895bd5a0d9f885e1b5e5e09713" }, "downloads": -1, "filename": "processcontroller-1.5.0.tar.gz", "has_sig": false, "md5_digest": "85295916b2e787d2d0273768c060c6f0", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3", "size": 4686, "upload_time": "2018-11-10T14:31:40", "url": "https://files.pythonhosted.org/packages/3c/a6/9d53ff836247d36d7b5bf0123928c755f744d1f59f43d4da7eca24469e7f/processcontroller-1.5.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "85295916b2e787d2d0273768c060c6f0", "sha256": "6d9a13ac90d0cd3d2bfeff0661ad73e2ee5f5e895bd5a0d9f885e1b5e5e09713" }, "downloads": -1, "filename": "processcontroller-1.5.0.tar.gz", "has_sig": false, "md5_digest": "85295916b2e787d2d0273768c060c6f0", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3", "size": 4686, "upload_time": "2018-11-10T14:31:40", "url": "https://files.pythonhosted.org/packages/3c/a6/9d53ff836247d36d7b5bf0123928c755f744d1f59f43d4da7eca24469e7f/processcontroller-1.5.0.tar.gz" } ] }