Developing in Python. Overview
With Cloud Functions, you can run applications written in Python
The service provides several runtime environments with different versions. We do not recommend using obsolete versions of runtime environments.
Name | Python version. | Operating system |
Preloaded | Supported by |
---|---|---|---|---|
python37 | 3.7.13 | Ubuntu 18.04 | No | No |
python38 | 3.8.13 | Ubuntu 18.04 | No | No |
python39 | 3.9.11 | Ubuntu 18.04 | No | No |
python311 | 3.11.0 | Ubuntu 18.04 | Yes | No |
python312 | 3.12.0 | Ubuntu 22.04 LTS | Yes | Yes |
Note
Function behavior in preloaded and normal runtime environments may differ. Review the features of function behavior in Preloaded runtime environment.
By default, the python37
and python38
runtime environments have a built-in SDK library for Yandex Cloud API. For more information about how to use the SDK, see Using the SDK. You can install the SDK library to other runtime versions by specifying a dependency in requirements.txt
.
Cloud Functions automatically installs all the specified dependencies required for the function to run. Dependencies are installed when creating a new function version. For more information, see Managing Python function dependencies.
The runtime environment automatically loads your code and invokes the request handler you specified. It receives an incoming request and the invocation context as arguments. The context contains additional information about the function parameters.
Cloud Functions automatically captures an application's standard output streams and sends them to the centralized logging system available in Yandex Cloud. This system also logs service records about the start and end of each function and any errors that occur during its execution. For more information about the log format, see Python function runtime logging.
To learn more about developing in Python or how certain statements work, see the official Python documentation