About Python Fabric
Fabric is a high-level Python library for executing shell commands remotely via SSH, returning structured Python objects. It combines Invoke for local command execution and Paramiko for SSH, offering a powerful and flexible API. Ideal for automation, deployment, and system administration, Fabric supports single and multi-host operations, Python code blocks, and seamless integration with Invoke's CLI task functionality.
FAQ
If environment variables are not being set correctly, it's likely due to a restrictive AcceptEnv setting on the SSH server. You can modify the server's configuration to allow the environment variables you're setting, or use the inline_ssh_env Connection parameter to force Fabric to send environment variables prefixed before your command strings.
The SSH server runs non-interactive commands via a limited shell call, which doesn't load the same startup files as interactive shells. To work around this, consult your shell's documentation for non-login, non-interactive config files, such as /etc/zshrc or ~/.zshenv for zsh.
Each run or sudo call in Fabric has its own distinct shell session, so commands like 'cd /path/to/application' followed by './update.sh' won't work as you might assume. Instead, use shell logic operations like && to link commands together, or use absolute paths.
This issue is addressed in Invoke's FAQ. Even for Fabric v1, which is not based on Invoke, the answer is the same. Please refer to Invoke's FAQ for more details.
Backgrounded processes can prevent the calling shell from exiting, causing Fabric to hang. To fix this, use a pre-existing daemonization technique, leverage a process manager like supervisord, use tmux or screen to detach the process, or run the program under nohup.
Due to a bug in the SSH layer, Fabric may not always accurately detect the type of authentication needed. If you have an SSH keychain agent running but the remote server can't honor your SSH key, Fabric might prompt for a passphrase when it should be asking for a password. This issue is hoped to be addressed in future releases.
Alternatives to consider
See all alternativesBadges
Promote Python Fabric giving it more exposure, by adding these badges to your website, documentation, or product listing. Each badge links back to Python Fabric page on Webfolio.
<a href="https://www.webfolio.to/tools/python-fabric?utm_source=badge&utm_campaign=badge" target="_blank" rel="noopener noreferrer"><img src="https://www.webfolio.to/badges/featured_color.svg" alt="Featured on Webfolio" style="max-width: 150px" /></a>
Categories
Claim this tool
Are you the founder? Claim your profile to update details and track views.