diff --git a/.github/workflows/docs_drift_check.yml b/.github/workflows/docs_drift_check.yml index bf3e980d..93fcc7ab 100644 --- a/.github/workflows/docs_drift_check.yml +++ b/.github/workflows/docs_drift_check.yml @@ -30,7 +30,6 @@ on: - 'examples/**' - '**/*.md' - 'pyproject.toml' - - 'dev_requirements.txt' - '.github/workflows/docs_drift_check.yml' workflow_dispatch: inputs: diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 25c17cfb..9404bb3c 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -22,13 +22,10 @@ jobs: with: python-version: 3.12 - - name: Upgrade Setuptools - run: pip install --upgrade setuptools wheel - - name: Install requirements run: | - pip install -r dev_requirements.txt - pip install . + pip install --upgrade pip + pip install . --group dev - name: Run lint run: make lint diff --git a/.github/workflows/steps_local_testing.yml b/.github/workflows/steps_local_testing.yml index 51dfdb9c..114bf3c2 100644 --- a/.github/workflows/steps_local_testing.yml +++ b/.github/workflows/steps_local_testing.yml @@ -53,7 +53,9 @@ jobs: python-version: ${{ inputs.python-version }} - name: Install requirements - run: pip3 install . -r dev_requirements.txt + run: | + pip3 install --upgrade pip + pip3 install . --group dev - name: Run HTTP tests env: diff --git a/.github/workflows/test_cloud.yml b/.github/workflows/test_cloud.yml index 7a96ea50..d163c034 100644 --- a/.github/workflows/test_cloud.yml +++ b/.github/workflows/test_cloud.yml @@ -33,7 +33,9 @@ jobs: python-version: '3.11' - name: Install requirements - run: pip3 install . -r dev_requirements.txt + run: | + pip3 install --upgrade pip + pip3 install . --group dev - name: Run HTTP tests env: diff --git a/.gitignore b/.gitignore index c7226899..b9eb1952 100644 --- a/.gitignore +++ b/.gitignore @@ -98,4 +98,7 @@ dbt-tut dev/ .python-version *_project/ -.user.yml \ No newline at end of file +.user.yml + +# uv +uv.lock diff --git a/CHANGELOG.md b/CHANGELOG.md index f549dd3c..9723ecbe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ ### Unreleased +#### Improvements +* `dbt-core` is now capped at `<2.0`, and `dbt-common` and `agate` are declared as direct dependencies, matching dbt-labs adapters ([#776](https://github.com/ClickHouse/dbt-clickhouse/pull/776)). + #### Repository maintenance * The shard-local table name of distributed materializations is now resolved in one place, `clickhouse_local_relation`, instead of being rebuilt inline in each materialization and incremental strategy ([#753](https://github.com/ClickHouse/dbt-clickhouse/pull/753)). diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 85ffda1c..a2e52c56 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -15,10 +15,11 @@ Start by forking the repository on GitHub. This will create a copy of the reposi * Make sure Python is installed locally, please refer to [dbt's python compatibility](https://docs.getdbt.com/faqs/Core/install-python-compatibility) (We recommend using version 3.12+). * Create a dedicated virtual environment (optional but recommended) -* Install all the development requirements and the local project as an editable package: +* Install the local project as an editable package with the `dev` dependency group from `pyproject.toml`: ```bash - pip install -e . -r dev_requirements.txt + # using pip 25.1+: + pip install -e . --group dev ``` * Verify the package was installed successfully: diff --git a/dbt/adapters/clickhouse/connections.py b/dbt/adapters/clickhouse/connections.py index 666f6309..0099159b 100644 --- a/dbt/adapters/clickhouse/connections.py +++ b/dbt/adapters/clickhouse/connections.py @@ -4,11 +4,11 @@ from contextlib import contextmanager from typing import TYPE_CHECKING, Any, Optional, Tuple, Union -import dbt.exceptions from dbt.adapters.clickhouse.dbclient import ChRetryableException, get_db_client from dbt.adapters.clickhouse.logger import logger from dbt.adapters.contracts.connection import AdapterResponse, Connection from dbt.adapters.sql import SQLConnectionManager +from dbt_common.exceptions import DbtRuntimeError if TYPE_CHECKING: import agate @@ -30,9 +30,9 @@ def exception_handler(self, sql): yield except Exception as exp: logger.debug('Error running SQL: {}', sql) - if isinstance(exp, dbt.exceptions.DbtRuntimeError): + if isinstance(exp, DbtRuntimeError): raise - raise dbt.exceptions.DbtRuntimeError('ClickHouse exception: ' + str(exp)) from exp + raise DbtRuntimeError('ClickHouse exception: ' + str(exp)) from exp @classmethod def open(cls, connection): diff --git a/dev_requirements.txt b/dev_requirements.txt deleted file mode 100644 index bd94e7b8..00000000 --- a/dev_requirements.txt +++ /dev/null @@ -1,12 +0,0 @@ -dbt-core==1.12.* -dbt-tests-adapter>=1.10,<2.0 -pytest>=7.2.0 -pytest-dotenv==0.5.2 -pytest-timeout==2.4.0 -ruff==0.16.0 -mypy==1.19.1 -yamllint==1.37.1 -requests~=2.34.2 -setuptools>=69.2.0 -types-setuptools>=69.2.0 -ipdb diff --git a/pyproject.toml b/pyproject.toml index 3153f973..56d9c939 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,8 +23,12 @@ classifiers = [ ] requires-python = ">=3.10" dependencies = [ - "dbt-core>=1.9", "dbt-adapters>=1.22.0,<1.25.0", # This version should be dbt-adapters<2.0, but keeping it fixed for now to avoid unexpected issues. We need to frequently update it. + # installed via dbt-adapters but used directly + "dbt-common>=1.36,<2.0", + "agate>=1.0,<2.0", + # add dbt-core to ensure backwards compatibility of installation, this is not a functional dependency + "dbt-core>=1.9,<2.0", "clickhouse-connect>=0.10.0", "clickhouse-driver>=0.2.10" ] @@ -38,6 +42,19 @@ Documentation = "https://github.com/ClickHouse/dbt-clickhouse#documentation" Changelog = "https://github.com/ClickHouse/dbt-clickhouse/blob/main/CHANGELOG.md" Slack = "https://clickhouse.com/slack" +[dependency-groups] +dev = [ + "dbt-core==1.12.*", + "dbt-tests-adapter>=1.10,<2.0", + "pytest>=7.2.0", + "pytest-dotenv==0.5.2", + "pytest-timeout==2.4.0", + "ruff==0.16.0", + "mypy==1.19.1", + "yamllint==1.37.1", + "requests~=2.34.2", +] + [tool.setuptools] packages = {find = {include = ["dbt", "dbt.*"], namespaces = true}}