From 278b475087416b08fbed786a52340e28e09623f9 Mon Sep 17 00:00:00 2001
From: Mike Alfare <13974384+mikealfare@users.noreply.github.com>
Date: Thu, 17 Oct 2024 15:17:07 -0400
Subject: [PATCH] Drop support for Python 3.8 (#1121)

* drop support for python 3.8

* drop support for python 3.8
---
 .changes/unreleased/Breaking Changes-20241016-184157.yaml | 6 ++++++
 .github/workflows/main.yml                                | 8 ++++----
 .github/workflows/release-internal.yml                    | 2 +-
 .github/workflows/release-prep.yml                        | 4 ++--
 .pre-commit-config.yaml                                   | 1 -
 Makefile                                                  | 4 ++--
 dagger/run_dbt_spark_tests.py                             | 2 +-
 dev-requirements.txt                                      | 3 +--
 docker/Dockerfile                                         | 4 ++--
 setup.py                                                  | 7 +++----
 10 files changed, 22 insertions(+), 19 deletions(-)
 create mode 100644 .changes/unreleased/Breaking Changes-20241016-184157.yaml

diff --git a/.changes/unreleased/Breaking Changes-20241016-184157.yaml b/.changes/unreleased/Breaking Changes-20241016-184157.yaml
new file mode 100644
index 000000000..0a2104e60
--- /dev/null
+++ b/.changes/unreleased/Breaking Changes-20241016-184157.yaml	
@@ -0,0 +1,6 @@
+kind: Breaking Changes
+body: Drop support for Python 3.8
+time: 2024-10-16T18:41:57.721002-04:00
+custom:
+  Author: mikealfare
+  Issue: "1121"
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index e4fc66ccc..a4e2c7a45 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -49,7 +49,7 @@ jobs:
       - name: Set up Python
         uses: actions/setup-python@v5
         with:
-          python-version: '3.8'
+          python-version: '3.9'
 
       - name: Install python dependencies
         run: |
@@ -75,7 +75,7 @@ jobs:
     strategy:
       fail-fast: false
       matrix:
-        python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
+        python-version: ["3.9", "3.10", "3.11", "3.12"]
 
     steps:
       - name: Check out the repository
@@ -126,7 +126,7 @@ jobs:
       - name: Set up Python
         uses: actions/setup-python@v5
         with:
-          python-version: '3.8'
+          python-version: '3.9'
 
       - name: Install python dependencies
         run: |
@@ -173,7 +173,7 @@ jobs:
       fail-fast: false
       matrix:
         os: [ubuntu-latest, macos-12, windows-latest]
-        python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
+        python-version: ["3.9", "3.10", "3.11", "3.12"]
 
     steps:
       - name: Set up Python ${{ matrix.python-version }}
diff --git a/.github/workflows/release-internal.yml b/.github/workflows/release-internal.yml
index 1a5090312..702ef9aea 100644
--- a/.github/workflows/release-internal.yml
+++ b/.github/workflows/release-internal.yml
@@ -37,7 +37,7 @@ defaults:
     shell: "bash"
 
 env:
-  PYTHON_TARGET_VERSION: 3.8
+  PYTHON_TARGET_VERSION: 3.9
 
 jobs:
   run-unit-tests:
diff --git a/.github/workflows/release-prep.yml b/.github/workflows/release-prep.yml
index 9937463d3..d5878ec1e 100644
--- a/.github/workflows/release-prep.yml
+++ b/.github/workflows/release-prep.yml
@@ -84,7 +84,7 @@ defaults:
     shell: bash
 
 env:
-  PYTHON_TARGET_VERSION: 3.8
+  PYTHON_TARGET_VERSION: 3.9
   NOTIFICATION_PREFIX: "[Release Preparation]"
 
 jobs:
@@ -448,7 +448,7 @@ jobs:
     strategy:
       fail-fast: false
       matrix:
-        python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
+        python-version: ["3.9", "3.10", "3.11", "3.12"]
 
     steps:
       - name: Check out the repository
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index fdb195262..6697bbeb5 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -24,7 +24,6 @@ repos:
     -   id: black
         args:
         -   --line-length=99
-        -   --target-version=py38
         -   --target-version=py39
         -   --target-version=py310
         -   --target-version=py311
diff --git a/Makefile b/Makefile
index ff4c0fc1b..46b9af294 100644
--- a/Makefile
+++ b/Makefile
@@ -17,12 +17,12 @@ lint: ## Runs flake8 and mypy code checks against staged changes.
 	pre-commit run --all-files
 
 .PHONY: unit
-unit: ## Runs unit tests with py38.
+unit: ## Runs unit tests with py39.
 	@\
 	python -m pytest tests/unit
 
 .PHONY: test
-test: ## Runs unit tests with py38 and code checks against staged changes.
+test: ## Runs unit tests with py39 and code checks against staged changes.
 	@\
 	python -m pytest tests/unit; \
 	python dagger/run_dbt_spark_tests.py --profile spark_session \
diff --git a/dagger/run_dbt_spark_tests.py b/dagger/run_dbt_spark_tests.py
index 67fa56587..6c310a6f8 100644
--- a/dagger/run_dbt_spark_tests.py
+++ b/dagger/run_dbt_spark_tests.py
@@ -104,7 +104,7 @@ async def test_spark(test_args):
         platform = dagger.Platform("linux/amd64")
         tst_container = (
             client.container(platform=platform)
-            .from_("python:3.8-slim")
+            .from_("python:3.9-slim")
             .with_mounted_cache("/var/cache/apt/archives", os_reqs_cache)
             .with_mounted_cache("/root/.cache/pip", pip_cache)
             # install OS deps first so any local changes don't invalidate the cache
diff --git a/dev-requirements.txt b/dev-requirements.txt
index f44ff4a85..1fbead472 100644
--- a/dev-requirements.txt
+++ b/dev-requirements.txt
@@ -7,8 +7,7 @@ git+https://github.com/dbt-labs/dbt-adapters.git@test_various_snapshot_configs#s
 
 # dev
 ipdb~=0.13.13
-pre-commit~=3.7.0;python_version>="3.9"
-pre-commit~=3.5.0;python_version<"3.9"
+pre-commit~=3.7.0
 pytest~=7.4
 pytest-csv~=3.0
 pytest-dotenv~=0.5.2
diff --git a/docker/Dockerfile b/docker/Dockerfile
index ef4574ddd..81e5e28f3 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -1,7 +1,7 @@
 # this image gets published to GHCR for production use
 ARG py_version=3.11.2
 
-FROM python:$py_version-slim-bullseye as base
+FROM python:$py_version-slim-bullseye AS base
 
 RUN apt-get update \
   && apt-get dist-upgrade -y \
@@ -29,7 +29,7 @@ ENV LANG=C.UTF-8
 RUN python -m pip install --upgrade "pip==24.0" "setuptools==69.2.0" "wheel==0.43.0" --no-cache-dir
 
 
-FROM base as dbt-spark
+FROM base AS dbt-spark
 
 ARG commit_ref=main
 ARG extras=all
diff --git a/setup.py b/setup.py
index 00aeba60d..cf8ff5691 100644
--- a/setup.py
+++ b/setup.py
@@ -4,9 +4,9 @@
 import re
 
 # require python 3.8 or newer
-if sys.version_info < (3, 8):
+if sys.version_info < (3, 9):
     print("Error: dbt does not support this version of Python.")
-    print("Please upgrade to Python 3.8 or higher.")
+    print("Please upgrade to Python 3.9 or higher.")
     sys.exit(1)
 
 # require version of setuptools that supports find_namespace_packages
@@ -83,11 +83,10 @@ def _get_plugin_version_dict():
         "Operating System :: Microsoft :: Windows",
         "Operating System :: MacOS :: MacOS X",
         "Operating System :: POSIX :: Linux",
-        "Programming Language :: Python :: 3.8",
         "Programming Language :: Python :: 3.9",
         "Programming Language :: Python :: 3.10",
         "Programming Language :: Python :: 3.11",
         "Programming Language :: Python :: 3.12",
     ],
-    python_requires=">=3.8",
+    python_requires=">=3.9",
 )