{ "info": { "author": "philipbergen", "author_email": "philipbergen at gmail com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Console", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: MacOS :: MacOS X", "Operating System :: POSIX :: Linux", "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Topic :: Software Development" ], "description": "===========\npopen\n===========\n\n-----------\nWhat is it?\n-----------\n\nThe ``popen`` package provides a simple shell-like syntax inside python for running\nexternal commands.\n\nFeatures:\n\n* Chaining (aka. piping) as ``Sh('ls') | 'sort'``\n* Redirect stderr to stdout as ``Sh('make').include_stderr | 'wc'``\n* Redirect output to file as ``Sh('ls') > '~/listing.txt'``\n* Iteration over output lines as ``for line in Sh('ls'):``\n* Streaming input into commands in the chain as ``Sh.pipe('~/listing.txt').Sh('grep', '-q', 'code').returncode``\n* Expands special characters (``~*!?``)\n* Expands env vars (``$HOME``) as ``print Sh('ls', '$USER', '~/*')``\n* Properly splits strings (``'echo \"hole in one\"'`` becomes ``['echo', 'hole in one']``)\n* Or iterable arguments (``Sh('ls', '-l') | ['wc', '-l'] > '/dev/null'``)\n\n=====\nTL;DR\n=====\n\nInstallation:\n\n.. code-block:: SH\n\n pip install popen\n\nExample:\n\n.. code-block:: PY\n\n from popen import Sh\n for line in Sh('du', '~/') | 'head -n 10' | 'sort -n':\n print('GOT', line)\n\n=====\nUsage\n=====\n\nSimples usage, run a command and iterate the output lines:\n\n.. code-block:: PY\n\n from popen import Sh\n for line in Sh('ls', '-la', '~'):\n print line\n\nPiping that output to a file:\n\n.. code-block:: PY\n\n Sh('ls', '-la', '~') > '~/listing'\n\nNote that special characters like ``~`` are expanded, as are environment\nvariables (e.g. ``$HOME``).\n\nChaining commands is trivial, here with append instead of write to file:\n\n.. code-block:: PY\n\n Sh('ls') | Sh('sort') >> '~/listing'\n\nBut the right hand side of ``|`` can be very flexible, as it employs\nlexical splitter on string input or takes an iterable:\n\n\n.. code-block:: PY\n\n Sh('ls', '-la', '~') | 'sort -c' | ['uniq', '-c'] | 'tail' | Sh('wc') > '~/listing'\n\nTo run a command and let output go to ``stdout``, ask for the return code:\n\n.. code-block:: PY\n\n cmd = Sh('ls') | 'grep polka'\n print cmd.returncode\n\nTo pipe a string into a command, wrap in an iterable:\n\n.. code-block:: PY\n\n print Sh.pipe(['this is a \\nmulti line\\nstring.']) | 'wc'", "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/philipbergen/popen", "keywords": "bash,shell,popen,subprocess", "license": "UNKNOWN", "maintainer": null, "maintainer_email": null, "name": "popen", "package_url": "https://pypi.org/project/popen/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/popen/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/philipbergen/popen" }, "release_url": "https://pypi.org/project/popen/0.1.20/", "requires_dist": null, "requires_python": null, "summary": "A shell-like DSL front for subprocess.Popen", "version": "0.1.20" }, "last_serial": 1402068, "releases": { "0.1.12": [ { "comment_text": "", "digests": { "md5": "a8bc552c3d152fabc4dce0cbfd3bb8a4", "sha256": "044f0f5f15af4231d1ebcedec82e1a83ef836003b4868b3c797b53916dbd062a" }, "downloads": -1, "filename": "popen-0.1.12.tar.gz", "has_sig": false, "md5_digest": "a8bc552c3d152fabc4dce0cbfd3bb8a4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3594, "upload_time": "2015-01-25T22:34:02", "url": "https://files.pythonhosted.org/packages/e9/3f/74365c5f7bdd91a50ca8071edb65f69267c63c4cb0a2cc94a5dfc3dffc1b/popen-0.1.12.tar.gz" } ], "0.1.13": [ { "comment_text": "", "digests": { "md5": "b847e40b57f2f2f49fa7a3929cf4e3a9", "sha256": "a6d71b5f6ec6f19c3fae2dedf056ccbebcb16bddf60cdb9603679258f027ad6c" }, "downloads": -1, "filename": "popen-0.1.13.tar.gz", "has_sig": false, "md5_digest": "b847e40b57f2f2f49fa7a3929cf4e3a9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4810, "upload_time": "2015-01-26T00:04:02", "url": "https://files.pythonhosted.org/packages/3d/e5/abfe2473024a6276a3034bb58ec4079c1c407dab7e9195189e90e4150164/popen-0.1.13.tar.gz" } ], "0.1.14": [ { "comment_text": "", "digests": { "md5": "06b61c43fd926c290a35663747d858f6", "sha256": "47cf7943eb478a5a29cc86ba801b1f4ed021c1592650de52caf8975e6fba503c" }, "downloads": -1, "filename": "popen-0.1.14.tar.gz", "has_sig": false, "md5_digest": "06b61c43fd926c290a35663747d858f6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4923, "upload_time": "2015-01-26T00:24:23", "url": "https://files.pythonhosted.org/packages/36/8c/a0cc4a55d730b0236d16f279eacaa92d85a77746a416ba73eb7cdc150b6f/popen-0.1.14.tar.gz" } ], "0.1.15": [ { "comment_text": "", "digests": { "md5": "cc0c3b89f73b134eb649c363c9b7399d", "sha256": "2138317572ebda6213a618e546f06fa5125215c402d65adbf34bd548aba339b2" }, "downloads": -1, "filename": "popen-0.1.15.tar.gz", "has_sig": false, "md5_digest": "cc0c3b89f73b134eb649c363c9b7399d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4987, "upload_time": "2015-01-26T17:54:15", "url": "https://files.pythonhosted.org/packages/e2/0e/26a64d0bce930f8afdd60aaf7b3afe7e1aaea48826b23f631b539bc36c76/popen-0.1.15.tar.gz" } ], "0.1.17": [ { "comment_text": "", "digests": { "md5": "6924147c6423f68445713d927d2ab94b", "sha256": "30d9737c73bc73b25f357db313cbb2327cca801133765cd658ece00c64aa7f3c" }, "downloads": -1, "filename": "popen-0.1.17.tar.gz", "has_sig": false, "md5_digest": "6924147c6423f68445713d927d2ab94b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6689, "upload_time": "2015-01-26T23:28:38", "url": "https://files.pythonhosted.org/packages/3e/6d/7ef39f90c953261965f5b632529b23a9a8018d631376d504f60f28e9ae52/popen-0.1.17.tar.gz" } ], "0.1.18": [ { "comment_text": "", "digests": { "md5": "23d1d1350b6732e05c037c11494c8bd1", "sha256": "276ce080995ff4dfaf507afd061e5e9521759b859718e5387396d8965b43b3ac" }, "downloads": -1, "filename": "popen-0.1.18.tar.gz", "has_sig": false, "md5_digest": "23d1d1350b6732e05c037c11494c8bd1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6857, "upload_time": "2015-01-29T00:08:16", "url": "https://files.pythonhosted.org/packages/d6/8f/d61776f737beb0d8f37f16affe5c1ccce2d048c9500026a7b2218e1e439c/popen-0.1.18.tar.gz" } ], "0.1.19": [ { "comment_text": "", "digests": { "md5": "23a788dfa94aada12c9244df44288d27", "sha256": "7e9dbaf7eff913f4f9ac825567ec2ab0c3b277dde1882d399e0130412010afe8" }, "downloads": -1, "filename": "popen-0.1.19.tar.gz", "has_sig": false, "md5_digest": "23a788dfa94aada12c9244df44288d27", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6892, "upload_time": "2015-01-29T18:59:08", "url": "https://files.pythonhosted.org/packages/41/46/787e0cc89d80eaea0e206872e5aae9661cd8975e00f15ac8d37d4f92a0d2/popen-0.1.19.tar.gz" } ], "0.1.20": [ { "comment_text": "", "digests": { "md5": "f32611c0d65a21ee316a5a4e976d8bb0", "sha256": "9271dc3525fd34c1105acc106044ae01580830fd79361ad83c34d7cdfb6b385f" }, "downloads": -1, "filename": "popen-0.1.20.tar.gz", "has_sig": false, "md5_digest": "f32611c0d65a21ee316a5a4e976d8bb0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7038, "upload_time": "2015-01-29T20:44:29", "url": "https://files.pythonhosted.org/packages/04/b1/2bb086fa75a407ff446963ebabc7a91538c4b6c64499f857d94709be54fc/popen-0.1.20.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "f32611c0d65a21ee316a5a4e976d8bb0", "sha256": "9271dc3525fd34c1105acc106044ae01580830fd79361ad83c34d7cdfb6b385f" }, "downloads": -1, "filename": "popen-0.1.20.tar.gz", "has_sig": false, "md5_digest": "f32611c0d65a21ee316a5a4e976d8bb0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7038, "upload_time": "2015-01-29T20:44:29", "url": "https://files.pythonhosted.org/packages/04/b1/2bb086fa75a407ff446963ebabc7a91538c4b6c64499f857d94709be54fc/popen-0.1.20.tar.gz" } ] }