Patchwork

raw JSON →
1.0.1 verified Fri May 01 auth: no python maintenance

Patchwork is a deployment and system administration library, powered by Fabric. It provides a set of functions for common operations like file transfer, directory management, and package management. Current version 1.0.1, released last in 2014; library is in maintenance mode (no updates since).

pip install patchwork
error ModuleNotFoundError: No module named 'patchwork'
cause patchwork not installed or installed in wrong environment.
fix
Run pip install patchwork in the same Python environment.
error AttributeError: module 'patchwork' has no attribute 'rsync'
cause Trying to import rsync directly from patchwork instead of submodule.
fix
Use from patchwork.transfers import rsync instead.
error TypeError: rsync() missing 1 required positional argument: 'c'
cause Calling rsync without a connection object (old-style usage).
fix
Pass a Fabric Connection as first argument, e.g., rsync(conn, '/src/', '/dst/').
gotcha patchwork functions expect a `fabric.connection.Connection` object, not an old-style `env.host_string`. Using the deprecated API will fail.
fix Use from fabric import Connection then Connection('host'). Refer to patchwork docs.
deprecated patchwork has not been updated since 2014 and does not support Fabric 3 (which is incompatible). It works with Fabric 2.x only.
fix Pin fabric<3 in your requirements.
gotcha The `patchwork.files` functions like `exists` and `is_link` often require sudo on remote hosts; failing to wrap in sudo will give Permission denied.
fix Use `fabric.runners.Sudo` or set `c.sudo()` before calling patchwork functions.

Example using Fabric Connection and patchwork's rsync function.

from fabric import Connection
from patchwork.transfers import rsync

c = Connection('user@host')
rsync(c, '/local/path/', '/remote/path/')