Python 3.7 Runtime Now Available in IBM Cloud Functions

5 min read

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 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 --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

Be the first to hear about news, product updates, and innovation from IBM Cloud