Skip to content

Instantly share code, notes, and snippets.

@noromanba
Last active Aug 2, 2022
Embed
What would you like to do?
pseudo `pip-upgrade`
#!/usr/bin/env bash
# pseudo `pip upgrade`
# @version 2022.8.1.0
# @license CC0 Univ PD https://creativecommons.org/publicdomain/zero/1.0/
# @author noromanba https://noromanba.github.io
set -eCx
# pseudo pip-upgrade
# short option for BusyBox e.g. Termux
pip list | \
# --lines='+3'
tail -n '+3' | \
# [^1] pip 22.0+ notice truncate
sed '/^\s*$/,$d' | \
# --fields=1 --delimiter=' '
cut -f 1 -d ' ' | \
xargs pip install --upgrade
# DEV
# [^1]: `pip list` annoying notice put to *stdout* if not installed latest pip package from v22+, notice only pip
#
# ```
# $ pip list
# Package Version
# -------------- ----------
# pip 22.2
# setuptools 63.3.0
#
# [notice] A new release of pip available: 22.2 -> 22.2.1
# [notice] To update, run: pip install --upgrade pip
# $
# ```
#
# WTH
# after install latest pip
#
# ```
# $ pip list
# Package Version
# -------------- ----------
# pip 22.2.1
# setuptools 63.3.0
# $
# ```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment