Skip to content

Commit

Permalink
Use Python 3.13 as the default Python version for new apps (#1715)
Browse files Browse the repository at this point in the history
Previously if a new app did not specify a Python version (e.g. via a
`.python-version` file), then the buildpack would default to the latest
Python 3.12 release.

Now the buildpack will use the latest Python 3.13 release.

This does not affect:
* apps that specify an explicit Python version
* existing apps that have already had a build using the previous default
  version (since that version is remembered from one build to the next,
  via the "version pinning" / "sticky versions" feature).

Use-cases involving new apps that aren't compatible with Python 3.13
will now need to specify Python 3.12 explicitly:
https://devcenter.heroku.com/articles/python-support#specify-a-python-version

However most apps should be compatible, since Python 3.13 was released
a couple of months ago (2024-10-07), does not contain significant breaking
changes over Python 3.12, and has been happily used by the
python-getting-started project since 2024-10-10.

See:
https://docs.python.org/3.13/whatsnew/3.13.html

GUS-W-14846972.
  • Loading branch information
edmorley authored Dec 6, 2024
1 parent b77dd09 commit 29f1606
Show file tree
Hide file tree
Showing 40 changed files with 126 additions and 140 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_python_runtime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
workflow_dispatch:
inputs:
python_version:
description: "Python version (eg: 3.12.0)"
description: "Python version (eg: 3.13.0)"
type: string
required: true
stack:
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## [Unreleased]

- Changed the default Python version for new apps from 3.12 to 3.13. ([#1715](https://github.com/heroku/heroku-buildpack-python/pull/1715))
- Changed Python version pinning behaviour for apps that do not specify a Python version. Repeat builds are now pinned to the major Python version only (`3.X`) instead of the full Python version (`3.X.Y`), so that they always use the latest patch version. ([#1714](https://github.com/heroku/heroku-buildpack-python/pull/1714))

## [v269] - 2024-12-04
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ If none of those are found, the buildpack will use a default Python version for
build of an app, and then subsequent builds of that app will be pinned to that version
unless the build cache is cleared or you request a different version.

The current default Python version is: 3.12
The current default Python version is: 3.13

The supported Python versions are:

Expand Down
2 changes: 1 addition & 1 deletion lib/python_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ LATEST_PYTHON_3_11="3.11.11"
LATEST_PYTHON_3_12="3.12.8"
LATEST_PYTHON_3_13="3.13.1"

DEFAULT_PYTHON_FULL_VERSION="${LATEST_PYTHON_3_12}"
DEFAULT_PYTHON_FULL_VERSION="${LATEST_PYTHON_3_13}"
DEFAULT_PYTHON_MAJOR_VERSION="${DEFAULT_PYTHON_FULL_VERSION%.*}"

# Integer with no redundant leading zeros.
Expand Down
2 changes: 1 addition & 1 deletion spec/fixtures/ci_pipenv/.python-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.12
3.13
12 changes: 6 additions & 6 deletions spec/fixtures/ci_pipenv/Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion spec/fixtures/ci_poetry/.python-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.12
3.13
16 changes: 8 additions & 8 deletions spec/fixtures/ci_poetry/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion spec/fixtures/ci_poetry/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
package-mode = false

[tool.poetry.dependencies]
python = "^3.12"
python = "^3.13"
typing-extensions = "*"

[tool.poetry.group.test.dependencies]
Expand Down
2 changes: 1 addition & 1 deletion spec/fixtures/ci_requirements/.python-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.12
3.13
2 changes: 1 addition & 1 deletion spec/fixtures/ci_requirements/requirements-test.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
pytest==8.3.3
pytest==8.3.4
2 changes: 1 addition & 1 deletion spec/fixtures/pipenv_and_requirements_txt/Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ urllib3 = "*"
[dev-packages]

[requires]
python_version = "3.12"
python_version = "3.13"
10 changes: 5 additions & 5 deletions spec/fixtures/pipenv_and_requirements_txt/Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion spec/fixtures/pipenv_basic/Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ typing-extensions = "*"
[dev-packages]

[requires]
python_version = "3.12"
python_version = "3.13"
4 changes: 2 additions & 2 deletions spec/fixtures/pipenv_basic/Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions spec/fixtures/pipenv_editable/.python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.12
8 changes: 4 additions & 4 deletions spec/fixtures/pipenv_editable/Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion spec/fixtures/pipenv_lockfile_out_of_sync/Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ urllib3 = "*"
[dev-packages]

[requires]
python_version = "3.12"
python_version = "3.13"
2 changes: 1 addition & 1 deletion spec/fixtures/pipenv_no_lockfile/Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ typing-extensions = "*"
[dev-packages]

[requires]
python_version = "3.12"
python_version = "3.13"
2 changes: 1 addition & 1 deletion spec/fixtures/poetry_basic/.python-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.12
3.13
16 changes: 8 additions & 8 deletions spec/fixtures/poetry_basic/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion spec/fixtures/poetry_basic/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
package-mode = false

[tool.poetry.dependencies]
python = "^3.12"
python = "^3.13"
typing-extensions = "*"

# This group shouldn't be installed due to us passing `--only main`.
Expand Down
20 changes: 10 additions & 10 deletions spec/fixtures/poetry_editable/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion spec/fixtures/poetry_editable/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description = ""
authors = []

[tool.poetry.dependencies]
python = "^3.12"
python = "^3.13"
gunicorn = { git = "https://github.com/benoitc/gunicorn.git", tag = "20.1.0", develop = true }
local-package-pyproject-toml = { path = "packages/local_package_pyproject_toml", develop = true }
local-package-setup-py = { path = "packages/local_package_setup_py", develop = true }
Expand Down
4 changes: 2 additions & 2 deletions spec/fixtures/poetry_lockfile_out_of_sync/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion spec/fixtures/poetry_lockfile_out_of_sync/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
package-mode = false

[tool.poetry.dependencies]
python = "^3.12"
python = "^3.13"

# This dependency isn't in the lockfile.
typing-extensions = "*"
2 changes: 1 addition & 1 deletion spec/fixtures/requirements_basic/.python-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.12
3.13
2 changes: 2 additions & 0 deletions spec/fixtures/requirements_compiled/.python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# TODO: Switch this to using Python 3.13 as part of the sqlite removal.
3.12
3 changes: 3 additions & 0 deletions spec/fixtures/requirements_editable/.python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Note: This test intentionally uses Python 3.12, so that we test *.egg-link
# path rewriting using older globally installed setuptools.
3.12
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.12
3.13
4 changes: 2 additions & 2 deletions spec/fixtures/requirements_txt_and_poetry_lock/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
package-mode = false

[tool.poetry.dependencies]
python = "^3.12"
python = "^3.13"
typing-extensions = "*"
2 changes: 1 addition & 1 deletion spec/fixtures/setup_py_only/.python-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.12
3.13
Loading

0 comments on commit 29f1606

Please sign in to comment.