Python developers often need to upgrade their applications to newer versions of Python to use language improvements, receive security updates, and maintain compatibility with modern libraries.
However, upgrading Python locally is only one part of the process. The hosting platform must also support the version, and the application's dependencies must work with it.
Google App Engine standard environment now supports Python 3.15 in Preview. Developers can use the python315 runtime in their app.yaml file to deploy applications using this version.
This gives developers an opportunity to test Python 3.15 applications on Google Cloud before the runtime reaches general availability.
In this article, we will create a small Flask application, configure Python 3.15, install its dependencies, and deploy it to App Engine.
What Is New for Python Developers on App Engine?
Google announced Python 3.15 runtime support for App Engine standard environment on November 2, 2026.
The runtime uses Ubuntu 24.04 and is currently available in Preview.
Here are the important details:
Feature | Details |
|---|
Python version | Python 3.15 |
App Engine runtime | python315
|
Environment | Standard environment |
Operating system | Ubuntu 24.04 |
Availability | Preview |
Dependency installation | pip and requirements.txt |
Configuration | app.yaml
|
The runtime automatically uses the latest available patch release of the selected Python version. However, it does not automatically move your application to a newer minor version.
For example, selecting python315 keeps the application on the Python 3.15 runtime rather than automatically moving it to Python 3.16 when that version becomes available.
Since Python 3.15 support is in Preview, check the current Google Cloud documentation before using it for production workloads.
Prepare Your Development Environment
Before creating the application, make sure you have the required tools installed.
You need:
- Python 3.15.
- Google Cloud CLI.
- A Google Cloud project.
- App Engine enabled for your project.
- A Google Cloud account with deployment permissions.
Check your Python installation:
python3.15 --version
Expected output:
Python 3.15.x
The exact patch version can change as Python releases updates.
Next, check the Google Cloud CLI:
gcloud version
If it is already installed, update it:
gcloud components update
Authenticate with your Google Cloud account:
gcloud auth login
Set the project that you want to use:
gcloud config set project YOUR_PROJECT_ID
Replace YOUR_PROJECT_ID with your actual Google Cloud project ID.
If App Engine has not been initialized for the project, create the application:
gcloud app create
Choose the region carefully because the App Engine application region cannot be changed after creation.
Create a Python 3.15 Flask Application
Let's build a small Flask application that returns information about the Python runtime.
Create a project directory:
mkdir python315-appengine
cd python315-appengine
Create the following project structure:
python315-appengine/
│
├── app.yaml
├── app.py
└── requirements.txt
Each file has a specific responsibility:
- app.py contains the application code.
- requirements.txt defines the Python dependencies.
- app.yaml tells App Engine which runtime to use.
Create the Flask application
Create app.py:
import os
import sys
from flask import Flask, jsonify
app = Flask(__name__)
@app.route("/")
def home():
return jsonify({
"message": "Hello from Python 3.15 on Google App Engine!",
"python_version": sys.version,
"runtime": os.environ.get("GAE_RUNTIME", "local")
})
@app.route("/health")
def health():
return jsonify({
"status": "healthy"
})
if __name__ == "__main__":
app.run(host="127.0.0.1", port=8080)
The application contains two endpoints.
The root endpoint returns the Python version and App Engine runtime information. The health endpoint returns a simple status response.
The GAE_RUNTIME environment variable is provided by App Engine. When running locally, the application returns local because the variable is not normally available.
Define the dependencies
Create requirements.txt:
Flask
gunicorn
Flask provides the web framework, while Gunicorn is a WSGI server used to run the application.
For a real project, pin dependency versions and test them against Python 3.15 before deployment.
Configure the App Engine runtime
Create app.yaml:
runtime: python315
entrypoint: gunicorn -b :$PORT app:app
instance_class: F1
automatic_scaling:
min_instances: 0
max_instances: 5
Let's understand the configuration.
runtime: python315 tells App Engine to use Python 3.15.
The entrypoint starts Gunicorn and binds it to the port provided by App Engine through the PORT environment variable.
The app:app value identifies the Python module and Flask application object. The first app refers to app.py, and the second refers to the Flask variable named app.
The instance class defines the resources allocated to each instance. Automatic scaling controls how many instances App Engine can create for this service.
The F1 instance class and scaling values are examples. Choose values based on your application's traffic and resource requirements.
Test the Application Locally
Before deploying the application, create a virtual environment using Python 3.15.
python3.15 -m venv venv
Activate it on macOS or Linux:
source venv/bin/activate
On Windows:
venv\Scripts\activate
Install the dependencies:
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
Check the installed Python version:
python --version
Start the Flask application using Gunicorn:
gunicorn -b 127.0.0.1:8080 app:app
Open the following endpoint:
http://127.0.0.1:8080/
You should receive a JSON response containing the message, Python version, and runtime information.
Test the health endpoint:
http://127.0.0.1:8080/health
The response should look like this:
{
"status": "healthy"
}
Testing locally helps identify application and dependency problems before uploading the code to Google Cloud.
Deploy the Application to App Engine
Once the application works locally, deploy it.
Make sure you are in the project directory containing app.yaml.
Run:
gcloud app deploy
The deployment process performs the following operations:
- Reads the App Engine configuration.
- Identifies the Python 3.15 runtime.
- Uploads the application files.
- Installs dependencies from
requirements.txt. - Creates a new application version.
- Makes the deployed version available to receive traffic according to the deployment settings.
After deployment, open the application:
gcloud app browse
You can also retrieve the application URL using:
gcloud app describe
Open the URL in your browser and verify that the application returns the expected response.
Check the Deployed Python Version
A successful deployment does not automatically confirm that the application is running with the Python version you expected.
The sample application already returns sys.version from its root endpoint.
For example, the response might contain:
{
"message": "Hello from Python 3.15 on Google App Engine!",
"python_version": "3.15.x ...",
"runtime": "python315"
}
The exact version string depends on the runtime patch release.
You can also inspect the application version from the command line:
gcloud app versions list
This helps you identify the deployed version and its status.
Common Problems When Using Python 3.15
A new runtime can introduce compatibility problems, particularly when an application depends on packages containing native code.
Here are some issues to check during deployment.
A dependency does not support Python 3.15
Some packages might not yet provide compatible releases or prebuilt wheels for Python 3.15.
For example, a package that depends on a native extension might fail during installation.
Check the package's supported Python versions and available distributions.
Test the dependencies locally before deploying:
python3.15 -m pip install -r requirements.txt
If installation fails, identify the package responsible and check whether a compatible version is available.
The application cannot start
If Gunicorn cannot locate the application, check the module and object names in the entrypoint.
For the project structure used in this article:
entrypoint: gunicorn -b :$PORT app:app
The first app refers to the Python file, and the second refers to the Flask application object.
Also check the deployment logs for missing dependencies or import errors.
The application works locally but fails after deployment
The local environment might contain packages or environment variables that are not available on App Engine.
Use the same Python version locally, keep dependencies in requirements.txt, and configure required environment variables through the appropriate App Engine settings.
You should also avoid relying on local filesystem changes because the App Engine standard environment has a read-only filesystem except for /tmp.
Deployment fails because the runtime is in Preview
Preview features can have availability restrictions or change before general availability.
Check the Python 3.15 release notes and App Engine runtime support schedule. Also verify that your Google Cloud project can use the Preview runtime.
Do not assume Preview availability provides the same guarantees as a generally available runtime.
Best Practices for Running Python 3.15 on App Engine
Before moving an existing application to Python 3.15, follow these practices:
- Test all third-party packages with Python 3.15.
- Pin dependency versions instead of relying on untested latest releases.
- Run unit and integration tests before deployment.
- Check native extensions and packages that require compilation.
- Use environment variables for application configuration.
- Avoid storing persistent files on the application filesystem.
- Review instance sizing and automatic scaling settings.
- Monitor application logs and errors after deployment.
- Keep a stable runtime version available for applications that cannot use Preview features.
- Review Google's runtime support schedule before planning production upgrades.
For existing applications, deploy Python 3.15 as a separate App Engine version first. Test it before directing production traffic to the new version.
Summary
Google App Engine standard environment supports Python 3.15 in Preview through the python315 runtime. Developers can use it by updating app.yaml, checking their dependencies, and deploying their applications with the Google Cloud CLI. The example in this article demonstrates how to create and deploy a Flask application using Python 3.15. Since the runtime is still in Preview, test application compatibility, monitor deployment behavior, and review Google's release notes before using it for production workloads.
Join the conversation! Your thoughts help the community grow.