Fabric 在升级 2.x 之后,几乎就是重写了。很多以前的用法都变了,然后在 1.x 时代,本地和远程都是用一套代码处理,但是 2.x 的时候将 local 处理部分和远程处理部分分别拆分为 fab 和 invoke 了,拆分的理由可以参考这里

以前 Fabric 是不支持 Python 3 的,升级之后的版本可以完美支持 Python 3,然后下面是 Fabric 2.x 的升级理由:

  • Python 3 compatibility support 2.7 and 3.4+
  • Thread-safe
  • API reorganized around fabric.connection.Connection
  • Command-line parser overhauled to allow for regular GNU/POSIX style flags and options on a per-task basis (no more fab mytask:weird=custom,arg=format);
  • Task organization is more explicit and flexible
  • Tasks can declare other tasks to always be run before or after themselves;

更多关系 1.x 和 2.x 的对比可以参考这个网址

忘记 1.x 的一切,然后从头开始