From b91364852491b65c07511421f76004c6ed7c5c7f Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Wed, 16 Oct 2024 17:52:27 -0400 Subject: [PATCH] drop testing and support for py38 --- .github/workflows/integration-tests.yml | 4 +- .github/workflows/unit-tests.yml | 2 +- .pre-commit-config.yaml | 1 - docker/Dockerfile | 4 +- docker/README.md | 11 ++-- docker/dev.Dockerfile | 58 +++++++++---------- pyproject.toml | 6 +- .../adapter/test_hooks/test_hooks.py | 7 ++- 8 files changed, 47 insertions(+), 46 deletions(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 374908f4..0e5f4127 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -82,7 +82,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"] services: postgres: @@ -148,7 +148,7 @@ jobs: fail-fast: false matrix: platform: [ubuntu-22.04, macos-12] - python-version: ["3.8", "3.12"] + python-version: ["3.9", "3.12"] steps: - name: "Check out repository" uses: actions/checkout@v4 diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index afb88136..5805c982 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -23,7 +23,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 repository diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0bd01f7c..688eb244 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -23,7 +23,6 @@ repos: - id: black args: - --line-length=99 - - --target-version=py38 - --target-version=py39 - --target-version=py310 - --target-version=py311 diff --git a/docker/Dockerfile b/docker/Dockerfile index b6a87dfc..cfbc81ae 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,7 +1,7 @@ # this image gets published to GHCR for production use ARG py_version=3.12.4 -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 \ @@ -25,7 +25,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-postgres +FROM base AS dbt-postgres ARG commit_ref=main diff --git a/docker/README.md b/docker/README.md index 22af3fe9..66bf4df0 100644 --- a/docker/README.md +++ b/docker/README.md @@ -20,24 +20,23 @@ If you need to use a different version you can specify it by git ref using the ` docker build --tag \ --target dbt-postgres \ --build-arg commit_ref= \ - + . ``` ### Examples: -To build an image named "my-dbt" that supports Snowflake using the latest releases: +To build an image named "my-dbt" that supports Postgres using the latest releases: ```shell -cd dbt-core/docker docker build --tag my-dbt --target dbt-postgres . ``` -To build an image named "my-other-dbt" that supports Snowflake using the adapter version 1.0.0b1: +To build an image named "my-other-dbt" that supports Postgres using the adapter version 1.8.0: ```shell cd dbt-core/docker docker build \ --tag my-other-dbt \ --target dbt-postgres \ - --build-arg commit_ref=v1.0.0b1 \ - . + --build-arg commit_ref=v1.8.0 \ + . ``` ## Running an image in a container: diff --git a/docker/dev.Dockerfile b/docker/dev.Dockerfile index e137ff84..280ff39f 100644 --- a/docker/dev.Dockerfile +++ b/docker/dev.Dockerfile @@ -1,47 +1,47 @@ # this image does not get published, it is intended for local development only, see `Makefile` for usage -FROM ubuntu:24.04 as base +FROM ubuntu:24.04 AS base # prevent python installation from asking for time zone region ARG DEBIAN_FRONTEND=noninteractive # add python repository RUN apt-get update \ - && apt-get install -y software-properties-common=0.99.22.9 \ - && add-apt-repository -y ppa:deadsnakes/ppa \ - && apt-get clean \ - && rm -rf \ - /var/lib/apt/lists/* \ - /tmp/* \ - /var/tmp/* + && apt-get install -y software-properties-common=0.99.48 \ + && add-apt-repository -y ppa:deadsnakes/ppa \ + && apt-get clean \ + && rm -rf \ + /var/lib/apt/lists/* \ + /tmp/* \ + /var/tmp/* # install python RUN apt-get update \ - && apt-get install -y --no-install-recommends \ - build-essential=12.9ubuntu3 \ - git-all=1:2.34.1-1ubuntu1.10 \ - libpq-dev=14.11-0ubuntu0.22.04.1 \ - python3.8=3.8.19-1+jammy1 \ - python3.8-dev=3.8.19-1+jammy1 \ - python3.8-distutils=3.8.19-1+jammy1 \ - python3.8-venv=3.8.19-1+jammy1 \ - python3-pip=22.0.2+dfsg-1ubuntu0.4 \ - python3-wheel=0.37.1-2ubuntu0.22.04.1 \ - && apt-get clean \ - && rm -rf \ - /var/lib/apt/lists/* \ - /tmp/* \ - /var/tmp/* + && apt-get install -y --no-install-recommends \ + build-essential=12.10ubuntu1 \ + git-all=1:2.43.0-1ubuntu7.1 \ + libpq-dev=16.4-0ubuntu0.24.04.2 \ + python3.9=3.9.20-1+noble1 \ + python3.9-dev=3.9.20-1+noble1 \ + python3.9-distutils=3.9.20-1+noble1 \ + python3.9-venv=3.9.20-1+noble1 \ + python3-pip=24.0+dfsg-1ubuntu1 \ + python3-wheel=0.42.0-2 \ + && apt-get clean \ + && rm -rf \ + /var/lib/apt/lists/* \ + /tmp/* \ + /var/tmp/* # update the default system interpreter to the newly installed version -RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1 +RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.9 1 # install python dependencies -RUN python3 -m pip install --upgrade --no-cache-dir "hatch==1.9.1" +RUN python -m pip install --upgrade "hatch==1.13.0" --no-cache-dir --compile -FROM base as dbt-postgres-dev +FROM base AS dbt-postgres-dev -HEALTHCHECK CMD python3 --version || exit 1 +HEALTHCHECK CMD python --version || exit 1 # send stdout/stderr to terminal ENV PYTHONUNBUFFERED=1 @@ -50,5 +50,5 @@ ENV PYTHONUNBUFFERED=1 WORKDIR /opt/code VOLUME /opt/code -# create a virtual environment -RUN python3 -m venv /opt/venv +# setup hatch virtual envs +RUN hatch config set dirs.env.virtual ".hatch" diff --git a/pyproject.toml b/pyproject.toml index 726dc64a..f3aa52c1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ name = "dbt-postgres" description = "The set of adapter protocols and base functionality that supports integration with dbt-core" readme = "README.md" keywords = ["dbt", "adapter", "adapters", "database", "elt", "dbt-core", "dbt Core", "dbt Cloud", "dbt Labs", "postgres"] -requires-python = ">=3.8.0" +requires-python = ">=3.9.0" authors = [ { name = "dbt Labs", email = "info@dbtlabs.com" }, ] @@ -17,7 +17,6 @@ classifiers = [ "Operating System :: MacOS :: MacOS X", "Operating System :: Microsoft :: Windows", "Operating System :: POSIX :: Linux", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", @@ -58,8 +57,7 @@ dependencies = [ "dbt-common @ git+https://github.com/dbt-labs/dbt-common.git", "dbt-tests-adapter @ git+https://github.com/dbt-labs/dbt-adapters.git#subdirectory=dbt-tests-adapter", "dbt-core @ git+https://github.com/dbt-labs/dbt-core.git#subdirectory=core", - 'pre-commit==3.7.0;python_version>="3.9"', - 'pre-commit==3.5.0;python_version=="3.8"', + "pre-commit==3.7.0", "freezegun", "pytest", "pytest-dotenv", diff --git a/tests/functional/adapter/test_hooks/test_hooks.py b/tests/functional/adapter/test_hooks/test_hooks.py index 7e832038..bc667ed7 100644 --- a/tests/functional/adapter/test_hooks/test_hooks.py +++ b/tests/functional/adapter/test_hooks/test_hooks.py @@ -77,5 +77,10 @@ class TestPrePostRunHooks(BasePrePostRunHooks): pass +from dbt.tests.util import run_dbt + + class TestAfterRunHooks(BaseAfterRunHooks): - pass + + def test_missing_column_pre_hook(self, project): + run_dbt(["run"], expect_pass=False)