{ "info": { "author": "Andrey Elizarov", "author_email": "vigilancer@example.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "initially was named after a friend from school, Pavel Hurgcheev - `pash`. then\n`psh`. until free name was found - `pipeish`.\n\nit's like pipes in shell but not exactly. hence `pipe-ish`.\n\n[picture-of-python-looking-like-a-shell]\n\nit is still raw and WIP but mostly behaves like you running commands in shell.\n\nHow to use\n-----\nfor installed package:\n```\nfrom pipeish import Shell\n```\n\nfor development (replace `os.getcwd()` with path to pipeish sources)\n```\nimport os; import sys; sys.path.insert(0, os.getcwd())\nfrom pipeish import Shell\n```\n\nExamples\n-----\n\nsimple as it is:\n\n```\n_()('ls')\n_()('ls -la | head -3') # single string with '|' in shell-like way\n```\n\nit uses `str.split('|')` under the hood, so if your arguments contain `|`s you can feed comma separated list instead.\n\n```\n_()('gzcat stagedb.sql.gz', 'psql -U usermane pentagon_db')\n```\n\nif you need fancy redirections provide tuple (or list) with redirection options instead of string.\noptions are always two characters, first for `stdout` and second for `stderr`.\nfor example, 'nt' means \"redirect stdout to /dev/null and don't redirect stderr\".\n\nthere is a special variant for each stream, 'd', which means 'default behaviour'.\nby default `pipeish` tryies to do what you expect from the same command when it runs in shell.\n\n\n```\n_()(\n ['ls -la', 'nt'],\n ('grep Pip', 'dd')\n)\n```\n\nbut none of these will cope with exit codes.\nfor this to work use `Shell` as context manager:\n\n```\nwith Shell() as _:\n _('true | false')\n```\n\nnow your python script will exits with the same exit code as bash script with same commands. but it will exit right after exiting `with` scope. nothing below context manager will be executed. to disable this behaviour there is `check` argument:\n\n```\nwith Shell(check=False) as _:\n _('true | false')\n\nprint (_.last_retcode)\n```\n\nthis way you can run different `Shell`s in one script which allows more complicated scenarios.\n\n\nto capture outout of command you have to set 'i' option for stdout of last command:\n```\nwith Shell() as _:\n out, err, exit_code = _(['uname -a', 'id'])\n```\n\nthis looks a bit inconvenient, but this is best replacement for POSIX shell redirection syntax I came up so far.\nin this example:\n1. output will be captured into `out` and will not be printed in terminal.\nsimiliar to when you do `out = $(uname -a)` in bash, but here you can capture all two streams along with exit code in one call.\n2. errors will be printed into terminal and will not be captured. which is happening when you forget to set redirect `2>&1` or `2>/dev/null` in bash script.\nyou can totally do it by the way in `pipeish` with respective options `r` or `n` for stderr ('ir' or 'in' for this example).\n3. `exit_code` will contain exit code of _last_ command. which is you kinda expect when running chain of commands.\n\nmore are comming!\n\nfeel free to open issues with common use cases, I'll try to prioritize\nwhat seems important and integrate.\n\n\nLinks\n-----\n\n\"Bash is the JavaScript of systems programming\". Strongly agree.\nhttps://github.com/progrium/bashstyle\n\n\"shell=True: Security Considerations\"\nhttps://docs.python.org/3/library/subprocess.html#security-considerations\n\n\n", "description_content_type": "text/x-rst", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/vigilancer/pipeish", "keywords": "", "license": "WTFPL", "maintainer": "", "maintainer_email": "", "name": "pipeish", "package_url": "https://pypi.org/project/pipeish/", "platform": "", "project_url": "https://pypi.org/project/pipeish/", "project_urls": { "Homepage": "https://github.com/vigilancer/pipeish" }, "release_url": "https://pypi.org/project/pipeish/0.3.0/", "requires_dist": null, "requires_python": "", "summary": "shell pipes and redirecting for python", "version": "0.3.0" }, "last_serial": 4220402, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "e4c77213c33e1eb266c241521dffa4c8", "sha256": "59401b378a82c060925ad1cb8449aae01da72bd3e761a8dd157bf1e1bbf0d03d" }, "downloads": -1, "filename": "pipeish-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "e4c77213c33e1eb266c241521dffa4c8", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 4750, "upload_time": "2018-06-05T12:44:04", "url": "https://files.pythonhosted.org/packages/0e/c4/3be6592cf39b904eda6d7f9054a87b5389d7f2720f8ef6fcf6cee7dfbbb4/pipeish-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "94b39219268f79b9fa8636f5e2607a6a", "sha256": "9db1a3a98b02586c680d8aad46ac50b8981a0aa2a340c6527d8e49736aa45994" }, "downloads": -1, "filename": "pipeish-0.1.0.tar.gz", "has_sig": false, "md5_digest": "94b39219268f79b9fa8636f5e2607a6a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2082, "upload_time": "2018-06-05T12:44:06", "url": "https://files.pythonhosted.org/packages/eb/f5/f0629e5573218b3df3ae751cfec9d1f7a466046f06ab4a6b4532cb197ec4/pipeish-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "1394e83a5c323d40afbc1cca7e9afbe2", "sha256": "54edec06de626feffdccedb03fbd6e9953ad981f668e3ecd800a34e3c38e3777" }, "downloads": -1, "filename": "pipeish-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "1394e83a5c323d40afbc1cca7e9afbe2", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 4872, "upload_time": "2018-06-05T14:36:02", "url": "https://files.pythonhosted.org/packages/3e/57/3d98901886a4fffc241e133d21573f939a0d2f612ceba81a46f63e974835/pipeish-0.1.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "337948c324a6c69dac9c2bb373f5b001", "sha256": "1c6078cc4358716a5ca962809ef4a5504e2c4bee952f95444d74aede1acc6412" }, "downloads": -1, "filename": "pipeish-0.1.1.tar.gz", "has_sig": false, "md5_digest": "337948c324a6c69dac9c2bb373f5b001", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2168, "upload_time": "2018-06-05T14:36:03", "url": "https://files.pythonhosted.org/packages/3e/59/6e877e0ce298acd6c267b208a0dff0d2e08a6ba04d08e5b3838f8357f365/pipeish-0.1.1.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "aca4823a118ccda3363d34ebcf6ee1ab", "sha256": "958511944897767ffd2ff969572928db518ef68cd5fb4767da27002cc1f00e10" }, "downloads": -1, "filename": "pipeish-0.2.0-py3-none-any.whl", "has_sig": false, "md5_digest": "aca4823a118ccda3363d34ebcf6ee1ab", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 4762, "upload_time": "2018-06-10T03:19:41", "url": "https://files.pythonhosted.org/packages/13/ae/bc2bf3d760a485619c77770c0f079a85e1953eecb395f707130bf4670402/pipeish-0.2.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b71a4180768a044898502279d4d83d4d", "sha256": "dc7d4c7d9b3bb32c343743a0c51adb2b5ca6435e3c35aa0178de056907b52233" }, "downloads": -1, "filename": "pipeish-0.2.0.tar.gz", "has_sig": false, "md5_digest": "b71a4180768a044898502279d4d83d4d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2018, "upload_time": "2018-06-10T03:19:43", "url": "https://files.pythonhosted.org/packages/68/18/ae2840ed2aeb6477f491fb70fa8567e8601f7cea810e5228a120a010e27e/pipeish-0.2.0.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "9652e27210aed3bd0009fac56b407833", "sha256": "2f5b104fef2b30401ea0d2e5bf4073c5eb670b16b7d4bff841e30c7d1a57099e" }, "downloads": -1, "filename": "pipeish-0.3.0-py3-none-any.whl", "has_sig": false, "md5_digest": "9652e27210aed3bd0009fac56b407833", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6930, "upload_time": "2018-08-29T21:08:50", "url": "https://files.pythonhosted.org/packages/b8/12/ffe92442b994f14fef67e2299d3f0a2f998e19fd99e1ed680cef2143b12f/pipeish-0.3.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "15d3fddd1921102bfafed2c2eef9191e", "sha256": "48caec29b97ae4d5fc91c680993ceccd1d16d57154e90e968a8af972ef7d7bd2" }, "downloads": -1, "filename": "pipeish-0.3.0.tar.gz", "has_sig": false, "md5_digest": "15d3fddd1921102bfafed2c2eef9191e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4220, "upload_time": "2018-08-29T21:08:51", "url": "https://files.pythonhosted.org/packages/34/c3/b402f91a5f30e1c0b8dbddd5b4f341bca525b0ac06bda6a625b6a3147c8d/pipeish-0.3.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "9652e27210aed3bd0009fac56b407833", "sha256": "2f5b104fef2b30401ea0d2e5bf4073c5eb670b16b7d4bff841e30c7d1a57099e" }, "downloads": -1, "filename": "pipeish-0.3.0-py3-none-any.whl", "has_sig": false, "md5_digest": "9652e27210aed3bd0009fac56b407833", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6930, "upload_time": "2018-08-29T21:08:50", "url": "https://files.pythonhosted.org/packages/b8/12/ffe92442b994f14fef67e2299d3f0a2f998e19fd99e1ed680cef2143b12f/pipeish-0.3.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "15d3fddd1921102bfafed2c2eef9191e", "sha256": "48caec29b97ae4d5fc91c680993ceccd1d16d57154e90e968a8af972ef7d7bd2" }, "downloads": -1, "filename": "pipeish-0.3.0.tar.gz", "has_sig": false, "md5_digest": "15d3fddd1921102bfafed2c2eef9191e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4220, "upload_time": "2018-08-29T21:08:51", "url": "https://files.pythonhosted.org/packages/34/c3/b402f91a5f30e1c0b8dbddd5b4f341bca525b0ac06bda6a625b6a3147c8d/pipeish-0.3.0.tar.gz" } ] }