bin/pip-upgrade: Helper script to upgrade all outdated `pip` packages
authorTony Duckles <tony@nynim.org>
Sun, 25 Jul 2021 15:25:22 +0000
committerTony Duckles <tony@nynim.org>
Sun, 25 Jul 2021 15:25:22 +0000
bin/pip-outdated [new file with mode: 0755]
bin/pip-upgrade [new file with mode: 0755]

diff --git a/bin/pip-outdated b/bin/pip-outdated
new file mode 100755 (executable)
index 0000000..bde5fe1
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/sh
+# Show all outdated `pip` packages
+pip=$(type -P pip3)
+$pip list --outdated --format=freeze | \
+    grep -v '^\-e' | \
+    cut -d = -f 1
diff --git a/bin/pip-upgrade b/bin/pip-upgrade
new file mode 100755 (executable)
index 0000000..0fef782
--- /dev/null
@@ -0,0 +1,8 @@
+#!/bin/sh
+# Upgrade all outdated `pip` packages
+# https://stackoverflow.com/a/3452888
+pip=$(type -P pip3)
+$pip list --outdated --format=freeze | \
+    grep -v '^\-e' | \
+    cut -d = -f 1  | \
+    xargs -n1 sudo -H $pip install --upgrade