-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Only works with Python 2.7? #6
Comments
The problem is that Lambda itself only supports Python 2.7 for now. I don't think there's any reason why it wouldn't work on P3, but the On Wed, Feb 10, 2016 at 6:03 PM, Tiago Fassoni notifications@github.com
|
Oops. Totally forgot about that. Mind if I update the README to write about that “limitation"?
|
So, I was thinking more about this, and only the stuff that actually runs AWS side needs to be Py2.7. All the rest can be Python3. However, this means that the tests need to be aware that some functions should only be tested on the target platform. Do you know how to do that with Travis? |
Well, I have absolutely no idea, sorry. |
I believe you could run Python 3 on lambda if you really wanted but you would have to ship a statically compiled version of the python binary along with your code. Sounds pretty gross, though. |
That's a nightmarish idea.. not supporting that! :-P Honestly I expect that Lambda will support multiple Python versions in the next 12 months. Screenshot this and we'll come back to it in a year to see if I was right.. |
That being said, I think we should target 3.5 for all of the local Zappa tools (although I don't know what that will do to the venv packaging stuff. Could relate to our idea to pass custom venvs through the ZAPPA_SETTINGS.) |
Sidenote: I was not able to use zappa with Python 2.7.6 (SSL / Insecure.. warnings from urllib3). With 2.7.11 I had no problems. Maybe you should put this in the Readme as requirement. |
That's interesting. I think that comes because you need to install requests[security] on pythons. |
FWIW Here's some work towards py3 https://github.com/hayd/Zappa/tree/py3. IIUC it's all for nought while lambda in python 2.7 only, but may be worth testing out early anyway. Note: Some unicode handling became a little messier in a few places, but a lot of this could be cleaned up (for one thing by defining b64encode on str). |
Hey guys... we can always add a |
Can you elaborate more on that, @xuru ? I'm not familiar with that pattern. |
I was thinking of the Flask cookiecutter repo https://github.com/sloria/cookiecutter-flask/blob/master/%7B%7Bcookiecutter.app_name%7D%7D/%7B%7Bcookiecutter.app_name%7D%7D/compat.py |
That looks like voodoo to me.. |
I think the only thing that might want to go into a compat module is the b64encode/b64decode (to ensure this handles bytes/unicode consistently and correctly in py2 and py3). As you can see in the second commit above that's the majority of fiddly code repetition. I don't recall if that branch was passing py3 tests yet. |
Note that just actual 2.7 apparently won't do. I wasn't careful in using something recent (e.g. 2.7.12) and when I tried
|
Hmm. Interesting. |
@iJebus Which version of python are you using? (The unicode handing should not be different between minor 2.7 versions...!!) Could that be dependent on the file (rather than the python version)? Or does precisely this same package work with 2.7.12? |
I know this is a bit late in coming but there is a way to run python3 on lambda (it's a bit hackish, but it works): http://www.cloudtrek.com.au/blog/running-python-3-on-aws-lambda/ In my case, I have an API that I'm running in elastic beanstalk (so I get my python 3), but now I need to run some background processes on events from a 3rd party API. So in order to process those events, I need to modify the user object in dynamodb, and set a temporary password (long story). So right there, I have a problem, as now I have to have two copies of the user model, and also two spots that holds the password salt. So I thought, I could have a paired down flask app.py with only the dynamodb stuff and the same settings file etc, as my main API, except I went the python 3 route... |
Soooooo.. that's a really interesting idea. I'm into it. However - is it worth building and maintaining that if official Python 3 support is right around the corner? Maybe we should talk more after reinvent.. |
Could you provide an update on the status of Python 3 support? I would prefer it over 2.7.13 You can go to this AWS forum post to voice your support for python3. |
@nueverest you should ask AWS when they're going to support Python3 on Lambda |
I was really excited to use Zappa, but I've spent the past two days banging my head against an endless stream of problems. Now I realise that it was because Zappa only works on Python 2, and I'm using 3. It would be very helpful to have a prominent warning up at the top of the readme saying something like, "Note: Because AWS Lambda currently only supports Python 2.7, Zappa also only runs on 2.7" |
I just hope that Djago will drop support for legacy python(2) soon enough. |
@1oglop1 Unfortunately there are a lot of projects out there that don't have python 3 support for various reasons. In this case, we're waiting on AWS to implement support. |
As a brand new Zappa user, I wasted ~2 hours migrating from a local docker based environment to Virtual Env only to find out Zappa doesn't support 3.5 :-(. It looks like others have experienced the same thing too[0], so this PR is meant to the be a bare minimum notice that Python 3x is not supported. Down the road, it would be helpful to have a `zappa doctor` type command to validate/troubleshoot this stuff early on. Nonetheless, I'm still excited about this project so keep up the good work! [0] Miserlou#6
See #793 |
Python3 support has arrived! Try it out in 0.41.0! Please report any bugs you find! Nothing is guaranteed but it Works For Me™! |
First of all, awesome work, folks! Really liked it and intend to use.
This is more of a reminder for the README, because, when reading the code, I saw "python2.7" hardcoded and I figured it would be best to write that in the README
The text was updated successfully, but these errors were encountered: