Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop support for Python 3.7 #1508

Merged
merged 1 commit into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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]

- Drop support for Python 3.7. ([#1508](https://github.com/heroku/heroku-buildpack-python/pull/1508))

## [v238] - 2023-11-06

Expand Down
2 changes: 1 addition & 1 deletion bin/default_pythons
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ LATEST_311="python-3.11.6"
LATEST_310="python-3.10.13"
LATEST_39="python-3.9.18"
LATEST_38="python-3.8.18"
LATEST_37="python-3.7.17"
# TODO: Remove these EOL versions once pipenv-python-version is refactored.
LATEST_37="python-3.7.17"
LATEST_36="python-3.6.15"
LATEST_35="python-3.5.10"
LATEST_34="python-3.4.10"
Expand Down
12 changes: 1 addition & 11 deletions bin/steps/python
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,7 @@ case "${PYTHON_VERSION}" in
warn_if_patch_update_available "${PYTHON_VERSION}" "${LATEST_38}"
;;
python-3.7.*)
puts-warn
puts-warn "Python 3.7 reached its upstream end-of-life on June 27th, 2023, so no longer"
puts-warn "receives any security updates:"
puts-warn "https://devguide.python.org/versions/#supported-versions"
puts-warn
puts-warn "Support for Python 3.7 will be removed from this buildpack in October 2023."
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_37}"
eol_python_version_error "3.7" "June 27th, 2023"
;;
python-3.6.*)
eol_python_version_error "3.6" "December 23rd, 2021"
Expand Down
Empty file.
1 change: 0 additions & 1 deletion spec/fixtures/python_3.7_outdated/runtime.txt

This file was deleted.

29 changes: 10 additions & 19 deletions spec/hatchet/pipenv_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,40 +103,31 @@
end

context 'with a Pipfile.lock containing python_version 3.7' do
let(:allow_failure) { false }
let(:app) { Hatchet::Runner.new('spec/fixtures/pipenv_python_3.7', allow_failure:) }
let(:app) { Hatchet::Runner.new('spec/fixtures/pipenv_python_3.7', allow_failure: true) }

context 'when using Heroku-20', stacks: %w[heroku-20] do
it 'builds with the latest Python 3.7 but shows a deprecation warning' do
it 'aborts the build with an EOL message' do
app.deploy do |app|
expect(clean_output(app.output)).to match(Regexp.new(<<~REGEX))
expect(clean_output(app.output)).to match(Regexp.new(<<~OUTPUT))
remote: -----> Python app detected
remote: -----> Using Python version specified in Pipfile.lock
remote: !
remote: ! Python 3.7 reached its upstream end-of-life on June 27th, 2023, so no longer
remote: ! receives any security updates:
remote: ! Python 3.7 reached upstream end-of-life on June 27th, 2023, and is
remote: ! therefore no longer receiving security updates:
remote: ! https://devguide.python.org/versions/#supported-versions
remote: !
remote: ! Support for Python 3.7 will be removed from this buildpack in October 2023.
remote: ! As such, it is no longer supported by the latest version of this buildpack.
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: ! Please upgrade to a newer Python version. See:
remote: ! https://devcenter.heroku.com/articles/python-runtimes
remote: !
remote: -----> Installing python-#{LATEST_PYTHON_3_7}
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
OUTPUT
end
end
end

context 'when using Heroku-22', stacks: %w[heroku-22] do
let(:allow_failure) { true }

# Python 3.7 is in the security fix only stage of its lifecycle, so has not been built for newer stacks.
include_examples 'aborts the build with a runtime not available message (Pipenv)', LATEST_PYTHON_3_7
include_examples 'aborts the build with a runtime not available message (Pipenv)', '3.7.17'
end
end

Expand Down
37 changes: 0 additions & 37 deletions spec/hatchet/python_update_warning_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,43 +56,6 @@
end

RSpec.describe 'Python update warnings' do
context 'with a runtime.txt containing python-3.7.12' do
let(:allow_failure) { false }
let(:app) { Hatchet::Runner.new('spec/fixtures/python_3.7_outdated', allow_failure:) }

context 'when using Heroku-20', stacks: %w[heroku-20] do
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.7 reached its upstream end-of-life on June 27th, 2023, so no longer
remote: ! receives any security updates:
remote: ! https://devguide.python.org/versions/#supported-versions
remote: !
remote: ! Support for Python 3.7 will be removed from this buildpack in October 2023.
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_7}
remote: ! See: https://devcenter.heroku.com/articles/python-runtimes
remote: !
remote: -----> Installing python-3.7.12
REGEX
end
end
end

context 'when using Heroku-22', stacks: %w[heroku-22] do
let(:allow_failure) { true }

include_examples 'aborts the build without showing an update warning', '3.7.12'
end
end

context 'with a runtime.txt containing python-3.8.12' do
let(:allow_failure) { false }
let(:app) { Hatchet::Runner.new('spec/fixtures/python_3.8_outdated', allow_failure:) }
Expand Down
26 changes: 8 additions & 18 deletions spec/hatchet/python_version_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -109,41 +109,31 @@
end

context 'when runtime.txt contains python-3.7.17' do
let(:allow_failure) { false }
let(:app) { Hatchet::Runner.new('spec/fixtures/python_3.7', allow_failure:) }
let(:app) { Hatchet::Runner.new('spec/fixtures/python_3.7', allow_failure: true) }

context 'when using Heroku-20', stacks: %w[heroku-20] do
it 'builds with Python 3.7.17 but shows a deprecation warning' do
it 'aborts the build with an EOL message' 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.7 reached its upstream end-of-life on June 27th, 2023, so no longer
remote: ! receives any security updates:
remote: ! Python 3.7 reached upstream end-of-life on June 27th, 2023, and is
remote: ! therefore no longer receiving security updates:
remote: ! https://devguide.python.org/versions/#supported-versions
remote: !
remote: ! Support for Python 3.7 will be removed from this buildpack in October 2023.
remote: ! As such, it is no longer supported by the latest version of this buildpack.
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: ! Please upgrade to a newer Python version. See:
remote: ! https://devcenter.heroku.com/articles/python-runtimes
remote: !
remote: -----> Installing python-#{LATEST_PYTHON_3_7}
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_7}")
end
end
end

context 'when using Heroku-22', stacks: %w[heroku-22] do
let(:allow_failure) { true }

# Python 3.7 is in the security fix only stage of its lifecycle, so has not been built for newer stacks.
include_examples 'aborts the build with a runtime not available message', "python-#{LATEST_PYTHON_3_7}"
include_examples 'aborts the build with a runtime not available message', 'python-3.7.17'
end
end

Expand Down
1 change: 0 additions & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
require 'rspec/core'
require 'hatchet'

LATEST_PYTHON_3_7 = '3.7.17'
LATEST_PYTHON_3_8 = '3.8.18'
LATEST_PYTHON_3_9 = '3.9.18'
LATEST_PYTHON_3_10 = '3.10.13'
Expand Down