Skip to main content

add my ‘pip_add’ script

ID
451d562
date
2022-10-24 22:04:24+00:00
author
Alex Chan <alex@alexwlchan.net>
parent
312c6f0
message
add my 'pip_add' script
changed files
1 file, 16 additions

Changed files

pip_add (0) → pip_add (300)

diff --git a/pip_add b/pip_add
new file mode 100755
index 0000000..4cc696c
--- /dev/null
+++ b/pip_add
@@ -0,0 +1,16 @@
+#!/usr/bin/env bash
+
+set -o errexit
+set -o nounset
+
+NAME="$1"
+
+# Add the new library to requirements.in
+pip freeze | grep "$NAME" >> requirements.in
+
+# Now sort the file
+sort requirements.in > requirements.in.tmp
+mv requirements.in.tmp requirements.in
+
+# And rebuild the requirements.txt
+pip-compile