simonwillisonblog icon indicating copy to clipboard operation
simonwillisonblog copied to clipboard

Switch to .python-version

Open simonw opened this issue 6 months ago • 2 comments

As recommended by Heroku.

simonw avatar Jul 01 '25 22:07 simonw

Spotted this in the build logs:

-----> Python app detected
-----> Using Python 3.12.8 specified in runtime.txt
 !     Warning: The runtime.txt file is deprecated.
 !     
 !     The runtime.txt file is deprecated since it has been replaced
 !     by the more widely supported .python-version file:
 !     https://devcenter.heroku.com/changelog-items/3141
 !     
 !     Please switch to using a .python-version file instead.
 !     
 !     Delete your runtime.txt file and create a new file in the
 !     root directory of your app named:
 !     .python-version
 !     
 !     Make sure to include the '.' character at the start of the
 !     filename. Don't add a file extension such as '.txt'.
 !     
 !     In the new file, specify your app's major Python version number
 !     only. Don't include quotes or a 'python-' prefix.
 !     
 !     For example, to request the latest version of Python 3.12,
 !     update your .python-version file so it contains exactly:
 !     3.12
 !     
 !     We strongly recommend that you don't specify the Python patch
 !     version number, since it will pin your app to an exact Python
 !     version and so stop your app from receiving security updates
 !     each time it builds.
 !     
 !     In the future support for runtime.txt will be removed and
 !     this warning will be made an error.
 !     Warning: A Python patch update is available!
 !     
 !     Your app is using Python 3.12.8, however, there is a newer
 !     patch release of Python 3.12 available: 3.12.11
 !     
 !     It is important to always use the latest patch version of
 !     Python to keep your app secure.
 !     
 !     Update your runtime.txt file to use the new version.
 !     
 !     We strongly recommend that you don't pin your app to an
 !     exact Python version such as 3.12.8, and instead only specify
 !     the major Python version of 3.12 in your runtime.txt file.
 !     This will allow your app to receive the latest available Python
 !     patch version automatically and prevent this warning.
-----> Restoring cache
-----> Using cached install of Python 3.12.8

simonw avatar Jul 01 '25 22:07 simonw

https://devcenter.heroku.com/articles/python-runtimes#selecting-a-runtime suggests:

3.13

simonw avatar Jul 03 '25 21:07 simonw