plumbum
Plumbum: shell combinators library
What it is and what it does
Plumbum is a Python library that brings shell script syntax and semantics into a real programming language. It lets you compose and execute shell commands using Python operators—piping with `|`, redirection with `<` and `>`, and nesting with bracket notation—while staying cross-platform and Pythonic. The library handles both local command execution and remote execution over SSH, manages working directories and environment variables programmatically, and includes a decorator-based CLI framework for building command-line applications.
Instead of writing separate shell scripts or laboriously constructing subprocess calls, you write Python code that reads like shell commands. It supports foreground and background execution, command composition, and file-system paths as first-class objects. The library also provides color and style utilities for terminal output.
Use it for:
- Build automation and task runners: chain compiler, linker, and build tool invocations with shell-like syntax.
- System administration scripts: execute local and remote commands over SSH with a unified Python API.
- CLI tool development: use the built-in Application framework to define flags, switches, and subcommands.
- Data pipeline orchestration: compose file operations, text processing, and command execution in a single script.
- Cross-platform scripting: write once, run on Windows, Linux, and macOS without rewriting shell logic.
- Log analysis and filtering: pipe commands like grep, awk, and sed equivalents directly in Python.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Plumbum lets you write shell-script-like programs in Python with piping, redirection, and command chaining syntax, plus local and remote command execution over SSH and a CLI application toolkit.
Yes. Plumbum is actively maintained, has no known vulnerabilities, installs with minimal friction, and carries a permissive MIT license. It is well-suited for anyone writing system administration scripts, build automation, or CLI tools who wants to avoid shell scripting or subprocess boilerplate. The library's maturity (first release 2012, currently 2.0.2) and broad Python version support (3.9–3.15) make it a reliable choice.
Install
plumbum on PyPI
pip
pip install plumbumuv
uv add plumbumpoetry
poetry add plumbumInstalling plumbum
Before you install
Low install friction with a single lightweight runtime dependency (typing-extensions). Active maintenance with a recent release (23 days old) and steady repository activity.
License in practice
MIT license permits free use, modification, and distribution with minimal restrictions—suitable for both open-source and proprietary projects.
Quickstart
from plumbum import local
from plumbum.cmd import ls, grep
# Run a single command
local.cmd.ls()
# Pipe commands together
chain = ls["-a"] | grep["-v", r"\.py"]
print(chain())
Requires Python 3.9 or later. Remote SSH execution requires an OpenSSH-compatible client, PuTTY (Windows), or Paramiko installed separately.
Verify before relying
- Whether Paramiko is automatically installed or must be added separately for SSH support.
- Performance characteristics when chaining many commands or executing large batches of remote operations.
- Compatibility with non-POSIX shells on Windows beyond the documented PuTTY support.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — typing-extensions |
| Maintenance | actively maintained — 23 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 6,547,051/month — #1,890 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: plumbum-2.0.2-py3-none-any.whl
Keywords: async, asyncio, cli, color, execution, local, path, pipe, popen, process, remote, shell, ssh
Tags
More Build Tools packages
Provides reusable utilities for Python…
permissive · top 100 on PyPI
tqdmWraps any iterable to display a real-time…
copyleft · top 100 on PyPI
pippip is the standard installer for Python…
permissive · top 100 on PyPI
hatchlingHatchling is a standards-compliant Python build…
permissive · top 100 on PyPI
grpcio-toolsGenerates Python gRPC service stubs and message…
permissive · top 1,000 on PyPI
pre-commitpre-commit is a framework for installing and…
permissive · top 1,000 on PyPI
bashProvides a Python wrapper for running bash…
copyleft · top 15,000 on PyPI
sargeSarge wraps Python's subprocess module to…
permissive · top 15,000 on PyPI
delegator.pyDelegator.py wraps subprocess execution with a…
permissive · top 15,000 on PyPI
pypyppyp lets you write Python expressions and…
permissive · top 15,000 on PyPI
pipePipe enables shell-like infix syntax for…
permissive · top 15,000 on PyPI
subprocess.runProvides a simplified interface to run shell…
permissive · top 15,000 on PyPI
paramiko-expectParamiko Expect adds expect-like pattern…
permissive · top 15,000 on PyPI
fabric2Fabric executes shell commands remotely over…
permissive · top 15,000 on PyPI
fabricFabric executes shell commands remotely over…
permissive · top 5,000 on PyPI
jumpsshJumpSSH runs commands on remote servers through…
permissive · top 15,000 on PyPI