Wynn Netherland changelog.com/posts

Plumbum - Pythonic, cross-platform shell syntax

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()
u'13n'

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.


Discussion

Sign in or Join to comment or subscribe

Player art
  0:00 / 0:00