You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This adds support for configuring the app's Python version using a
`.python-version` file. This file is used by several tools in the Python
ecosystem (such as pyenv, `actions/setup-python`, uv), whereas the
existing `runtime.txt` file is proprietary to Heroku.
We support the following `.python-version` syntax:
- Major Python version (eg `3.12`, which will then be resolved to the
latest Python 3.12). (This form is recommended, since it allows for
Python security updates to be pulled in without having to manually
bump the version.)
- Exact Python version (eg `3.12.6`)
- Comments (lines starting with `#`)
- Blank lines
We don't support the following `.python-version` features:
- Specifying multiple Python versions
- Prefixing versions with `python-` (since this form is undocumented
and will likely be deprecated in the future)
For now, if both a `runtime.txt` file and a `.python-version` file are
present, then the `runtime.txt` file will take precedence. In the
future, support for `runtime.txt` will eventually be deprecated (and
eventually removed) in favour of the `.python-version` file.
Since the `.python-version` file (unlike `runtime.txt`) supports
specifying just the Python major version, adding support also required:
- adding a mapping of major versions to the latest patch releases
- explicit handling for EOL/unrecognised major versions
- adding the concept of a "requested Python version" vs the resolved
Python version (which should hopefully tie in well with use of a
manifest in the future)
In addition, the "origin" of a Python version now has to be tracked, so
that build output can state which file was used, or in the case of
invalid version errors, which file needs fixing by the user.
Closes#6.
Closes#9.
GUS-W-12151504.
GUS-W-11475071.
Copy file name to clipboardExpand all lines: CHANGELOG.md
+5
Original file line number
Diff line number
Diff line change
@@ -7,9 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
8
8
## [Unreleased]
9
9
10
+
### Added
11
+
12
+
- The Python version can now be configured using a `.python-version` file. Both the `3.X` and `3.X.Y` version forms are supported. ([#272](https://github.com/heroku/buildpacks-python/pull/272))
13
+
10
14
### Changed
11
15
12
16
- pip is now only available during the build, and is longer included in the final app image. ([#264](https://github.com/heroku/buildpacks-python/pull/264))
17
+
- Improved the error messages shown when an end-of-life or unknown Python version is requested. ([#272](https://github.com/heroku/buildpacks-python/pull/272))
0 commit comments