Python support in Azure Functions
  • Transfer
Azure features provide a powerful programming model for accelerated development and serverless hosting of event-driven applications. Since we announced the availability of the Azure Functions 2.0 Runtime Environment, Python support has become one of the main requests from developers. We recently announced a public preview of Python support in Azure Functions. More under the cut!

What's in this release?

In this release, you can now develop your features using Python 3.6 based on open source feature execution environment 2.0 and publish them to a consumption plan (pay-per-use model) in Azure. Python is great for data processing, machine learning, scripts, and automation scripts. Building these solutions using Azure serverless functions can ease the burden of managing the underlying infrastructure, so you can work faster and focus on the differentiated business logic of your applications.

Powerful programming model

The programming model is designed to provide seamless and familiar interaction with the developers of Python, so you can import existing scripts and .py modules and quickly start writing functions using code constructs that you are already familiar with. For example, you can implement your functions as asynchronous coroutines using the async def qualifier, or send monitoring traces to a host using a standard logging module. Additional dependencies for pip can be configured using the requirements.txt format.

Using an event-driven programming model in Functions, based on triggers and binders, you can easily set up an event that will trigger the execution of a function and any data sources with which your function should be orchestrated. Common scenarios, such as logical ML inference and automating workload scenarios, benefit from this model because it helps to optimize various data sources while reducing the amount of code, SDK and dependencies that the developer has to configure and work at the same time. Preview supports binding to HTTP requests, timer events, Azure Storage, Cosmos DB, Service Bus, Event Hubs, and Event Grid.

Easier development

As a Python developer, you don’t need to learn any new feature development tools. In fact, you can quickly create, debug, and test them locally using a Mac, Linux, or Windows computer. The basic Azure function tools ( CLI ) will allow you to start using trigger templates and publish them directly to Azure, automatically processing assembly and configuration.

Even more exciting is that you can use the extensionAzure Functions for Visual Studio Code for a tightly integrated GUI that helps you create a new application, add features, and deploy everything in minutes. One-click debugging allows you to locally test your functions for Azure events in real time, set breakpoints, and evaluate the call stack by simply pressing F5. Add to this the Python VS Code extension, and you’ll get a best-in-class way to autocomplete and debug for Python development on any platform.

Linux Hosting

Functions written in Python can be published to Azure in two different modes: in terms of consumption and in terms of application service. The consumption plan automatically distributes computing power based on the number of incoming events. Your application will scale as needed to handle the load and shrink when events become rare. Tariffing is based on the number of executions, runtime and memory used, so you do not need to pay in advance for unused virtual machines or reserved capacity.

In terms of application services, you can take advantage of features such as long-term features, premium equipment, isolated SKUs, and the ability to connect to VNET / VPN, while maintaining a unique function programming model.

Both hosting plans run functions in the docker-container based on the open-source azure-function / python base image . The platform abstracts the container, so you are only responsible for providing the Python files and do not have to worry about managing the basic Azure functions and the Python runtime.

Next stage: try

To get started, click on the links below:

  • Create your first serverless function using the Python Guide in Functions.
  • Find a complete reference for developing Azure Functions in Python
  • Stay tuned for new features and discussion in our GitHub repository.
  • Learn about all the things you can do with Python in Azure
  • Python development webinar with Azure

The guys from the Microsoft Developer Community @msdevru, the Microsoft Developer community channel for developers and anyone interested in new technologies helped us prepare this article .

Also popular now: