Skip to content

Make Python version pinning pin to the major version only#1714

Merged
edmorley merged 2 commits intomainfrom
sticky-version-major
Dec 6, 2024
Merged

Make Python version pinning pin to the major version only#1714
edmorley merged 2 commits intomainfrom
sticky-version-major

Conversation

@edmorley
Copy link
Copy Markdown
Member

@edmorley edmorley commented Dec 6, 2024

For apps that do not specify an explicit Python version (eg: via a .python-version or runtime.txt file), the buildpack uses a curated default version for the first build of the app.

Then for subsequent builds of the app, the buildpack selects a Python version based on the version found in the build cache, so that the version used for the app doesn't change in a breaking way over time as the buildpack's own default version changes. This feature is referred to as "version pinning" and/or "sticky versions".

The existing implementation of this feature pinned the version to the full Python version (e.g. 3.13.0), meaning that the app would always use that exact Python version, even when newer backwards-compatible patch releases (such as 3.13.1) became available over time.

Now that we have Python major version -> latest patch version resolution support (as of #1658) and improved build output around cache invalidation reasons (as of #1679), we can switch to instead only pinning to the major Python version (e.g. 3.13). This allows apps that do not specify a Python version to pick up any bug and security fixes for their major Python version the next time the app is built, whilst still keeping the compatibility properties of version pinning.

Longer term, the plan is to deprecate/sunset version pinning entirely (since it leads to confusing UX / lack of parity between multiple apps deployed from the same codebase at different times, e.g. review apps), and the Python CNB has already dropped support for it. However, that will be a breaking change for the classic buildpack, so out of scope for now.

GUS-W-17384879.

For apps that do not specify an explicit Python version (eg: via a
`.python-version` or `runtime.txt` file), the buildpack uses a curated
default version for the first build of the app.

Then for subsequent builds of the app, the buildpack selects a Python
version based on the version found in the build cache, so that the
version used for the app doesn't change in a breaking way over time as
the buildpack's own default version changes. This feature is referred to
as "version pinning" and/or "sticky versions".

The existing implementation of this feature pinned the version to the
full Python version (eg `3.13.0`), meaning that the app would always use
that exact Python version, even as newer backwards-compatible patch
releases (such as `3.13.1`) become available over time.

Now that we have Python major version -> latest patch version resolution
support (as of #1658) and improved build output around cache
invalidation reasons (as of #1679), we can switch to instead only
pinning to the major Python version (eg `3.13`). This allows apps that
do not specify a Python version to pick up any bug and security fixes
for their major Python version the next time the app is built, whilst
still keeping the compatibility properties of version pinning.

Longer term, the plan is to deprecate/sunset version pinning entirely
(since it leads to confusing UX / lack of parity between multiple apps
deployed from the same codebase at different times, eg review apps), and
the Python CNB has already dropped support for it. However, that will
be a breaking change for the classic buildpack, so out of scope for now.

GUS-W-17384879.
@edmorley edmorley self-assigned this Dec 6, 2024
@edmorley edmorley force-pushed the sticky-version-major branch from 8103eea to d559ac4 Compare December 6, 2024 12:05
@edmorley edmorley marked this pull request as ready for review December 6, 2024 12:11
@edmorley edmorley requested a review from a team as a code owner December 6, 2024 12:11
@edmorley edmorley enabled auto-merge (squash) December 6, 2024 12:12
@edmorley edmorley merged commit b77dd09 into main Dec 6, 2024
@edmorley edmorley deleted the sticky-version-major branch December 6, 2024 13:43
@heroku-linguist heroku-linguist Bot mentioned this pull request Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants