たれぱんのびぼーろく

わたしの備忘録、生物学とプログラミングが多いかも

pipでGitHubレポジトリをinstallする

最小手

build instruction (setup.py or pyproject.toml) があるGitHubレポジトリに対して

pip install git+https://github.com/bkvogel/griffin_lim

以上。

pipとバージョン管理システム

pipはバージョン管理システム/VCSからのinstallに対応している.
対応システムはGit, Mercurial, Subversion, Bazaar 1

コマンドと規則

Gitからとってくるフルコマンドは

pyproject.tomlの場合

# formal
pip install [-e] vcs+protocol://repo_url
# expamle
pip install git+https://github.com/tarepan/installwithpip

setup.pyの場合

# formal
pip install [-e] vcs+protocol://repo_url/#egg=<project name>-<version>&subdirectory=pkg_dir
# expamle
pip install git+https://github.com/tarepan/installwithpip#egg=mygithubpack&subdirectory=packs

次のようになっている

  • vcs: バージョン管理システム名。例えばgit
  • protocol://repo_url/ : レポジトリのURL. URL欄をコピペすればいい
  • egg=-

    • installされたものに与えられるパッケージ名&バージョンだと思っていたが、挙動が違う。setup.pyがパッケージ名等はコントロール
  • subdirectory=pkg_dir: setup.pyが置いてあるディレクトリのpath

更新

更新する際は同じinstallコマンドを--upgradeを共に実行すればok

references


  1. pip supports installing from Git, Mercurial, Subversion and Bazaar, and detects the type of VCS using url prefixes: “git+”, “hg+”, “bzr+”, “svn+”.