Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save AndreVallestero/622d58e36a1592a1e683857884d34953 to your computer and use it in GitHub Desktop.
Save AndreVallestero/622d58e36a1592a1e683857884d34953 to your computer and use it in GitHub Desktop.
#!/bin/bash
#
# Expects two arguments: a pip package and a target directory. Installs the pip
# package and removes unnecessary build artifacts from the resulting package.
#
# See documentation on ./build-layers.sh for more information.
set -e
set -x
TARGET_DIR=$1
pip install scikit-learn pandas -t $TARGET_DIR
find $TARGET_DIR -type f -name "*.so" | xargs -r strip
find $TARGET_DIR -type f -name "*.pyc" | xargs -r rm
find $TARGET_DIR -type d -name "__pycache__" | xargs -r rm -r
find $TARGET_DIR -type d -name "*.dist-info" | xargs -r rm -r
find $TARGET_DIR -type d -name "tests" | xargs -r rm -r
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment