Skip to content

Conversation

@mariocj89
Copy link

@mariocj89 mariocj89 commented Jan 13, 2026

Summary

Move to declarative packaging to provide better tooling integration and build isolation (by enabling python-build).

This will run the build in isolation with the environment and being explicit about the dependencies that are used to build the sdists and bdists, making sure that the build is reproducible and isolated.

The check for the version compatibility has been moved to a unit test, to move any scripting out of the project metadata.

Checklist

Delete items not relevant to your PR:

  • Unit and integration tests covering the common scenarios were added
  • A human-readable description of the changes was provided to include in CHANGELOG
  • For significant changes, documentation in https://github.com/ClickHouse/clickhouse-docs was updated with further explanations or tutorials

Let me know if you want me to add things to changelog/docs.

Relates to #592


Note

Migrates to declarative packaging and modern build tooling.

  • Replace setup.py with pyproject.toml (PEP 517), moving project metadata, dependencies, package data, and using dynamic version from dbt.adapters.clickhouse.__version__.version
  • Update PyPI workflow to install build/twine and build via python -m build instead of setup.py
  • Add tests/unit/test_version_compatibility.py to assert the adapter version is not newer than the installed dbt-core

Written by Cursor Bugbot for commit 98188bd. This will update automatically on new commits. Configure here.

Copilot AI review requested due to automatic review settings January 13, 2026 17:23
@CLAassistant
Copy link

CLAassistant commented Jan 13, 2026

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@mariocj89 mariocj89 force-pushed the pu/modernize-packaging branch 2 times, most recently from f5db213 to 9fc12fd Compare January 13, 2026 17:42
@mariocj89 mariocj89 requested a review from Copilot January 13, 2026 17:43
Move to declarative packaging to provide better tooling
integration and build isolation (by enabling `python-build`).

This will run the build in isolation with the environment and being
explicit about the dependencies that are used to build the sdists and
bdists, making sure that the build is reproducible and isolated.

The check for the version compatibility has been moved to a unit test,
to move any scripting out of the project metadata.
@mariocj89 mariocj89 force-pushed the pu/modernize-packaging branch from 9fc12fd to 98188bd Compare January 13, 2026 17:46
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +14 to +23
classifiers = [
"Development Status :: 5 - Production/Stable",
"Operating System :: Microsoft :: Windows",
"Operating System :: MacOS :: MacOS X",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]
Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The license classifier is missing from the classifiers list. The original setup.py included 'License :: OSI Approved :: Apache Software License'. This classifier should be added to maintain consistency with the previous configuration and properly declare the license in package metadata.

Copilot uses AI. Check for mistakes.
clickhouse_version_str = __version__.version

# Parse versions
dbt_version = Version(dbt_version_str)
Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Double space between 'assert' and 'clickhouse_version'.

Suggested change
dbt_version = Version(dbt_version_str)
dbt_version = Version(dbt_version_str)
dbt_minor = f"{dbt_version.major}.{dbt_version.minor}"

Copilot uses AI. Check for mistakes.
"dbt-adapters>=1.16.7,<1.17",
"clickhouse-connect>=0.10.0",
"clickhouse-driver>=0.2.10",
"setuptools>=69",
Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's an inconsistency in setuptools version requirements. The build-system section requires 'setuptools>=64', but the runtime dependencies specify 'setuptools>=69'. The original setup.py had 'setuptools>=0.69' which appears to be a typo. Consider aligning these requirements - typically the build-system requirement should match or be compatible with the runtime requirement. If setuptools>=69 is intended, the build-system should also require >=69. Note that setuptools 69 is a recent version and may limit compatibility.

Suggested change
"setuptools>=69",
"setuptools>=64",

Copilot uses AI. Check for mistakes.
dynamic = ["version"]
description = "The Clickhouse plugin for dbt (data build tool)"
readme = "README.md"
license = "MIT"
Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The license specified as "MIT" contradicts the actual LICENSE file in the repository, which contains the Apache License Version 2.0. The original setup.py correctly used 'License :: OSI Approved :: Apache Software License' in its classifiers. This should be changed to either license = "Apache-2.0" or the correct SPDX identifier for the Apache License.

Suggested change
license = "MIT"
license = "Apache-2.0"

Copilot uses AI. Check for mistakes.
# The dbt-clickhouse version should be smaller than or equal to the installed dbt version
assert clickhouse_version <= dbt_version, (
f"Invalid metadata in pyproject.toml: package_version={clickhouse_version_str} must start with "
f"dbt_version={dbt_minor}. The adapter version should indicate the minimum supported "
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Undefined variable dbt_minor in assertion error message

Medium Severity

The variable dbt_minor is used in the assertion error message but is never defined in the test file. When the version compatibility check fails and the assertion triggers, Python will raise a NameError instead of displaying the intended helpful error message. The original setup.py had dbt_minor_version = '1.9' which was used for this purpose, but it wasn't included in the new test implementation.

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants