Google Cloud Functions with Python 3.7


Thu, 26 July 2018

Google's just brought out beta support for Python 3 in their Cloud Functions offering. Getting started is easy.

First, make sure you've got your requirements.txt file with the following:

requests==2.19.0
numpy
flask

Then, your main.py file should look like this:

from flask import Flask
app = Flask(__name__)


@app.route("/")
def hello_world(request):
    """
    :param flask.Request request:
    """
    return "Hello World!"


Finally, you're ready to deploy:

gcloud beta functions deploy hello_world --runtime python37 --trigger-http --project=your-google-cloud-project

We've all been waiting for this, and the day is finally here. Now, it's time to finish my migration away from AWS!