Python's runtime.txt file is deprecated
Change effective on 06 February 2025
In October 2024 we added support for configuring the Python version for Python apps using the .python-version
file.
The .python-version
file has several advantages over the Heroku-specific runtime.txt
file:
- It is more widely supported by other tooling in the Python ecosystem such as pyenv, package managers, CI systems and dependency update bots. This helps ensure that the Python version used for your app is consistent across your development, CI and production environments.
- It supports the major Python version syntax (
3.X
) in addition to the exact version syntax (3.X.Y
). The major version syntax allows your app to automatically receive the latest Python security updates when you build them, without needing to manually bump the Python patch version each time a new version is released.
As such, we have deprecated the runtime.txt
file, and recommend that you use a .python-version
file instead.
Apps using runtime.txt
will continue to build for now, however, a warning message will be shown in the build log explaining how to migrate.
See Specifying a Python Version for details on how to configure the Python version for your app.
Heroku’s buildpacks are open source. To subscribe to Python buildpack release notifications or provide feedback, see these repositories on GitHub:
- Python classic buildpack (used by Cedar generation apps)
- Python Cloud Native Buildpack (used by Fir generation apps)