python:fabric

差分

このページの2つのバージョン間の差分を表示します。

この比較画面へのリンク

両方とも前のリビジョン 前のリビジョン
次のリビジョン
前のリビジョン
python:fabric [2019/08/19 07:15] ともやんpython:fabric [2023/05/07 20:17] (現在) – [Fabric - シンプルな Pythonic リモート実行とデプロイメント] ともやん
行 1: 行 1:
-<html> +====== Fabric - シンプルな Pythonic リモート実行とデプロイメント ====== 
-  <style> +{{:python:python_fabric_image.jpg?280|The fabric is an image that is not Febreze.}}\\ 
-    #result pre { +<html><span style="font-size: 0.9rem;font-style: italic;"
-      height200px; +<a href="https://www.flickr.com/photos/154298502@N07/50242060996">"ファブリーズする男性"</a> 
-      overflowscroll; +<span> by <a href="https://www.flickr.com/photos/154298502@N07">duvsbefilmoc</a></span> 
-      overflow-xhidden+ is licensed under  
-    } +<a href="https://creativecommons.org/licenses/by/2.0/?ref=ccsearch&atype=html" style="margin-right5px;">CC BY 2.0</a> 
-  </style+</a></span
-</html> +</html>\\ 
-====== Fabric のインストール ======+ファブリック(fabric) とファブリーズ(febreze) は関係ないです🤤\\ 
 +爽やかなお兄さんがファブ(fab)っていますけど...🤔\\ 
 + 
 +本家: [[https://www.fabfile.org|Welcome to Fabric! — Fabric documentation - fabfile.org]] [[gtr>https://www.fabfile.org|翻訳]]\\ 
 +ソーコード: [[git>fabric/fabric|fabric/fabric: Simple, Pythonic remote execution and deployment.]]\\ 
 +関連: [[https://www.pyinvoke.org|Welcome to Invoke! — Invoke documentation - pyinvoke.org]] [[gtr>https://www.pyinvoke.org|翻訳]]\\ 
 +   [[https://www.paramiko.org/|Welcome to Paramiko! — Paramiko documentation]] [[gtr>https://www.paramiko.org/|翻訳]]\\ 
 +ドキュメン: [[https://docs.pyinvoke.org|Welcome to Invoke’s documentation! — Invoke documentation]] [[gtr>https://docs.pyinvoke.org|翻訳]]\\ 
 +スコード: [[git>pyinvoke/invoke|pyinvoke/invoke: Pythonic task management & command execution.]]\\ 
 +       [[git>paramiko/paramiko|GitHub - paramiko/paramiko: The leading native Python SSHv2 protocol library.]]\\
  
 ===== Linux ===== ===== Linux =====
-<code+<WRAP color_term
-pip3 install fabric +<WRAP color_connamd><html><pre> 
-</code>+<b class=GRN>$</b> <b class=HIY>pip</b> install fabric 
 +</pre></html></WRAP> 
 +<WRAP color_result><html><pre> 
 +Collecting fabric 
 +  Downloading fabric-3.0.0-py3-none-any.whl (53 kB) 
 +     <b class=PipBAR>━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━</b> <b class=GRN>53.3/53.3 kB</b> <b class=RED>343.5 kB/s</b> eta <b class=CYN>0:00:00</b> 
 +Collecting invoke>=2.0 
 +  Downloading invoke-2.0.0-py3-none-any.whl (162 kB) 
 +     <b class=PipBAR>━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━</b> <b class=GRN>162.2/162.2 kB</b> <b class=RED>908.3 kB/s</b> eta <b class=CYN>0:00:00</b> 
 +Collecting paramiko>=2.4 
 +  Downloading paramiko-3.1.0-py3-none-any.whl (211 kB) 
 +     <b class=PipBAR>━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━</b> <b class=GRN>211.2/211.2 kB</b> <b class=RED>1.1 MB/s</b> eta <b class=CYN>0:00:00</b> 
 +Collecting bcrypt>=3.2 
 +  Downloading bcrypt-4.0.1-cp36-abi3-manylinux_2_28_x86_64.whl (593 kB) 
 +     <b class=PipBAR>━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━</b> <b class=GRN>593.7/593.7 kB</b> <b class=RED>1.8 MB/s</b> eta <b class=CYN>0:00:00</b> 
 +Collecting cryptography>=3.3 
 +  Downloading cryptography-40.0.1-cp36-abi3-manylinux_2_28_x86_64.whl (3.7 MB) 
 +     <b class=PipBAR>━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━</b> <b class=GRN>3.7/3.7 MB</b> <b class=RED>2.9 MB/s</b> eta <b class=CYN>0:00:00</b> 
 +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) 
 +     <b class=PipBAR>━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━</b> <b class=GRN>856.7/856.7 kB</b> <b class=RED>511.0 kB/s</b> eta <b class=CYN>0:00:00</b> 
 +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 
 +</pre></html></WRAP> 
 +</WRAP> 
 + 
 +<WRAP color_term> 
 +<WRAP color_connamd><html><pre> 
 +<b class=GRN>$</b> <b class=HIY>pip</b> show {fabric,invoke,paramiko} 
 +</pre></html></WRAP> 
 +<WRAP color_result_long><html><pre> 
 +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 
 +</pre></html></WRAP> 
 +</WRAP>
  
 ===== Windows ===== ===== Windows =====
-<code>+<WRAP color_term> 
 +<WRAP color_command><code>
 > pip install fabric > pip install fabric
-</code> +</code></WRAP> 
-<WRAP prewrap 100% #result+<WRAP color_result><code>
-<code>+
 Collecting fabric Collecting fabric
-  Downloading https://files.pythonhosted.org/packages/d9/e4/e6fa248c94ee5d45def54b609fcf70f39d0b7f7050f2d4405c5f156b5516/fabric-2.4.0-py2.py3-none-any.whl (51kB+  Downloading fabric-2.6.0-py2.py3-none-any.whl (53 kB
-     |████████████████████████████████| 61kB 990kB/s +     |████████████████████████████████| 53 kB 339 kB/s 
-Requirement already satisfied: cryptography>=1.1 in c:\python37\lib\site-packages (from fabric) (2.7+Collecting pathlib2 
-Collecting invoke<2.0,>=1.1 (from fabric) +  Downloading pathlib2-2.3.5-py2.py3-none-any.whl (18 kB
-  Downloading https://files.pythonhosted.org/packages/be/9f/8508712c9cad73ac0c8eeb2c3e51c9ef65136653dda2b512bde64109f023/invoke-1.2.0-py3-none-any.whl (206kB+Collecting invoke<2.0,>=1.3 
-     |████████████████████████████████| 215kB 3.3MB/s +  Downloading invoke-1.5.0-py3-none-any.whl (211 kB
-Requirement already satisfied: paramiko>=2.4 in c:\python37\lib\site-packages (from fabric) (2.6.0+     |████████████████████████████████| 211 kB 656 kB/s 
-Requirement already satisfied: asn1crypto>=0.21.0 in c:\python37\lib\site-packages (from cryptography>=1.1->fabric) (0.24.0) +Collecting paramiko>=2.4 
-Requirement already satisfied: cffi!=1.11.3,>=1.8 in c:\python37\lib\site-packages (from cryptography>=1.1->fabric(1.12.3) +  Downloading paramiko-2.7.2-py2.py3-none-any.whl (206 kB
-Requirement already satisfied: six>=1.4.1 in c:\python37\lib\site-packages (from cryptography>=1.1->fabric) (1.12.0+     |████████████████████████████████| 206 kB 726 kB/s 
-Requirement already satisfied: pynacl>=1.0.1 in c:\python37\lib\site-packages (from paramiko>=2.4->fabric) (1.3.0+Collecting pynacl>=1.0.
-Requirement already satisfied: bcrypt>=3.1.3 in c:\python37\lib\site-packages (from paramiko>=2.4->fabric) (3.1.7+  Downloading PyNaCl-1.4.0-cp35-abi3-win_amd64.whl (206 kB) 
-Requirement already satisfied: pycparser in c:\python37\lib\site-packages (from cffi!=1.11.3,>=1.8->cryptography>=1.1->fabric) (2.19) +     |████████████████████████████████| 206 kB 930 kB/s 
-Installing collected packages: invoke, fabric +Collecting bcrypt>=3.1.3 
-Successfully installed fabric-2.4.0 invoke-1.2.0 +  Downloading bcrypt-3.2.0-cp36-abi3-win_amd64.whl (28 kB
-</code>+Collecting cryptography>=2.
 +  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 packagespycparser, 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 
 +</code></WRAP>
 </WRAP> </WRAP>
 +
 +===== いつも混乱するかもしれない Fabric のバージョン =====
 +fabric❓ fabric2❓ Fabric3❓❓ Version 1.x 2.x ...🤯 😅💦💦💦w\\
 +
 +**結論: fabric をインストールしよう!🤤 fabric2 は、1.x のユーザーが 2.0 への移行用で、fabric3 は不正なフォークです😅**\\
 +
 +[[https://pypi.org/search/?q=fabric&o=|fabric - Search results · PyPI]]\\
 +{{:python:pypi_search_fabric_001.png?640|fabric - Search results · PyPI}}\\
 +
 +===== Fabric 1.x から 2.x へ再実装された経緯 =====
 +[[https://www.fabfile.org/|Welcome to Fabric! — Fabric documentation]] ([[https://www-fabfile-org.translate.goog/?_x_tr_sl=en&_x_tr_tl=ja&_x_tr_hl=ja&_x_tr_pto=sc|翻訳]])より抜粋\\
 +<html>
 +  <style>
 +  .plugin_note {
 +    text-align: left;
 +    font-size: 12px;
 +  }
 +  </style>
 +</html>
 +
 +==== fabric and fabric2 vs fabric3 ====
 +<note>
 +**fabric and fabric2 vs fabric3**\\
 +<wrap hi>**fabric と fabric2 vs Fabric3**</wrap>\\
 +\\
 +Unfortunately, the fabric3 entry on PyPI is an unauthorized fork of Fabric 1.x which we do not control.\\
 +<wrap hi>//残念ながら、PyPI の fabric3 エントリは Fabric 1.x の不正なフォークであり、私たちは管理していません。//</wrap>\\
 +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.\\
 +<wrap hi>//モダンなファブリックが 3.x、4.x などになったら、私たちは便宜上 fabric と fabric2 の両方を介して配布を続けるでしょう。公式の fabric3、fabric4などは決してありません。//</wrap>\\
 +\\
 +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.\\
 +<wrap hi>//言い換えると、fabric2 は、1.x のユーザーが 2.0 の “主要な書き換え” の壁を越えるのを助けるためだけに存在します。将来のメジャー バージョンは大規模な書き換えではなく、下位互換性のない小さなセットのみが含まれます。//</wrap>\\
 +\\
 +本家: [[https://www.fabfile.org/installing.html#fabric-and-fabric2-vs-fabric3|Installing#fabric and fabric2 vs fabric3 — Fabric documentation]] より\\
 +GitHub: [[git>fabric/fabric/issues/1791|Clarify fabric vs fabric2 vs fabric3 differences · Issue #1791 · fabric/fabric]] ([[https://github-com.translate.goog/fabric/fabric/issues/1791?_x_tr_sl=zh-CN&_x_tr_tl=ja&_x_tr_hl=ja&_x_tr_pto=sc|翻訳]])\\
 +</note>
 +
 +==== Upgrading from 1.x ====
 +<note>
 +**Upgrading from 1.x**\\
 +<wrap hi>//**1.x からのアップグレード**//</wrap>\\
 +\\
 +Modern Fabric (2+) represents a near-total reimplementation & reorganization of the software. It's been [[https://www.pyinvoke.org/faq.html#invoke-split-from-fabric|broken in two]], cleaned up, made more explicit, and so forth.\\
 +<wrap hi>//Modern Fabric (2+) は、ソフトウェアのほぼ完全な再実装と再編成を表しています。それは [[https://www.pyinvoke.org/faq.html#invoke-split-from-fabric|2 つに分割され]]、クリーンアップされ、より明確化されました。//</wrap>\\
 +\\
 +[[https://www.fabfile.org/upgrading.html|Upgrading from 1.x — Fabric documentation]] より\\
 +</note>
 +
 +==== Why was Invoke split off from the Fabric project? ====
 +[[https://www.pyinvoke.org/|Welcome to Invoke! — Invoke documentation]] より抜粋\\
 +<note>
 +**Why was Invoke split off from the Fabric project?**\\
 +<wrap hi>//**Invoke が Fabric プロジェクトから分離されたのはなぜですか?**//</wrap>\\
 +\\
 +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).\\
 +<wrap hi>//Fabric (1.x 以前) は、次の 2 つの機能セットを実装するハイブリッド プロジェクトでした。
 +タスクの実行 (タスク関数の編成、CLI によるそれらの実行、およびローカル シェル コマンド) そして
 +高レベルの SSH アクション (サーバー/ホストの編成、リモート シェル コマンド、およびファイル転送)。//</wrap>\\
 +\\
 +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.\\
 +<wrap hi>//しかし、時間が経つにつれて、多くのユーザーがどちらか一方だけを必要とすることが明らかになりました。ローカルのみのユーザーが重い SSH/crypto インストール要件に不満を持っている場合、そして、ハイブリッド コードベースによって引き起こされる API の制限に苦しんでいるリモート フォーカスのユーザー。//</wrap>\\
 +\\
 +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.\\
 +<wrap hi>//Fabric 2.x を計画する場合、「ローカル」機能をスタンドアロン ライブラリとして設定することは理にかなっています。
 +そして、SSH コンポーネントを上の別のレイヤーとして設計するのがもっともらしく思えました。したがって、Invoke は、ローカルで抽象的な問題にのみ焦点を当てるように作成され、Fabric 2.x はサーバーとネットワーク コマンドのみを考慮しました。//</wrap>\\
 +\\
 +[[https://www.pyinvoke.org/faq.html|Frequently asked questions — Invoke documentation]] より\\
 +</note>
 +
 +===== タスク定義 =====
 +[[https://docs.fabfile.org/en/1.12.1/usage/tasks.html|Defining tasks — Fabric documentation]] ([[gtr>https://docs.fabfile.org/en/1.12.1/usage/tasks.html|翻訳]])\\
 +
 +===== 参考文献 =====
 +[[https://fabric-ja.readthedocs.io/ja/latest/index.html|Fabricのドキュメントへようこそ ! — Fabric ドキュメント]] (1.10.1 日本語訳 古い)\\
 +[[https://fabric-ja.readthedocs.io/ja/latest/usage/interactivity.html|リモートプログラムとのやりとり — Fabric ドキュメント]]\\
 +
 +==== 付録 ====
 +[[tw>tomoyan596sp/status/1642416698392449024|JupyterLab の Notebook で自動インストールを始めた🤤Python の Invoke Responder で、入力に自動応答できるけど英語文献しか出てこないようだ🤔Automatically responding to program output — Invoke documentation]]\\
 +
  • python/fabric.1566166555.txt.gz
  • 最終更新: 2019/08/19 07:15
  • by ともやん