Skip to content

Commit

Permalink
Drop Python 3.8 support (#11529)
Browse files Browse the repository at this point in the history
* Drop Python 3.8 support

Dropping `3.8` as announced here:
https://github.blog/changelog/2025-02-05-dependabot-no-longer-supports-python-3-8/

* Update poetry test files
  • Loading branch information
eggplants authored Feb 14, 2025
1 parent ad09d59 commit 81ae6e2
Show file tree
Hide file tree
Showing 9 changed files with 380 additions and 384 deletions.
21 changes: 0 additions & 21 deletions python/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ ARG PY_3_12=3.12.9
ARG PY_3_11=3.11.11
ARG PY_3_10=3.10.16
ARG PY_3_9=3.9.21
ARG PY_3_8=3.8.20
ARG PYENV_VERSION=v2.5.2

FROM ghcr.io/dependabot/dependabot-updater-core AS python-core
Expand All @@ -14,7 +13,6 @@ ARG PY_3_12
ARG PY_3_11
ARG PY_3_10
ARG PY_3_9
ARG PY_3_8
ARG PYENV_VERSION
USER root

Expand All @@ -36,24 +34,6 @@ RUN git -c advice.detachedHead=false clone https://github.com/pyenv/pyenv.git --
# Although it is convenient when debugging to be able to quickly flip through environments.
RUN mkdir "${PYENV_ROOT}/versions"

## 3.8
# Docker doesn't support parametrizing `COPY --from:python:$PY_1_23-bookworm`, so work around it using an alias.
# TODO: If upstream adds support for Ubuntu, use that instead of Debian as the base suffix: https://github.com/docker-library/python/pull/791
FROM docker.io/library/python:$PY_3_8-bookworm AS upstream-python-3.8
FROM python-core AS python-3.8
ARG PYTHON_INSTALL_LOCATION="$PYENV_ROOT/versions/$PY_3_8"
COPY --from=upstream-python-3.8 --chown=dependabot:dependabot /usr/local/bin $PYTHON_INSTALL_LOCATION/bin
COPY --from=upstream-python-3.8 --chown=dependabot:dependabot /usr/local/include $PYTHON_INSTALL_LOCATION/include
COPY --from=upstream-python-3.8 --chown=dependabot:dependabot /usr/local/lib $PYTHON_INSTALL_LOCATION/lib
# `pip` and other scripts need their shebangs rewritten for the new location
RUN find $PYTHON_INSTALL_LOCATION/bin -type f -exec sed -i "1s|^#!/usr/local/bin/python|#!$PYTHON_INSTALL_LOCATION/bin/python|" {} +
# Ensure pyenv works and it's the python version we expect
RUN PYENV_VERSION=$PY_3_8 pyenv exec python --version | grep "Python $PY_3_8" || exit 1
RUN bash /opt/python/helpers/build $PY_3_8
# This python environment occupies ~0.5 GB and gets used for a fraction of jobs, so store it compressed.
RUN cd $PYENV_ROOT/versions \
&& tar -acf $PY_3_8.tar.zst $PY_3_8

## 3.9
# Docker doesn't support parametrizing `COPY --from:python:$PY_1_23-bookworm`, so work around it using an alias.
# TODO: If upstream adds support for Ubuntu, use that instead of Debian as the base suffix: https://github.com/docker-library/python/pull/791
Expand Down Expand Up @@ -168,7 +148,6 @@ COPY --chown=dependabot:dependabot common $DEPENDABOT_HOME/common
COPY --chown=dependabot:dependabot updater $DEPENDABOT_HOME/dependabot-updater

# Running these steps last means that if the builds in the concurrent stages take longer it doesn't block the pipeline until the end.
COPY --from=python-3.8 $PYENV_ROOT/versions/$PY_3_8.tar.zst $PYENV_ROOT/versions/$PY_3_8.tar.zst
COPY --from=python-3.9 $PYENV_ROOT/versions/$PY_3_9.tar.zst $PYENV_ROOT/versions/$PY_3_9.tar.zst
COPY --from=python-3.10 $PYENV_ROOT/versions/$PY_3_10.tar.zst $PYENV_ROOT/versions/$PY_3_10.tar.zst
COPY --from=python-3.11 $PYENV_ROOT/versions/$PY_3_11.tar.zst $PYENV_ROOT/versions/$PY_3_11.tar.zst
Expand Down
2 changes: 0 additions & 2 deletions python/helpers/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
pip==24.0
pip-tools==7.4.1
flake8==7.1.0
# TODO: Drop the conditions and use the latest version once we drop support for Python 3.8.
hashin==1.0.2; python_version < '3.9'
hashin==1.0.3; python_version >= '3.9'
pipenv==2024.0.2
plette==2.1.0
Expand Down
1 change: 0 additions & 1 deletion python/lib/dependabot/python/language_version_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ class LanguageVersionManager
3.11.11
3.10.16
3.9.21
3.8.20
).freeze

sig { params(python_requirement_parser: T.untyped).void }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,9 @@
end

context "with the oldest python version currently supported by Dependabot" do
let(:python_version) { "3.8.17" }
let(:pyproject_fixture_name) { "python_38.toml" }
let(:lockfile_fixture_name) { "python_38.lock" }
let(:python_version) { "3.9.21" }
let(:pyproject_fixture_name) { "python_39.toml" }
let(:lockfile_fixture_name) { "python_39.lock" }
let(:dependency) do
Dependabot::Dependency.new(
name: "django",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,18 +84,18 @@
it { is_expected.to eq(Gem::Version.new("3.2.4")) }

context "when the version is set to the oldest version of python supported by Dependabot" do
let(:python_version_content) { "3.8.0\n" }
let(:python_version_content) { "3.9.0\n" }

it { is_expected.to eq(Gem::Version.new("3.2.4")) }
end

context "when the version is set to a python version no longer supported by Dependabot" do
let(:python_version_content) { "3.7.0\n" }
let(:python_version_content) { "3.8.0\n" }

it "raises a helpful error" do
expect { latest_resolvable_version }.to raise_error(Dependabot::ToolVersionNotSupported) do |err|
expect(err.message).to start_with(
"Dependabot detected the following Python requirement for your project: '3.7.0'."
"Dependabot detected the following Python requirement for your project: '3.8.0'."
)
end
end
Expand Down Expand Up @@ -131,18 +131,18 @@
it { is_expected.to eq(Gem::Version.new("2.1.1")) }

context "when the version is set to the oldest version of python supported by Dependabot" do
let(:python_version_content) { "3.8.0\n" }
let(:python_version_content) { "3.9.0\n" }

it { is_expected.to eq(Gem::Version.new("2.1.1")) }
end

context "when version is set to a python version no longer supported by Dependabot" do
let(:python_version_content) { "3.7.0\n" }
let(:python_version_content) { "3.8.0\n" }

it "raises a helpful error" do
expect { lowest_resolvable_security_fix_version }.to raise_error(Dependabot::ToolVersionNotSupported) do |err|
expect(err.message).to start_with(
"Dependabot detected the following Python requirement for your project: '3.7.0'."
"Dependabot detected the following Python requirement for your project: '3.8.0'."
)
end
end
Expand Down
6 changes: 3 additions & 3 deletions python/spec/dependabot/python/update_checker_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -225,18 +225,18 @@
it { is_expected.to eq(Gem::Version.new("3.2.4")) }

context "when the version is set to the oldest version of python supported by Dependabot" do
let(:python_version_content) { "3.8.0\n" }
let(:python_version_content) { "3.9.0\n" }

it { is_expected.to eq(Gem::Version.new("3.2.4")) }
end

context "when the version is set to a python version no longer supported by Dependabot" do
let(:python_version_content) { "3.7.0\n" }
let(:python_version_content) { "3.8.0\n" }

it "raises a helpful error" do
expect { latest_resolvable_version }.to raise_error(Dependabot::ToolVersionNotSupported) do |err|
expect(err.message).to start_with(
"Dependabot detected the following Python requirement for your project: '3.7.0'."
"Dependabot detected the following Python requirement for your project: '3.8.0'."
)
end
end
Expand Down
Loading

0 comments on commit 81ae6e2

Please sign in to comment.