Skip to content

Commit

Permalink
drop testing and support for py38
Browse files Browse the repository at this point in the history
  • Loading branch information
mikealfare committed Oct 16, 2024
1 parent ed94c0d commit b913648
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 46 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ repos:
- id: black
args:
- --line-length=99
- --target-version=py38
- --target-version=py39
- --target-version=py310
- --target-version=py311
Expand Down
4 changes: 2 additions & 2 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -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 \
Expand All @@ -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

Expand Down
11 changes: 5 additions & 6 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,23 @@ If you need to use a different version you can specify it by git ref using the `
docker build --tag <your_image_name> \
--target dbt-postgres \
--build-arg commit_ref=<commit_ref> \
<path/to/dockerfile>
.
```

### 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:
Expand Down
58 changes: 29 additions & 29 deletions docker/dev.Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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"
6 changes: 2 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "[email protected]" },
]
Expand All @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
7 changes: 6 additions & 1 deletion tests/functional/adapter/test_hooks/test_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit b913648

Please sign in to comment.