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


More from Announcements

IBM TechXchange underscores the importance of AI skilling and partner innovation

3 min read - Generative AI and large language models are poised to impact how we all access and use information. But as organizations race to adopt these new technologies for business, it requires a global ecosystem of partners with industry expertise to identify the right enterprise use-cases for AI and the technical skills to implement the technology. During TechXchange, IBM's premier technical learning event in Las Vegas last week, IBM Partner Plus members including our Strategic Partners, resellers, software vendors, distributors and service…

Introducing Inspiring Voices, a podcast exploring the impactful journeys of great leaders

< 1 min read - Learning about other people's careers, life challenges, and successes is a true source of inspiration that can impact our own ambitions as well as life and business choices in great ways. Brought to you by the Executive Search and Integration team at IBM, the Inspiring Voices podcast will showcase great leaders, taking you inside their personal stories about life, career choices and how to make an impact. In this first episode, host David Jones, Executive Search Lead at IBM, brings…

IBM watsonx Assistant and NICE CXone combine capabilities for a new chapter in CCaaS

5 min read - In an age of instant everything, ensuring a positive customer experience has become a top priority for enterprises. When one third of customers (32%) say they will walk away from a brand they love after just one bad experience (source: PWC), organizations are now applying massive investments to this experience, particularly with their live agents and contact centers.  For many enterprises, that investment includes modernizing their call centers by moving to cloud-based Contact Center as a Service (CCaaS) platforms. CCaaS solutions…

See what’s new in SingleStoreDB with IBM 8.0

3 min read - Despite decades of progress in database systems, builders have compromised on at least one of the following: speed, reliability, or ease. They have two options: one, they could get a document database that is fast and easy, but can’t be relied on for mission-critical transactional applications. Or two, they could rely on a cloud data warehouse that is easy to set up, but only allows lagging analytics. Even then, each solution lacks something, forcing builders to deploy other databases for…