Skip to content

Instantly share code, notes, and snippets.

@kissarat
Created March 24, 2021 13:59
Show Gist options
  • Save kissarat/8aeb2ec325ac66933e41c645424887f6 to your computer and use it in GitHub Desktop.
Save kissarat/8aeb2ec325ac66933e41c645424887f6 to your computer and use it in GitHub Desktop.
Get summary for pip packages, use . pip-summary.sh requirements.txt
#!/usr/bin/env bash
# Get summary for pip packages
# . pip-summary.sh requirements.txt
for package in $(cat $1 | sort); do
if `pip3 install -q --no-deps $package`; then
package_name=$(echo $package | sed -e 's/==.*//g')
pip3 show $package_name \
| awk -v name=Summary 'BEGIN { FS=":" } (name == $1) { print $2 }' \
| echo "$package_name:" $(cat)
fi
done
@kissarat
Copy link
Author

You can use it for project dependencies investigation. For example

. pip-summary.sh requirements.txt > packages-summary.txt
cat packages-summary.txt
Babel: Internationalization utilities
Django: A high-level Python Web framework that encourages rapid development and clean, pragmatic design.
Fabric: Fabric is a simple, Pythonic tool for remote execution and deployment.
Jinja2: A small but fast and easy to use stand-alone template engine written in pure python.
MarkupSafe: Implements a XML/HTML/XHTML Markup safe string for Python
PyJWT: JSON Web Token implementation in Python
PyNaCl: Python binding to the Networking and Cryptography (NaCl) library
PyYAML: YAML parser and emitter for Python
Pygments: Pygments is a syntax highlighting package written in Python.
Send2Trash: Send file to trash natively under Mac OS X, Windows and Linux.
Unidecode: ASCII transliterations of Unicode text
amqp: Low-level AMQP client for Python (fork of amqplib).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment