python:fabric

Fabric - シンプルな Pythonic リモート実行とデプロイメント

$ pip install fabric

Collecting fabric
  Downloading fabric-3.0.0-py3-none-any.whl (53 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 53.3/53.3 kB 343.5 kB/s eta 0:00:00
Collecting invoke>=2.0
  Downloading invoke-2.0.0-py3-none-any.whl (162 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 162.2/162.2 kB 908.3 kB/s eta 0:00:00
Collecting paramiko>=2.4
  Downloading paramiko-3.1.0-py3-none-any.whl (211 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 211.2/211.2 kB 1.1 MB/s eta 0:00:00
Collecting bcrypt>=3.2
  Downloading bcrypt-4.0.1-cp36-abi3-manylinux_2_28_x86_64.whl (593 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 593.7/593.7 kB 1.8 MB/s eta 0:00:00
Collecting cryptography>=3.3
  Downloading cryptography-40.0.1-cp36-abi3-manylinux_2_28_x86_64.whl (3.7 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.7/3.7 MB 2.9 MB/s eta 0:00:00
Collecting pynacl>=1.5
  Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (856 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 856.7/856.7 kB 511.0 kB/s eta 0:00:00
Requirement already satisfied: cffi>=1.12 in ./pyJupyterLab/lib64/python3.11/site-packages (from cryptography>=3.3->paramiko>=2.4->fabric) (1.15.1)
Requirement already satisfied: pycparser in ./pyJupyterLab/lib64/python3.11/site-packages (from cffi>=1.12->cryptography>=3.3->paramiko>=2.4->fabric) (2.21)
Installing collected packages: invoke, bcrypt, pynacl, cryptography, paramiko, fabric
Successfully installed bcrypt-4.0.1 cryptography-40.0.1 fabric-3.0.0 invoke-2.0.0 paramiko-3.1.0 pynacl-1.5.0

$ pip show {fabric,invoke,paramiko}

Name: fabric
Version: 3.0.0
Summary: High level SSH command execution
Home-page: https://fabfile.org
Author: Jeff Forcier
Author-email: jeff@bitprophet.org
License: BSD
Location: /home/tomoyan/pyJupyterLab/lib64/python3.11/site-packages
Requires: invoke, paramiko
Required-by: 
---
Name: invoke
Version: 2.0.0
Summary: Pythonic task execution
Home-page: https://pyinvoke.org
Author: Jeff Forcier
Author-email: jeff@bitprophet.org
License: BSD
Location: /home/tomoyan/pyJupyterLab/lib64/python3.11/site-packages
Requires: 
Required-by: fabric
---
Name: paramiko
Version: 3.1.0
Summary: SSH2 protocol library
Home-page: https://paramiko.org
Author: Jeff Forcier
Author-email: jeff@bitprophet.org
License: LGPL
Location: /home/tomoyan/pyJupyterLab/lib64/python3.11/site-packages
Requires: bcrypt, cryptography, pynacl
Required-by: fabric

> pip install fabric
Collecting fabric
  Downloading fabric-2.6.0-py2.py3-none-any.whl (53 kB)
     |████████████████████████████████| 53 kB 339 kB/s
Collecting pathlib2
  Downloading pathlib2-2.3.5-py2.py3-none-any.whl (18 kB)
Collecting invoke<2.0,>=1.3
  Downloading invoke-1.5.0-py3-none-any.whl (211 kB)
     |████████████████████████████████| 211 kB 656 kB/s
Collecting paramiko>=2.4
  Downloading paramiko-2.7.2-py2.py3-none-any.whl (206 kB)
     |████████████████████████████████| 206 kB 726 kB/s
Collecting pynacl>=1.0.1
  Downloading PyNaCl-1.4.0-cp35-abi3-win_amd64.whl (206 kB)
     |████████████████████████████████| 206 kB 930 kB/s
Collecting bcrypt>=3.1.3
  Downloading bcrypt-3.2.0-cp36-abi3-win_amd64.whl (28 kB)
Collecting cryptography>=2.5
  Downloading cryptography-3.4.7-cp36-abi3-win_amd64.whl (1.6 MB)
     |████████████████████████████████| 1.6 MB 504 kB/s
Collecting six>=1.4.1
  Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting cffi>=1.1
  Downloading cffi-1.14.5-cp39-cp39-win_amd64.whl (179 kB)
     |████████████████████████████████| 179 kB 409 kB/s
Collecting pycparser
  Using cached pycparser-2.20-py2.py3-none-any.whl (112 kB)
Installing collected packages: pycparser, six, cffi, pynacl, cryptography, bcrypt, pathlib2, paramiko, invoke, fabric
Successfully installed bcrypt-3.2.0 cffi-1.14.5 cryptography-3.4.7 fabric-2.6.0 invoke-1.5.0 paramiko-2.7.2 pathlib2-2.3.5 pycparser-2.20 pynacl-1.4.0 six-1.16.0

fabric❓ fabric2❓ Fabric3❓❓ Version 1.x 2.x …🤯 😅💦💦💦w

結論: fabric をインストールしよう!🤤 fabric2 は、1.x のユーザーが 2.0 への移行用で、fabric3 は不正なフォークです😅

fabric - Search results · PyPI
fabric - Search results · PyPI

Welcome to Fabric! — Fabric documentation (翻訳)より抜粋

fabric and fabric2 vs fabric3
fabric と fabric2 vs Fabric3

Unfortunately, the fabric3 entry on PyPI is an unauthorized fork of Fabric 1.x which we do not control.
残念ながら、PyPI の fabric3 エントリは Fabric 1.x の不正なフォークであり、私たちは管理していません。
Once modern Fabric gets up to 3.x, 4.x etc, we’ll likely continue distributing it via both fabric and fabric2 for convenience; there will never be any official fabric3, fabric4 etc.
モダンなファブリックが 3.x、4.x などになったら、私たちは便宜上 fabric と fabric2 の両方を介して配布を続けるでしょう。公式の fabric3、fabric4などは決してありません。

In other words, fabric2 is purely there to help users of 1.x cross the 2.0 “major rewrite” barrier; future major versions will not be large rewrites and will only have small sets of backward incompatibilities.
言い換えると、fabric2 は、1.x のユーザーが 2.0 の “主要な書き換え” の壁を越えるのを助けるためだけに存在します。将来のメジャー バージョンは大規模な書き換えではなく、下位互換性のない小さなセットのみが含まれます。

本家: Installing#fabric and fabric2 vs fabric3 — Fabric documentation より
GitHub: Clarify fabric vs fabric2 vs fabric3 differences · Issue #1791 · fabric/fabric (翻訳)
Upgrading from 1.x
1.x からのアップグレード

Modern Fabric (2+) represents a near-total reimplementation & reorganization of the software. It's been broken in two, cleaned up, made more explicit, and so forth.
Modern Fabric (2+) は、ソフトウェアのほぼ完全な再実装と再編成を表しています。それは 2 つに分割され、クリーンアップされ、より明確化されました。

Upgrading from 1.x — Fabric documentation より

Welcome to Invoke! — Invoke documentation より抜粋

Why was Invoke split off from the Fabric project?
Invoke が Fabric プロジェクトから分離されたのはなぜですか?

Fabric (1.x and earlier) was a hybrid project implementing two feature sets: task execution (organization of task functions, execution of them via CLI, and local shell commands) and high level SSH actions (organization of servers/hosts, remote shell commands, and file transfer).
Fabric (1.x 以前) は、次の 2 つの機能セットを実装するハイブリッド プロジェクトでした。 タスクの実行 (タスク関数の編成、CLI によるそれらの実行、およびローカル シェル コマンド) そして 高レベルの SSH アクション (サーバー/ホストの編成、リモート シェル コマンド、およびファイル転送)。

However, over time it became clear many users only needed one or the other, with local-only users resenting heavy SSH/crypto install requirements, and remote-focused users struggling with API limitations caused by the hybrid codebase.
しかし、時間が経つにつれて、多くのユーザーがどちらか一方だけを必要とすることが明らかになりました。ローカルのみのユーザーが重い SSH/crypto インストール要件に不満を持っている場合、そして、ハイブリッド コードベースによって引き起こされる API の制限に苦しんでいるリモート フォーカスのユーザー。

When planning Fabric 2.x, having the “local” feature set as a standalone library made sense, and it seemed plausible to design the SSH component as a separate layer above. Thus, Invoke was created to focus exclusively on local and abstract concerns, leaving Fabric 2.x concerned only with servers and network commands.
Fabric 2.x を計画する場合、「ローカル」機能をスタンドアロン ライブラリとして設定することは理にかなっています。 そして、SSH コンポーネントを上の別のレイヤーとして設計するのがもっともらしく思えました。したがって、Invoke は、ローカルで抽象的な問題にのみ焦点を当てるように作成され、Fabric 2.x はサーバーとネットワーク コマンドのみを考慮しました。

Frequently asked questions — Invoke documentation より
  • python/fabric.txt
  • 最終更新: 2023/05/07 20:17
  • by ともやん