Registry / devops / fabric2

fabric2

JSON →
library3.2.3pypypi✓ verified 89d ago

High-level Python library for SSH command execution and system administration, built on top of Invoke. The current version is 3.2.3 (2024-08). Fabric v2+ is a ground-up rewrite; it is incompatible with the original Fabric 1.x. The library uses an active, though slow, release cadence.

pip install fabric
INSTALL
IMPORT
SIG · FABRIC2
F
fabric2
devopspythonv3.2.3
Install
3.4s avg
Import
752ms
Disk
136MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v? · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.804s · 100.2MB
glibc
py 3.10–3.95 runs
installs and imports cleanly · install 3.4s · import 0.700s · 171MB
136MB installed
● package 136MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Connection
✓ from fabric import Connection
✗ from fabric import Connection
fabric API, not fabric2. This is correct.
task
✓ from invoke import task
✗ from fabric.decorators import task
In v2+ decorators moved to invoke

Basic remote command execution using Fabric's Connection object. Replace auth with your own credentials.

from fabric import Connection # Replace with your host/user/password or use SSH key c = Connection(host='example.com', user='myuser', connect_kwargs={'password': os.environ.get('PASSWORD', '')}) result = c.run('whoami') print(result.stdout.strip())
fab --version
Debug
Known issues
breakingFabric v2/v3 is a complete rewrite of Fabric 1.x. No backward compatibility. Do not import `fabric.api`, `fabric.decorators`, or use `fab` command.
fix
Use `from fabric import Connection`, `from invoke import task`. Run tasks with `invoke` CLI.
affects: >= 2.0
deprecatedThe original Fabric 1.x (fabric<2) is unmaintained. The PyPI package name is now 'fabric', but legacy users might install 'fabric2' (which redirects).
fix
Upgrade to fabric >=2 and rewrite code as per new API.
affects: < 2.0
gotchaThe `run()` method returns a `Result` object, not a string. Many newcomers try to use the result as a string directly.
fix
Access stdout via `result.stdout` or use str cast: `str(result)`. Also check `result.exited` for exit code.
affects: >= 2.0
Errors
Common errors & fixes
KeyError: 'Connection'
Trying to import `Connection` from the wrong submodule (e.g., `fabric.connection` instead of `fabric`).
fix
Use `from fabric import Connection` (not `from fabric.connection import Connection`).
ModuleNotFoundError: No module named 'fabric.decorators'
Using old Fabric 1.x import pattern in Fabric v2+.
fix
Replace with `from invoke import task` for decorators, and use `from fabric import Connection` for connections.
Upgrade
Version history
3.2.3latest on PyPI · released Apr 6, 2026
Audit
Dependencies
invokerequiredUsed for task execution and CLI
paramikorequiredSSH protocol implementation
cryptographyrequiredRequired by paramiko for crypto
Agent activity
8 hits · last 30 days
node
8
Resources