November 23, 2018 By Carlos Santana 2 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 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

More from Announcements

IBM offerings close 2023 strong in G2 Winter Reports

2 min read - IBM offerings were featured in more than 1,400 unique G2 reports, earning over 300 leader badges across various categories. G2 was visited 90 million times in 2023 and hosts over one million user reviews, solidifying the crucial role peer reviews play in the software buying process. IBM is thankful to its clients for the continued trust, feedback and partnership. All of which help IBM to enable global enterprises with innovative, intelligent, and effective business solutions. Highlights of IBM’s leadership: Ranked #1 in 152…

Tune in to the second episode of the Inspiring Voices podcast, featuring Dr. Nicola Hodson

< 1 min read - The Inspiring Voices podcast, brought to you by the Executive Search and Integration team at IBM, aims to inspire you in your life and career choices by showcasing great leaders and their personal stories about life, career, and how to make an impact. In this second episode, our host, Christian Zani, brings you the story of Dr. Nicola Hodson, Country General Manager UK & Ireland. Nicola reflects on IBMs culture and provides valuable insights into her experience as a new…

More accessible than ever: IBM Envizi ESG Suite now available in seven languages

2 min read - The capture, management, and reporting of environmental, social and governance (ESG) data is a topic of global relevance. IBM Envizi is making this process more accessible with this latest release of Envizi in seven languages. Customers can now view the IBM Envizi ESG Suite interface in English, French, German, Italian, Spanish, Brazilian-Portuguese, and Japanese.  Translated functionality includes key areas of the IBM Envizi user interface including home pages, summary pages, popular dashboards and PowerReports, menus, buttons, browse grids, search and…

IBM Newsletters

Get our newsletters and topic updates that deliver the latest thought leadership and insights on emerging trends.
Subscribe now More newsletters