pipパッケージに最新バージョンが存在するかどうか確認するスクリプトを紹介します。
Bashで動きます。
pip-latestis(){
: e.g. pip-latestis "pip"
: e.g. pip-latestis "youtube-dl"
currentVer="$(pip list | grep "${1}" | awk '{print $2}' | chomp )"
upgradableVer="$(yolk -V "${1}" | awk '{print $2}' | chomp)"
[[ "${currentVer}" != "${upgradableVer}" ]] && \
{ next="sudo pip install --upgrade \"${1}\"" ; \
printf "\n\n${yel}W: The ${1} package ${1} has a new version.${end}: ${grn}${currentVer} / ${upgradableVer}${end}\n\
\tTo upgrade ${1}, ${cyn}${next}${end} or ${cyn}next${end} \n\n" ; } || \
printf "\n\n${grn}The package has no new version. You are on latest.${end}\n\n"
}