Python Icon

Plumbum - Pythonic, cross-platform shell syntax

logged by @logbot 2012-05-12T13:27:31Z permalink #python

Plubmum logo

Plumbum is an interesting project from Tomer Filiba that aims to bring shell syntax to Python scripts:

The motto of the library is “Never write shell scripts again”, and thus it attempts to mimic the shell syntax (shell combinators) where it makes sense, while keeping it all pythonic and cross-platform.

A piping example:

>>> chain = ls["-a"] | grep["-v", "\.py"] | wc["-l"]
>>> print chain
/bin/ls -a | /bin/grep -v '.py' | /usr/bin/wc -l
>>> chain()

In addition to piping, Plumbum supports redirection and even remote commands over SSH. Check out the source on GitHub, Tomer’s introductory blog post or the excellent project docs for more.

0:00 / 0:00