Fabric: Streamline with Python

Subscribe to our

Python FabricDuring the development process there are many tasks when you need regular execution of a certain set of commands. A lot of time is wasted on repeating the same steps over and over again opening space for errors. Since programmers like to automate their routine, it is easier to script these tasks in a logically organized and programmable manner. This is where Fabric comes in handy.

Fabric is a Python library and command-line tool. It provides a basic suite of operations for interacting with SSH and computer systems in order to automate a wide range of tasks from application deployment to general system (and server) administration tasks. The latter includes almost any job for building a server, maintaining and monitoring it.

Typical use involves creating a "fabfile" which is a Python file or module that contains one or more commands you want to run. They are bundled into a function and can be run both locally and on the remote system. The script is run using the fab tool that is shipped with the library. Although Fabric is Python-based tool, it does not necessarily demand only Python applications. As long as some very basic requirements are met, this library can be used with almost anything regardless of a specific language or a system.

Fabric is a simple pythonic tool for weaving operations locally and remotely on cluster of machines, including applications deployment and starting/stopping services. If you want to run a command on a thousand hosts, you can confidently use Fabric. But if command fails on several hosts and you need to find on which ones, you will need to extend Fabric or use more powerful solutions, like Chef, Salt, Ansible, or Puppet.

Fabric is the system administration and application deployment streamlining library. Its extensive integration with SSH allows streamlining everything using simple scripts. And if Fabric’s components are imported into other Python code, this tool can offer a higher level of a Pythonic interface to the SSH protocol suite than even specialized libraries do. For detailed information visit Fabric website.