Introducing Plumbum: Shell Combinators

Tomer Filiba tomerfiliba at gmail.com
Fri May 11 18:00:57 CEST 2012


Write shell-like scripts in pure python (and never resort to writing bash scripts again!)

Plumbum provides local and remote process execution, path abstraction, lots of shell-like utilities and a command-line interface (CLI) application toolkit that beats optparse/argparse to the ground. Give it a try.

http://plumbum.readthedocs.org/

    >>> from plumbum.cmd import ls, grep, wc, cat, head
    >>> ls()
    u'build.py\ndist\ndocs\nLICENSE\nplumbum\nREADME.rst\nsetup.py\ntests\ntodo.txt\n'
    >>> (ls["-a"] | grep["-v", "\\.py"] | wc["-l"])
    u'13\n'
    >>> ((cat["setup.py"] | head["-n", 4]) > "output.txt")()
    u''
    >>> cat("output.txt")
    u'#!/usr/bin/env python\nimport os\n\ntry:\n'


More information about the Python-announce-list mailing list