What's New

Python 3.7 Runtime Now Available in IBM Cloud Functions

Share this post:

Develop Python Actions using Python 3.7

We are happy to announce that you can develop Python Actions using Python 3.7. You can use this version of Python by specifying the runtime in the CLI with “–kind python:3.7” or selecting Python 3 in the UI when creating a new Action.

What’s new in Python 3.7

The update for Python 3.7 provides a wide range of features, including the following:

  • Context variables
  • Data classes
  • Postponed evaluation of type annotations
  • Customization of access to module attributes
  • The time module gained support for functions with nanosecond resolution

For a complete list of changes, check out the Python 3.7 release notes.

Migrate your Actions to the new Python 3.7

IBM Cloud Functions continues to support creating new Actions using Python 3.6 and Python 2.7. But, it is encouraged to start taking advantage of the new features and performance gains Python 3.7 offers over older versions of Python.

The new Python 3.7 runtime comes with a new major semantic version of the Watson SDK 2.x; the older runtime kind “python:3.6” remains using Watson SDK 1.x to allow a smooth migration of your serverless application utilizing version 1.x of the Watson SDK to the new version 2.x.

In addition, the Python 3.7 runtime includes pip packages for IBM services such as “ibm_db,” “cloudant,” “ibm-cos-sdk,” and “ibmcloudsql.” For a complete list of pip packages included with the runtime, check the IBM Cloud Functions documentation.

New to IBM Cloud Functions?

Excellent! Welcome aboard. The best way to try out the service or get started quickly is to use a hello world action. To read more about using Python and Functions, check out the docs.

Download the IBM CLI and the Functions plugin. Create a file called hello.py that contains the following code:

def main(args):
name = args.get("name", "World")
greeting = "Hello " + name
return {"body": greeting}

Deploy your action as a web action:

ibmcloud fn action update helloPython hello.py --kind python:3.7 --web true

Get the URL for the web action and open it in your browser by running the following command.:

ibmcloud fn action get helloPython --url

Senior Technical Staff Member (STSM) - IBM Cloud Functions

More What's New stories
May 3, 2019

Kubernetes Tutorials: 5 Ways to Get You Building Fast

Ready to start working with Kubernetes? Want to build your Kubernetes skills? The five tutorials in this post will teach you everything you need to know about how to manage your containerized apps with Kubernetes.

Continue reading

May 3, 2019

Using Portworx to Deploy and Manage an HA MySQL Cluster on IBM Cloud Kubernetes Service

This tutorial is a walkthrough of the steps involved in deploying and managing a highly available MySQL cluster on IBM Cloud Kubernetes Service.

Continue reading

May 2, 2019

Kubernetes v1.14.1 Now Available in IBM Cloud Kubernetes Service

We are excited to announce the availability of Kubernetes v1.14.1 for your clusters that are running in IBM Cloud Kubernetes Service. IBM Cloud Kubernetes Service continues to be the first public managed Kubernetes service to support the latest upstream versions from the community.

Continue reading