{ "info": { "author": "Me", "author_email": "me@example.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: Apache Software License", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy" ], "description": "\npype: command-line pipes in Python\n####################################\n\nUsage\n=====\n\n\n\n\nAt the command prompt, use ``pype`` to act on each item in the file with python commands: ::\n\n $ printf 'abc' | pype str.upper\n\n ABC\n\n\nChain python functions together with ``!``: ::\n\n $ printf 'Hello' | pype 'str.upper ! len'\n\n 5\n\nUse ``?`` as a placeholder for the input at each stage: ::\n\n $ printf 'Hello World' | pype 'str.split ! ?[0].upper() + \"!\"'\n\n HELLO!\n\n $ printf 'Hello World' | pype 'str.split ! ?[0].upper() + \"!\" ! ?.replace(\"H\", \"J\")'\n\n JELLO!\n\n\n\nGiven a server responding to ``http://localhost:8080/`` and a list of urls in ``urls.txt`` : ::\n\n http://localhost:8080/Requester_254\n http://localhost:8080/Requester_083\n http://localhost:8080/Requester_128\n http://localhost:8080/Requester_064\n http://localhost:8080/Requester_276\n\n\nAutomatically import required modules and use their functions: ::\n\n $ pype 'str.strip ! requests.get ! ?.text ' < urls.txt\n\n Hello, Requester_254. You are client number 7903 for this server.\n Hello, Requester_083. You are client number 7904 for this server.\n Hello, Requester_128. You are client number 7905 for this server.\n Hello, Requester_064. You are client number 7906 for this server.\n Hello, Requester_276. You are client number 7907 for this server.\n\n\nUse ``map`` to act on each input item (``map`` is the default command). Use ``apply`` to act on the sequence of items. Finding the largest number returned from the server: ::\n\n $ pype --newlines=no map 'str.strip ! requests.get ! ?.text ! ?.split()[6] ! int' apply 'max' < urls.txt\n\n 7933\n\n\nMaking sequential requests is slow. Use ``--async`` to make I/O really fast (see caveats below). ::\n\n $ time pype 'str.strip ! requests.get ! ?.text' < urls.txt\n\n Hello, Requester_254. You are client number 8061 for this server.\n Hello, Requester_083. You are client number 8062 for this server.\n Hello, Requester_128. You are client number 8063 for this server.\n Hello, Requester_064. You are client number 8064 for this server.\n Hello, Requester_276. You are client number 8065 for this server.\n\n real\t0m10.640s\n user\t0m0.548s\n sys\t0m0.022s\n\n\nMaking concurrent requests is much faster: ::\n\n $ time pype --async 'str.strip ! treq.get ! treq.text_content' < urls.txt\n\n Hello, Requester_254. You are client number 8025 for this server.\n Hello, Requester_083. You are client number 8025 for this server.\n Hello, Requester_128. You are client number 8025 for this server.\n Hello, Requester_064. You are client number 8025 for this server.\n Hello, Requester_276. You are client number 8025 for this server.\n\n real\t0m2.626s\n user\t0m0.574s\n sys\t0m0.044s\n\n\n\nInstallation\n============\n\nTBD\n\n\nCaveats\n=======\n\n\n* ``pype`` assumes *trusted command arguments* and *untrusted input stream data*. It uses ``eval`` on your arguments, not on the input stream data. If you use ``exec``, ``eval``, ``subprocess``, or similar commands, you can execute arbitrary code from the input stream.\n\n* ``--async`` currently works only with ``map``, not ``apply`` and works only for a single ``map`` pipe-string, e.g. ``map 'str.upper ! len ! ? & 1'``, not for chains, e.g. ``map str.upper map len map '? & 1'``.\n\n\n\n\nStatus\n======\n\n* Check the issues page for open tickets\n* This package is experimental pre-alpha and is subject to change.\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/me/myproject", "keywords": "", "license": "Apache License 2.0", "maintainer": "", "maintainer_email": "", "name": "thru", "package_url": "https://pypi.org/project/thru/", "platform": "", "project_url": "https://pypi.org/project/thru/", "project_urls": { "Homepage": "https://github.com/me/myproject" }, "release_url": "https://pypi.org/project/thru/0.0.27/", "requires_dist": [ "attrs", "click", "click-default-group", "toolz", "twisted" ], "requires_python": ">=3.6.0", "summary": "Command line pipes for python.", "version": "0.0.27" }, "last_serial": 4324073, "releases": { "0.0.27": [ { "comment_text": "", "digests": { "md5": "8116079468e98a51ea23c071503a358e", "sha256": "eb7d6348ecf2fa8448de4c15f3d62cf25b26f0adc7583e9acf9fa9e74dca135f" }, "downloads": -1, "filename": "thru-0.0.27-py3-none-any.whl", "has_sig": false, "md5_digest": "8116079468e98a51ea23c071503a358e", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6.0", "size": 7483, "upload_time": "2018-09-30T03:34:38", "url": "https://files.pythonhosted.org/packages/fb/6b/1e5167614a9f7ac80089a9dbc494c90a2485075c1e397681a732778482a2/thru-0.0.27-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "8ae51fab3c850e0d1162efccb1c3e6a2", "sha256": "0f39b191a8a3208184b83ebde6005d6cb465c0e57f352a6195f430aceeb25c88" }, "downloads": -1, "filename": "thru-0.0.27.tar.gz", "has_sig": false, "md5_digest": "8ae51fab3c850e0d1162efccb1c3e6a2", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6.0", "size": 8081, "upload_time": "2018-09-30T03:34:40", "url": "https://files.pythonhosted.org/packages/c7/30/14374744e03d83c8fc6602188860c6fa04fc645ff2b2576f2e628f6447b5/thru-0.0.27.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "8116079468e98a51ea23c071503a358e", "sha256": "eb7d6348ecf2fa8448de4c15f3d62cf25b26f0adc7583e9acf9fa9e74dca135f" }, "downloads": -1, "filename": "thru-0.0.27-py3-none-any.whl", "has_sig": false, "md5_digest": "8116079468e98a51ea23c071503a358e", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6.0", "size": 7483, "upload_time": "2018-09-30T03:34:38", "url": "https://files.pythonhosted.org/packages/fb/6b/1e5167614a9f7ac80089a9dbc494c90a2485075c1e397681a732778482a2/thru-0.0.27-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "8ae51fab3c850e0d1162efccb1c3e6a2", "sha256": "0f39b191a8a3208184b83ebde6005d6cb465c0e57f352a6195f430aceeb25c88" }, "downloads": -1, "filename": "thru-0.0.27.tar.gz", "has_sig": false, "md5_digest": "8ae51fab3c850e0d1162efccb1c3e6a2", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6.0", "size": 8081, "upload_time": "2018-09-30T03:34:40", "url": "https://files.pythonhosted.org/packages/c7/30/14374744e03d83c8fc6602188860c6fa04fc645ff2b2576f2e628f6447b5/thru-0.0.27.tar.gz" } ] }