serverless-python-requirements
serverless-python-requirements copied to clipboard
pythonRequirements.zip contains Mac .so files even with slim: true
Are you certain it's a bug?
- [X] Yes, it looks like a bug
Are you using the latest plugin release?
- [X] Yes, I'm using the latest plugin release
Is there an existing issue for this?
- [X] I have searched existing issues, it hasn't been reported yet
Issue description
Looking for what's taking up so much space in our pythonRequirements.zip
I found (Mac-specific) .so and .dylib files there:
-rwxr-xr-x 1 tibbe wheel 3672864 Feb 15 14:42 ./python/PIL/.dylibs/libharfbuzz.0.dylib
-rw-r--r-- 1 tibbe wheel 3901268 Feb 15 14:42 ./python/googleapiclient/discovery_cache/documents/compute.v1.json
-rwxr-xr-x 1 tibbe wheel 4097242 Feb 15 14:42 ./python/cryptography/hazmat/bindings/_rust.abi3.so
-rw-r--r-- 1 tibbe wheel 4143556 Feb 15 14:42 ./python/googleapiclient/discovery_cache/documents/compute.beta.json
-rw-r--r-- 1 tibbe wheel 4720186 Feb 15 14:42 ./python/googleapiclient/discovery_cache/documents/compute.alpha.json
-rw-r--r-- 1 tibbe wheel 5211997 Feb 15 14:42 ./python/googleapiclient/discovery_cache/documents/contentwarehouse.v1.json
-rwxr-xr-x 1 tibbe wheel 11614701 Feb 15 14:42 ./python/cryptography/hazmat/bindings/_openssl.abi3.so
-rwxr-xr-x 1 tibbe wheel 12469896 Feb 15 14:42 ./python/grpc/_cython/cygrpc.cpython-39-darwin.so
Sending these to Lambda doesn't make sense, as Lambda runs on Linux x86-64/ARM and not Mac ARM. Why are these files included?
Service configuration (serverless.yml) content
pythonRequirements:
pythonBin: python3
slim: true
layer: true
noDeploy:
# Shipped in a separate layer:
- Pillow
Project is proprietary so I cannot include the whole config.
Command name and used flags
serverless package
Command output
N/A
Environment information
✗ serverless --version
Running "serverless" from node_modules
Framework Core: 3.26.0 (local) 3.26.0 (global)
Plugin: 6.2.2
SDK: 4.3.2
slim
only removes **/*.py[c|o]
, **/__pycache__*
, and **/*.dist-info*
by default. The .so
files are trimmed only, not removed. If you want to remove anything else you can use:
slimPatterns:
- '**/*.so'
- '**/*.dylib'