Skip to content

Commit f29d3dc

Browse files
authored
Add support for Python 3.9 on Heroku-24 (#1656)
Previously Python 3.9 was only supported on the Heroku-22 stack and older, since it reaches EOL in Oct 2025. However, adding support for Python 3.9 to Heroku-24 will make it easier for users upgrading stacks, and also give more Python version options to CNB users that need ARM64 support, given that multi-arch is only available for Heroku-24+. It also simplifies the version error checks we need to perform in the upcoming Python version handling refactor. GUS-W-16917997.
1 parent 92633fc commit f29d3dc

File tree

7 files changed

+14
-53
lines changed

7 files changed

+14
-53
lines changed

.github/workflows/build_python_runtime.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ jobs:
8080
run: aws s3 sync ./upload "s3://${S3_BUCKET}"
8181

8282
heroku-24:
83-
# On Heroku-24 we only support Python 3.10+.
84-
if: inputs.stack == 'heroku-24' || (inputs.stack == 'auto' && !startsWith(inputs.python_version,'3.8.') && !startsWith(inputs.python_version,'3.9.'))
83+
# On Heroku-24 we only support Python 3.9+.
84+
if: inputs.stack == 'heroku-24' || (inputs.stack == 'auto' && !startsWith(inputs.python_version,'3.8.'))
8585
strategy:
8686
fail-fast: false
8787
matrix:

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## [Unreleased]
44

5+
- Added support for Python 3.9 on Heroku-24. ([#1656](https://github.com/heroku/heroku-buildpack-python/pull/1656))
56
- Improved the robustness of buildpack error handling by enabling `inherit_errexit`. ([#1655](https://github.com/heroku/heroku-buildpack-python/pull/1655))
67

78
## [v258] - 2024-10-01

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,5 +63,5 @@ Supported runtime options include:
6363
- `python-3.12.7` on all [supported stacks](https://devcenter.heroku.com/articles/stack#stack-support-details)
6464
- `python-3.11.10` on all [supported stacks](https://devcenter.heroku.com/articles/stack#stack-support-details)
6565
- `python-3.10.15` on all [supported stacks](https://devcenter.heroku.com/articles/stack#stack-support-details)
66-
- `python-3.9.20` on Heroku-20 and Heroku-22 only
66+
- `python-3.9.20` on all [supported stacks](https://devcenter.heroku.com/articles/stack#stack-support-details)
6767
- `python-3.8.20` on Heroku-20 only

builds/build_python_runtime.sh

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,7 @@ function abort() {
2121
}
2222

2323
case "${STACK:?}" in
24-
heroku-24)
25-
SUPPORTED_PYTHON_VERSIONS=(
26-
"3.10"
27-
"3.11"
28-
"3.12"
29-
)
30-
;;
31-
heroku-22)
24+
heroku-22 | heroku-24)
3225
SUPPORTED_PYTHON_VERSIONS=(
3326
"3.9"
3427
"3.10"

spec/hatchet/pipenv_spec.rb

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -216,19 +216,9 @@
216216
end
217217

218218
context 'with a Pipfile.lock containing python_version 3.9' do
219-
let(:allow_failure) { false }
220-
let(:app) { Hatchet::Runner.new('spec/fixtures/pipenv_python_3.9', allow_failure:) }
221-
222-
context 'when using Heroku-22 or older', stacks: %w[heroku-20 heroku-22] do
223-
include_examples 'builds using Pipenv with the requested Python version', LATEST_PYTHON_3_9
224-
end
219+
let(:app) { Hatchet::Runner.new('spec/fixtures/pipenv_python_3.9') }
225220

226-
context 'when using Heroku-24', stacks: %w[heroku-24] do
227-
let(:allow_failure) { true }
228-
229-
# We only support Python 3.9 on Heroku-22 and older.
230-
include_examples 'aborts the build with a runtime not available message (Pipenv)', LATEST_PYTHON_3_9
231-
end
221+
include_examples 'builds using Pipenv with the requested Python version', LATEST_PYTHON_3_9
232222
end
233223

234224
context 'with a Pipfile.lock containing python_version 3.10' do

spec/hatchet/python_update_warning_spec.rb

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -79,38 +79,25 @@
7979
end
8080

8181
context 'with a runtime.txt containing python-3.9.0' do
82-
let(:allow_failure) { false }
83-
let(:app) { Hatchet::Runner.new('spec/fixtures/python_3.9_outdated', allow_failure:) }
84-
85-
context 'when using Heroku-22 or older', stacks: %w[heroku-20 heroku-22] do
86-
include_examples 'warns there is a Python update available', '3.9.0', LATEST_PYTHON_3_9
87-
end
88-
89-
context 'when using Heroku-24', stacks: %w[heroku-24] do
90-
let(:allow_failure) { true }
82+
let(:app) { Hatchet::Runner.new('spec/fixtures/python_3.9_outdated') }
9183

92-
# We only support Python 3.9 on Heroku-22 and older.
93-
include_examples 'aborts the build without showing an update warning', '3.9.0'
94-
end
84+
include_examples 'warns there is a Python update available', '3.9.0', LATEST_PYTHON_3_9
9585
end
9686

9787
context 'with a runtime.txt containing python-3.10.0' do
98-
let(:allow_failure) { false }
99-
let(:app) { Hatchet::Runner.new('spec/fixtures/python_3.10_outdated', allow_failure:) }
88+
let(:app) { Hatchet::Runner.new('spec/fixtures/python_3.10_outdated') }
10089

10190
include_examples 'warns there is a Python update available', '3.10.0', LATEST_PYTHON_3_10
10291
end
10392

10493
context 'with a runtime.txt containing python-3.11.0' do
105-
let(:allow_failure) { false }
106-
let(:app) { Hatchet::Runner.new('spec/fixtures/python_3.11_outdated', allow_failure:) }
94+
let(:app) { Hatchet::Runner.new('spec/fixtures/python_3.11_outdated') }
10795

10896
include_examples 'warns there is a Python update available', '3.11.0', LATEST_PYTHON_3_11
10997
end
11098

11199
context 'with a runtime.txt containing python-3.12.0' do
112-
let(:allow_failure) { false }
113-
let(:app) { Hatchet::Runner.new('spec/fixtures/python_3.12_outdated', allow_failure:) }
100+
let(:app) { Hatchet::Runner.new('spec/fixtures/python_3.12_outdated') }
114101

115102
include_examples 'warns there is a Python update available', '3.12.0', LATEST_PYTHON_3_12
116103
end

spec/hatchet/python_version_spec.rb

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -179,19 +179,9 @@
179179
end
180180

181181
context 'when runtime.txt contains python-3.9.20' do
182-
let(:allow_failure) { false }
183-
let(:app) { Hatchet::Runner.new('spec/fixtures/python_3.9', allow_failure:) }
184-
185-
context 'when using Heroku-22 or older', stacks: %w[heroku-20 heroku-22] do
186-
include_examples 'builds with the requested Python version', LATEST_PYTHON_3_9
187-
end
182+
let(:app) { Hatchet::Runner.new('spec/fixtures/python_3.9') }
188183

189-
context 'when using Heroku-24', stacks: %w[heroku-24] do
190-
let(:allow_failure) { true }
191-
192-
# We only support Python 3.9 on Heroku-22 and older.
193-
include_examples 'aborts the build with a runtime not available message', "python-#{LATEST_PYTHON_3_9}"
194-
end
184+
include_examples 'builds with the requested Python version', LATEST_PYTHON_3_9
195185
end
196186

197187
context 'when runtime.txt contains python-3.10.15' do

0 commit comments

Comments
 (0)