Skip Navigation

Azure Functions gets better for Python and JavaScript developers

Posted on December 4, 2018

Principal PM Manager, Azure Functions

Serverless technologies empower developers to focus on the differentiating business logic in their apps as opposed to infrastructure management. Following the Azure Functions 2.0 general availability announcement, we leveraged the new cross-platform Azure Functions host runtime to continue the focus on meeting more developers where they are with support for new languages and new hosting options for Azure Functions.

Today, we are happy to share that Python support in Azure Functions is available in public preview and you can publish Python function apps to our new Linux Consumption plan for a serverless, pay-per-execution hosting option. This Linux Consumption hosting option is available for JavaScript function apps as well. To further enable JavaScript developers with the ability to orchestrate serverless workflows programmatically, we are also announcing the general availability of the JavaScript Durable Functions extension to the Azure Functions runtime, now ready to be used on production workloads. If your solution is a serverless API you can leverage platform support for proper API design and management patterns with the new Consumption tier for API Management. With the growing set of Azure Functions capabilities, code reuse across the community can be beneficial for productivity, so we created the Serverless Community Library to host pre-built open-source components. Keep reading to find out more details about these new capabilities.

Host functions on the new Linux Consumption plan (public preview)

Azure Functions now support Linux serverless hosting on a Consumption plan, while previously deploying to Linux was only supported while running on an App Service plan. This latest release makes it possible to deploy functions targeting the Linux OS with dynamic scale based on deep insight into event activity and with the benefit of the pay-per-execution serverless model. Customers who develop on Mac and Linux platforms can transition seamlessly to Linux hosting in the cloud to avoid platform specific translation. Hosting on Linux also means that libraries available only on Linux can now be leveraged from your function code.

This new hosting option also paves the way for further abstracting infrastructure concepts in the future, by placing function apps on the platform with highest affinity for the development language. For example, we are hosting Python on Linux Consumption by default. Learn more about Linux Consumption hosting from our documentation.

Start developing Python functions (public preview)

Azure Functions can now be written in Python! Starting today, you can build your functions using Python 3.6 (CPython) based on the Functions 2.0 runtime and a Linux based hosting platform. This opens up a wide range of scenarios, including data processing, machine learning workloads, and automation scripting, that were previously hard to implement as serverless or FaaS solutions.

The new Python runtime shares the unique Functions programming model, so you can easily import your Python scripts and manage all your dependencies using the standard requirements format. As always, the wide variety of triggers and bindings will enable you to seamlessly connect to cloud scale data sources and messaging services such as Azure Storage, Cosmos DB, Service Bus, Event Hubs, and Event Grid, by simply using method attributes to do so.

Python code sample

As a Python developer, you can build, debug, and test your Functions locally using a Mac, Linux, or Windows machine. The Azure Functions Core Tools (CLI) will enable you to get started using trigger templates and publish directly to Azure, while automatically handling the configuration and build for you.

What's even more exciting is that you can use the Azure Functions extension for Visual Studio Code for a tightly integrated GUI experience to help you create, debug, manage, and deploy your Functions, all from within the code editor itself. Combine this with the Python authoring extension for VS Code, and you have a best-in-class serverless development experience for Python, on any platform!

Python authoring extension for VScode

To get started, follow this tutorial to create and publish your first serverless Python function. We are also having a webinar walking through the development experience of Azure Functions using Python and what scenarios are now possible, make sure to register today.

This feature is currently in preview, so we invite you to follow the GitHub conversation to share your feedback and get more insight into upcoming improvements and features.

Orchestrate JavaScript serverless workflows with Durable Functions (generally available)

Orchestrate your serverless workflows programmatically using the Durable Functions extension to the Azure Functions runtime with new GA support for JavaScript now ready to use for production workloads. With Durable Functions, developers can simplify complex, stateful coordination problems in serverless applications by defining the workflows in code instead of using JSON schemas or a visual designer. With this release we are enabling new scenarios for Node.js and JavaScript developers representing development patterns such as functions chaining, fan-out/fan-in (example below), or human interaction. Get started with this quickstart and build your stateful workloads using JavaScript with Durable Functions.

Stateful workloads using JavaScript with Durable Functions

Manage serverless APIs with API Management

A common scenario for our customers is building serverless APIs with Azure Functions powering their endpoints, benefiting from HTTP or event-driven triggers and easier integration with data and messaging services through bindings. When building APIs, there are a lot of considerations to keep in mind such as request authentication and authorization, rate limit and quota enforcement, request and response transformation, logging and tracing, or version management.

Azure API Management can handle all these tasks involved in mediating API requests, but until now it came with fixed costs that did not match the pay-per-execution model that Azure Functions customers love for their solutions.

Starting today, you can choose a new Consumption tier when creating a new API Management instance. This new tier is essentially a variant of API Management designed and implemented around the serverless principles of pay-per-request and automatic scale. Learn more about the new Consumption tier in this blog post to start enjoying the benefits of API management for your Azure Functions powered serverless backend.

Develop with the Serverless Community Library

The Serverless Community Library is an open-source set of pre-built components based on common use cases of Azure Functions and Logic Apps. These samples are already built and ready to deploy on the desired Azure subscription, so developers can plug-and-play and use those pre-built components out of the box, saving coding time and increasing productivity. Check available samples, including handling payments with Stripe or adding intelligence with Cognitive Services, in the Serverless Community Library, and contribute with your own components on GitHub.

Serverless Library

Summary

Please try these new capabilities and let us know what you think! We would love to hear your ideas for new Azure Functions features on the Functions UserVoice. We are happy to engage for Azure Functions issues captured on the Azure Functions GitHub repo, and you can always reach the Azure Functions team on Twitter @AzureFunctions.