Skip to content

Commit

Permalink
Add a deprecation warning for Python 3.8
Browse files Browse the repository at this point in the history
Since it has <1 year left of its 5 year support lifecycle:
https://devguide.python.org/versions/#supported-versions

This uses the same approach as for Python 3.7 in #1404.

GUS-W-14607855.
  • Loading branch information
edmorley committed Dec 5, 2023
1 parent b24a74d commit 3736693
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 3 deletions.
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]

- Add a deprecation warning for Python 3.8. ([#1515](https://github.com/heroku/heroku-buildpack-python/pull/1515))

## [v240] - 2023-11-30

Expand Down
10 changes: 10 additions & 0 deletions bin/steps/python
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,16 @@ case "${PYTHON_VERSION}" in
warn_if_patch_update_available "${PYTHON_VERSION}" "${LATEST_39}"
;;
python-3.8.*)
puts-warn
puts-warn "Python 3.8 will reach its upstream end-of-life in October 2024, at which"
puts-warn "point it will no longer receive security updates:"
puts-warn "https://devguide.python.org/versions/#supported-versions"
puts-warn
puts-warn "Support for Python 3.8 will be removed from this buildpack on December 4th, 2024."
puts-warn
puts-warn "Upgrade to a newer Python version as soon as possible to keep your app secure."
puts-warn "See: https://devcenter.heroku.com/articles/python-runtimes"
puts-warn
warn_if_patch_update_available "${PYTHON_VERSION}" "${LATEST_38}"
;;
python-3.7.*)
Expand Down
24 changes: 23 additions & 1 deletion spec/hatchet/pipenv_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,29 @@
let(:app) { Hatchet::Runner.new('spec/fixtures/pipenv_python_3.8', allow_failure:) }

context 'when using Heroku-20', stacks: %w[heroku-20] do
include_examples 'builds using Pipenv with the requested Python version', LATEST_PYTHON_3_8
it 'builds with the latest Python 3.8 but shows a deprecation warning' do
app.deploy do |app|
expect(clean_output(app.output)).to match(Regexp.new(<<~REGEX))
remote: -----> Python app detected
remote: -----> Using Python version specified in Pipfile.lock
remote: !
remote: ! Python 3.8 will reach its upstream end-of-life in October 2024, at which
remote: ! point it will no longer receive security updates:
remote: ! https://devguide.python.org/versions/#supported-versions
remote: !
remote: ! Support for Python 3.8 will be removed from this buildpack on December 4th, 2024.
remote: !
remote: ! Upgrade to a newer Python version as soon as possible to keep your app secure.
remote: ! See: https://devcenter.heroku.com/articles/python-runtimes
remote: !
remote: -----> Installing python-#{LATEST_PYTHON_3_8}
remote: -----> Installing pip #{PIP_VERSION}, setuptools #{SETUPTOOLS_VERSION} and wheel #{WHEEL_VERSION}
remote: -----> Installing dependencies with Pipenv #{PIPENV_VERSION}
remote: Installing dependencies from Pipfile.lock \\(.+\\)...
remote: -----> Installing SQLite3
REGEX
end
end
end

context 'when using Heroku-22', stacks: %w[heroku-22] do
Expand Down
24 changes: 23 additions & 1 deletion spec/hatchet/python_update_warning_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,29 @@
let(:app) { Hatchet::Runner.new('spec/fixtures/python_3.8_outdated', allow_failure:) }

context 'when using Heroku-20', stacks: %w[heroku-20] do
include_examples 'warns there is a Python update available', '3.8.12', LATEST_PYTHON_3_8
it 'warns about both the deprecated major version and the patch update' do
app.deploy do |app|
expect(clean_output(app.output)).to match(Regexp.new(<<~REGEX))
remote: -----> Python app detected
remote: -----> Using Python version specified in runtime.txt
remote: !
remote: ! Python 3.8 will reach its upstream end-of-life in October 2024, at which
remote: ! point it will no longer receive security updates:
remote: ! https://devguide.python.org/versions/#supported-versions
remote: !
remote: ! Support for Python 3.8 will be removed from this buildpack on December 4th, 2024.
remote: !
remote: ! Upgrade to a newer Python version as soon as possible to keep your app secure.
remote: ! See: https://devcenter.heroku.com/articles/python-runtimes
remote: !
remote: !
remote: ! A Python security update is available! Upgrade as soon as possible to: python-#{LATEST_PYTHON_3_8}
remote: ! See: https://devcenter.heroku.com/articles/python-runtimes
remote: !
remote: -----> Installing python-3.8.12
REGEX
end
end
end

context 'when using Heroku-22', stacks: %w[heroku-22] do
Expand Down
25 changes: 24 additions & 1 deletion spec/hatchet/python_version_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,30 @@
let(:app) { Hatchet::Runner.new('spec/fixtures/python_3.8', allow_failure:) }

context 'when using Heroku-20', stacks: %w[heroku-20] do
include_examples 'builds with the requested Python version', LATEST_PYTHON_3_8
it 'builds with Python 3.8.18 but shows a deprecation warning' do
app.deploy do |app|
expect(clean_output(app.output)).to include(<<~OUTPUT)
remote: -----> Python app detected
remote: -----> Using Python version specified in runtime.txt
remote: !
remote: ! Python 3.8 will reach its upstream end-of-life in October 2024, at which
remote: ! point it will no longer receive security updates:
remote: ! https://devguide.python.org/versions/#supported-versions
remote: !
remote: ! Support for Python 3.8 will be removed from this buildpack on December 4th, 2024.
remote: !
remote: ! Upgrade to a newer Python version as soon as possible to keep your app secure.
remote: ! See: https://devcenter.heroku.com/articles/python-runtimes
remote: !
remote: -----> Installing python-#{LATEST_PYTHON_3_8}
remote: -----> Installing pip #{PIP_VERSION}, setuptools #{SETUPTOOLS_VERSION} and wheel #{WHEEL_VERSION}
remote: -----> Installing SQLite3
remote: -----> Installing requirements with pip
remote: Collecting urllib3 (from -r requirements.txt (line 1))
OUTPUT
expect(app.run('python -V')).to include("Python #{LATEST_PYTHON_3_8}")
end
end
end

context 'when using Heroku-22', stacks: %w[heroku-22] do
Expand Down

0 comments on commit 3736693

Please sign in to comment.