-
Notifications
You must be signed in to change notification settings - Fork 152
Description
Description:
CAVEAT: Today is the first time I've looked into how aws-sam-cli works so if I'm missing something glaringly obvious, I apologize. I'm also fairly new to python, so if there's an easy fix just with a requirements.txt flag or something, I'm all ears. However, I've tried a few different things to force it to not use the incompatible wheel and nothing has worked so far.
I'm trying to build a function on the Python 3.6 runtime that uses BeatifulSoup 4.7.1. The function fails because the version of beautifulsoup that gets installed is only compatible with Python2. There are separate versions on pypi for py2 and py3. It's possible that part of this issue may be poor naming on the part of the package maintainer, but all the information needed is included, but possibly not in the way the builder is looking for it.
On pypi.org, there are two wheel files for recent versions:
beautifulsoup4-4.7.1-py2-none-any.whl
beautifulsoup4-4.7.1-py3-none-any.whl
The issue is that on this line: https://github.com/awslabs/aws-lambda-builders/blob/develop/aws_lambda_builders/workflows/python_pip/packager.py#L375
Adding some additional debugging to the builder code reveals that it's downloading the py2 version first and then deciding that it's good enough. The code just exits out because it sees the abi of none without checking the implementation as well. Again, may be this is an incorrectly named package, but I don't know enough about the Python package naming system to know for sure. However, it seems like there could be an additional check before returning to validate that the implementation version matches.
Steps to reproduce the issue:
- Create a Python3.6 lambda function and add beautifulsoup4 to the requirements.txt. Import it into your function.
- Build your function with sam build
- Run the function and see the syntax error - The error message is really bad, but if you trace it down you find that it comes from a line in the beautifulsoup4
__init__.pywhere there is a string in there designed to fail on python3 telling you that you have a version for python2 and need to rebuild it for python3.
Observed result:
Syntax error in module 'app': invalid syntax (__init__.py, line 52)
Expected result:
Function should actually run
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
aws-sam-cli 0.10.0