Interesting use of operator overloading to reproduce bits of shell syntax in python.  I haven’t tried playing with it yet. Occasionally I want to solve a problem for which invoking lots of commands in pipelines is the obvious solution and yet has program logic that would be easier to implement, read, and maintain in python; plumbum might provide the middle ground between shell scripts and Python’s subprocess module.

Thanks to for the link.

Plumbum: Shell Combinators and More — Plumbum: Shell Combinators

Andy Grover June 14, 2012 21:57

I was like “this sounds like” but then at the bottom the author mentions it’s somewhat related.

Michael K Johnson June 14, 2012 22:11

Yeah. I’m not sure on the surface the operator overloading qualifies as less “magic” than pbs, but perhaps the mashed up syntax could make it easier to use for replacing shell scripts.

There was a large shell script I wrote for work a few months ago for which I probably would have used plumbum if I had known of it at the time. It would have made it easier to refactor into a much shorter script, and to make the error handling more consistent. The cwd context manager is a particularly nice replacement for the (cd foo; lots; of; commands) subshell syntax.

Scott Tsai June 16, 2012 02:52

IMO, it’s worth using plumbum over pbs just to avoid the clash over the name “pbs”. See:

(tl;dr, Two independent groups both wrote Python modules named “pbs”. “python-pbs” points to one in Debian and the other in Fedora)

Imported from Google+ — content and formatting may not be reliable