Skip to content

Commit

Permalink
Add support for Python 3.12.4
Browse files Browse the repository at this point in the history
  • Loading branch information
edmorley committed Jun 7, 2024
1 parent d8ebe74 commit eccc666
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 21 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## [Unreleased]

- Added support for Python 3.12.4. ([#1591](https://github.com/heroku/heroku-buildpack-python/pull/1591))
- Changed the default Python version for new apps from 3.12.3 to 3.12.4. ([#1591](https://github.com/heroku/heroku-buildpack-python/pull/1591))

## [v250] - 2024-04-26

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ A `requirements.txt` must be present at the root of your application's repositor

To specify your python version, you also need a `runtime.txt` file - unless you are using the default Python runtime version.

Current default Python Runtime: Python 3.12.3
Current default Python Runtime: Python 3.12.4

Alternatively, you can provide a `setup.py` file, or a `Pipfile`.
Using `pipenv` will generate `runtime.txt` at build time if one of the field `python_version` or `python_full_version` is specified in the `requires` section of your `Pipfile`.
Expand All @@ -60,7 +60,7 @@ Specify a Python Runtime

Supported runtime options include:

- `python-3.12.3` on all [supported stacks](https://devcenter.heroku.com/articles/stack#stack-support-details)
- `python-3.12.4` on all [supported stacks](https://devcenter.heroku.com/articles/stack#stack-support-details)
- `python-3.11.9` on all [supported stacks](https://devcenter.heroku.com/articles/stack#stack-support-details)
- `python-3.10.14` on all [supported stacks](https://devcenter.heroku.com/articles/stack#stack-support-details)
- `python-3.9.19` on Heroku-20 and Heroku-22 only
Expand Down
2 changes: 1 addition & 1 deletion bin/default_pythons
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# the env vars to subprocesses.
# shellcheck disable=2034

LATEST_312="python-3.12.3"
LATEST_312="python-3.12.4"
LATEST_311="python-3.11.9"
LATEST_310="python-3.10.14"
LATEST_39="python-3.9.19"
Expand Down
2 changes: 1 addition & 1 deletion spec/fixtures/pipenv_and_runtime_txt/runtime.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
python-3.12.3
python-3.12.4
2 changes: 1 addition & 1 deletion spec/fixtures/python_3.12/runtime.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
python-3.12.3
python-3.12.4
2 changes: 1 addition & 1 deletion spec/fixtures/runtime_txt_only/runtime.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
python-3.12.3
python-3.12.4
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@

python-3.12.3
python-3.12.4

16 changes: 6 additions & 10 deletions spec/hatchet/python_version_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,11 @@
end
end

# TODO: Enable on Heroku-24 after the default Python version next changes (for the 3.12.4
# release), since for now there isn't a historic buildpack version we can use in this test
# that is both compatible with the new Heroku-24 S3 asset URLs and also has a different
# default Python version so that we can test the sticky versions feature.
context 'with an app last built using an older default Python version', stacks: %w[heroku-20 heroku-22] do
context 'with an app last built using an older default Python version' do
# This test performs an initial build using an older buildpack version, followed
# by a build using the current version. This ensures that the current buildpack
# can successfully read the version metadata written to the build cache in the past.
let(:buildpacks) { ['https://github.com/heroku/heroku-buildpack-python#v247'] }
let(:buildpacks) { ['https://github.com/heroku/heroku-buildpack-python#v250'] }

it 'builds with the same Python version as the last build' do
app.deploy do |app|
Expand All @@ -71,16 +67,16 @@
app.push!
expect(clean_output(app.output)).to include(<<~OUTPUT)
remote: -----> Python app detected
remote: -----> No Python version was specified. Using the same version as the last build: python-3.12.2
remote: -----> No Python version was specified. Using the same version as the last build: python-3.12.3
remote: To use a different version, see: https://devcenter.heroku.com/articles/python-runtimes
remote: !
remote: ! A Python security update is available! Upgrade as soon as possible to: python-#{LATEST_PYTHON_3_12}
remote: ! See: https://devcenter.heroku.com/articles/python-runtimes
remote: !
remote: -----> No change in requirements detected, installing from cache
remote: -----> Using cached install of python-3.12.2
remote: -----> Using cached install of python-3.12.3
OUTPUT
expect(app.run('python -V')).to include('Python 3.12.2')
expect(app.run('python -V')).to include('Python 3.12.3')
end
end
end
Expand Down Expand Up @@ -203,7 +199,7 @@
include_examples 'builds with the requested Python version', LATEST_PYTHON_3_11
end

context 'when runtime.txt contains python-3.12.3' do
context 'when runtime.txt contains python-3.12.4' do
let(:app) { Hatchet::Runner.new('spec/fixtures/python_3.12') }

include_examples 'builds with the requested Python version', LATEST_PYTHON_3_12
Expand Down
6 changes: 3 additions & 3 deletions spec/hatchet/stack_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# can successfully read the stack metadata written to the build cache in the past.
# The buildpack version chosen is one which had an older default Python version, so
# we can also prove that clearing the cache didn't lose the Python version metadata.
let(:buildpacks) { ['https://github.com/heroku/heroku-buildpack-python#v247'] }
let(:buildpacks) { ['https://github.com/heroku/heroku-buildpack-python#v250'] }
let(:app) { Hatchet::Runner.new('spec/fixtures/python_version_unspecified', buildpacks:) }

it 'clears the cache before installing again whilst preserving the sticky Python version' do
Expand All @@ -22,15 +22,15 @@
# TODO: The requirements output shouldn't say "installing from cache", since it's not.
expect(clean_output(app.output)).to include(<<~OUTPUT)
remote: -----> Python app detected
remote: -----> No Python version was specified. Using the same version as the last build: python-3.12.2
remote: -----> No Python version was specified. Using the same version as the last build: python-3.12.3
remote: To use a different version, see: https://devcenter.heroku.com/articles/python-runtimes
remote: !
remote: ! A Python security update is available! Upgrade as soon as possible to: python-#{LATEST_PYTHON_3_12}
remote: ! See: https://devcenter.heroku.com/articles/python-runtimes
remote: !
remote: -----> Stack has changed from heroku-22 to heroku-24, clearing cache
remote: -----> No change in requirements detected, installing from cache
remote: -----> Installing python-3.12.2
remote: -----> Installing python-3.12.3
remote: -----> Installing pip #{PIP_VERSION}, setuptools #{SETUPTOOLS_VERSION} and wheel #{WHEEL_VERSION}
remote: -----> Installing SQLite3
remote: -----> Installing requirements with pip
Expand Down
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
LATEST_PYTHON_3_9 = '3.9.19'
LATEST_PYTHON_3_10 = '3.10.14'
LATEST_PYTHON_3_11 = '3.11.9'
LATEST_PYTHON_3_12 = '3.12.3'
LATEST_PYTHON_3_12 = '3.12.4'
DEFAULT_PYTHON_VERSION = LATEST_PYTHON_3_12

# The requirement versions are effectively buildpack constants, however, we want
Expand Down

0 comments on commit eccc666

Please sign in to comment.