{ "info": { "author": "Tomer Filiba", "author_email": "tomerfiliba@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "License :: OSI Approved :: MIT License", "Operating System :: Microsoft :: Windows", "Operating System :: POSIX", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Topic :: Software Development :: Build Tools", "Topic :: System :: Systems Administration" ], "description": ".. image:: https://readthedocs.org/projects/plumbum/badge/\n :target: https://plumbum.readthedocs.io/en/latest/\n :alt: Documentation Status\n.. image:: https://travis-ci.org/tomerfiliba/plumbum.svg?branch=master\n :target: https://travis-ci.org/tomerfiliba/plumbum\n :alt: Linux and Mac Build Status\n.. image:: https://ci.appveyor.com/api/projects/status/github/tomerfiliba/plumbum?branch=master&svg=true\n :target: https://ci.appveyor.com/project/HenrySchreiner/plumbum/branch/master\n :alt: Windows Build Status\n.. image:: https://coveralls.io/repos/tomerfiliba/plumbum/badge.svg?branch=master&service=github\n :target: https://coveralls.io/github/tomerfiliba/plumbum?branch=master\n :alt: Coverage Status\n.. image:: https://img.shields.io/pypi/v/plumbum.svg\n :target: https://pypi.python.org/pypi/plumbum/ \n :alt: PyPI Status\n.. image:: https://img.shields.io/pypi/pyversions/plumbum.svg\n :target: https://pypi.python.org/pypi/plumbum/\n :alt: PyPI Versions\n.. image:: https://anaconda.org/conda-forge/plumbum/badges/version.svg\n :target: https://anaconda.org/conda-forge/plumbum\n :alt: Anaconda-Server Badge\n.. image:: https://img.shields.io/pypi/l/plumbum.svg\n :target: https://pypi.python.org/pypi/plumbum/\n :alt: PyPI License\n.. image:: https://badges.gitter.im/plumbumpy/Lobby.svg\n :alt: Join the chat at https://gitter.im/plumbumpy/Lobby\n :target: https://gitter.im/plumbumpy/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge\n\n\nPlumbum: Shell Combinators\n==========================\n\nEver wished the compactness of shell scripts be put into a **real** programming language? \nSay hello to *Plumbum Shell Combinators*. Plumbum (Latin for *lead*, which was used to create \npipes back in the day) is a small yet feature-rich library for shell script-like programs in Python. \nThe motto of the library is **\"Never write shell scripts again\"**, and thus it attempts to mimic \nthe **shell syntax** (\"shell combinators\") where it makes sense, while keeping it all **Pythonic \nand cross-platform**.\n\nApart from shell-like syntax and handy shortcuts, the library provides local and remote command \nexecution (over SSH), local and remote file-system paths, easy working-directory and environment \nmanipulation, and a programmatic Command-Line Interface (CLI) application toolkit. \nNow let's see some code!\n\n*This is only a teaser; the full documentation can be found at*\n`Read the Docs `_\n\nCheat Sheet\n-----------\n\nBasics\n******\n\n.. code-block:: python\n\n >>> from plumbum import local\n >>> ls = local[\"ls\"]\n >>> ls\n LocalCommand()\n >>> ls()\n u'build.py\\ndist\\ndocs\\nLICENSE\\nplumbum\\nREADME.rst\\nsetup.py\\ntests\\ntodo.txt\\n'\n >>> notepad = local[\"c:\\\\windows\\\\notepad.exe\"]\n >>> notepad() # Notepad window pops up\n u'' # Notepad window is closed by user, command returns\n\nInstead of writing ``xxx = local[\"xxx\"]`` for every program you wish to use, you can \nalso ``import`` commands\n\n.. code-block:: python\n \n >>> from plumbum.cmd import grep, wc, cat, head\n >>> grep\n LocalCommand()\n\nPiping\n******\n\n.. code-block:: python\n \n >>> chain = ls[\"-a\"] | grep[\"-v\", \"\\\\.py\"] | wc[\"-l\"]\n >>> print chain\n /bin/ls -a | /bin/grep -v '\\.py' | /usr/bin/wc -l\n >>> chain()\n u'13\\n'\n\nRedirection\n***********\n\n.. code-block:: python\n\n >>> ((cat < \"setup.py\") | head[\"-n\", 4])()\n u'#!/usr/bin/env python\\nimport os\\n\\ntry:\\n'\n >>> (ls[\"-a\"] > \"file.list\")()\n u''\n >>> (cat[\"file.list\"] | wc[\"-l\"])()\n u'17\\n'\n\nWorking-directory manipulation\n******************************\n\n.. code-block:: python\n \n >>> local.cwd\n \n >>> with local.cwd(local.cwd / \"docs\"):\n ... chain()\n ...\n u'15\\n'\n\nForeground and background execution\n***********************************\n\n.. code-block:: python\n\n >>> from plumbum import FG, BG\n >>> (ls[\"-a\"] | grep[\"\\\\.py\"]) & FG # The output is printed to stdout directly\n build.py\n .pydevproject\n setup.py\n >>> (ls[\"-a\"] | grep[\"\\\\.py\"]) & BG # The process runs \"in the background\"\n \n\nCommand nesting\n***************\n\n.. code-block:: python\n \n >>> from plumbum.cmd import sudo\n >>> print sudo[ifconfig[\"-a\"]]\n /usr/bin/sudo /sbin/ifconfig -a\n >>> (sudo[ifconfig[\"-a\"]] | grep[\"-i\", \"loop\"]) & FG\n lo Link encap:Local Loopback\n UP LOOPBACK RUNNING MTU:16436 Metric:1\n\nRemote commands (over SSH)\n**************************\n\nSupports `openSSH `_-compatible clients, \n`PuTTY `_ (on Windows)\nand `Paramiko `_ (a pure-Python implementation of SSH2)\n\n.. code-block:: python\n\n >>> from plumbum import SshMachine\n >>> remote = SshMachine(\"somehost\", user = \"john\", keyfile = \"/path/to/idrsa\")\n >>> r_ls = remote[\"ls\"]\n >>> with remote.cwd(\"/lib\"):\n ... (r_ls | grep[\"0.so.0\"])()\n ...\n u'libusb-1.0.so.0\\nlibusb-1.0.so.0.0.0\\n'\n\nCLI applications\n****************\n\n.. code-block:: python\n\n import logging\n from plumbum import cli\n\n class MyCompiler(cli.Application):\n verbose = cli.Flag([\"-v\", \"--verbose\"], help = \"Enable verbose mode\")\n include_dirs = cli.SwitchAttr(\"-I\", list = True, help = \"Specify include directories\")\n\n @cli.switch(\"--loglevel\", int)\n def set_log_level(self, level):\n \"\"\"Sets the log-level of the logger\"\"\"\n logging.root.setLevel(level)\n\n def main(self, *srcfiles):\n print \"Verbose:\", self.verbose\n print \"Include dirs:\", self.include_dirs\n print \"Compiling:\", srcfiles\n\n if __name__ == \"__main__\":\n MyCompiler.run()\n\nSample output\n+++++++++++++\n\n::\n\n $ python simple_cli.py -v -I foo/bar -Ispam/eggs x.cpp y.cpp z.cpp\n Verbose: True\n Include dirs: ['foo/bar', 'spam/eggs']\n Compiling: ('x.cpp', 'y.cpp', 'z.cpp')\n\nColors and Styles\n-----------------\n\n.. code-block:: python\n\n from plumbum import colors\n with colors.red:\n print(\"This library provides safe, flexible color access.\")\n print(colors.bold | \"(and styles in general)\", \"are easy!\")\n print(\"The simple 16 colors or\",\n colors.orchid & colors.underline | '256 named colors,',\n colors.rgb(18, 146, 64) | \"or full rgb colors\",\n 'can be used.')\n print(\"Unsafe \" + colors.bg.dark_khaki + \"color access\" + colors.bg.reset + \" is available too.\")\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://plumbum.readthedocs.io", "keywords": "path", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "octarine-plumbum", "package_url": "https://pypi.org/project/octarine-plumbum/", "platform": "POSIX", "project_url": "https://pypi.org/project/octarine-plumbum/", "project_urls": { "Homepage": "https://plumbum.readthedocs.io" }, "release_url": "https://pypi.org/project/octarine-plumbum/0.0.3/", "requires_dist": null, "requires_python": "", "summary": "Plumbum: shell combinators library", "version": "0.0.3" }, "last_serial": 3756201, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "8163128ccd1131ab206c43a8e27d5973", "sha256": "8a5a42dab41d69da7c9a94892d61ec32cc1446169f16e9df69f58f157439d584" }, "downloads": -1, "filename": "octarine-plumbum-0.0.1.tar.gz", "has_sig": false, "md5_digest": "8163128ccd1131ab206c43a8e27d5973", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 89493, "upload_time": "2018-04-11T12:59:55", "url": "https://files.pythonhosted.org/packages/c0/59/d710afc9dcecca392a807467abd67f3de75158656b91835a55d8cf896bdd/octarine-plumbum-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "b39d867f9e8d124745883ac885df6e5d", "sha256": "510e08e42695be1a2e69d935a1e720eeb527d9e9d2a72f61c864d40a53f2ae94" }, "downloads": -1, "filename": "octarine-plumbum-0.0.2.tar.gz", "has_sig": false, "md5_digest": "b39d867f9e8d124745883ac885df6e5d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 89465, "upload_time": "2018-04-11T17:59:25", "url": "https://files.pythonhosted.org/packages/5b/a5/17b226b913006ab66ae1edd2fb5282610b2a7d70c08286233c3f1129568f/octarine-plumbum-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "4370452fa4d5e9aa1d8184ee979e043a", "sha256": "e667efd1edcf36b2874a8aa9e87ee1bfdb9c22da2ef955135da76c1302af62ba" }, "downloads": -1, "filename": "octarine-plumbum-0.0.3.tar.gz", "has_sig": false, "md5_digest": "4370452fa4d5e9aa1d8184ee979e043a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 89458, "upload_time": "2018-04-11T18:02:49", "url": "https://files.pythonhosted.org/packages/54/c0/7bdf00fb27d8bb444f3a85dbe79b84aa521642601c10b9822d8987f0855a/octarine-plumbum-0.0.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "4370452fa4d5e9aa1d8184ee979e043a", "sha256": "e667efd1edcf36b2874a8aa9e87ee1bfdb9c22da2ef955135da76c1302af62ba" }, "downloads": -1, "filename": "octarine-plumbum-0.0.3.tar.gz", "has_sig": false, "md5_digest": "4370452fa4d5e9aa1d8184ee979e043a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 89458, "upload_time": "2018-04-11T18:02:49", "url": "https://files.pythonhosted.org/packages/54/c0/7bdf00fb27d8bb444f3a85dbe79b84aa521642601c10b9822d8987f0855a/octarine-plumbum-0.0.3.tar.gz" } ] }