Created
September 19, 2023 22:04
-
-
Save thomaswilley/d15aa6c65fbaa130b8e46c6d247df7c3 to your computer and use it in GitHub Desktop.
One-liner to get python root packages from pip, for a cleaner requirements.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pip freeze | cut -d= -f1 | while read pkg; do pip show "$pkg" | grep "Required-by:" | awk -v pkgname="$pkg" -F': ' '!$2 {print pkgname}'; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment