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

Moves packaging to declarative config and modern build tooling.

  • Replaces setup.py with pyproject.toml (PEP 517/518): defines build backend, project metadata, dependencies, packages, package data, and dynamic version from dbt.adapters.clickhouse.__version__
  • Updates PyPI workflow to install build/twine and build via python -m build
  • Adds tests/unit/test_version_compatibility.py to assert adapter version <= installed dbt-core version

Written by Cursor Bugbot for commit 08c5987. 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
@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.

platforms='any',
classifiers=[
'Development Status :: 5 - Production/Stable',
'License :: OSI Approved :: Apache Software License',
Copy link
Author

Choose a reason for hiding this comment

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

You have a classifier as license apache but in the license file you say "MIT". Under what license is this project released?

'dbt-adapters>=1.16.7,<1.17', # This version should be dbt-adapters>=1.16.7,<2.0, but keeping it fixed for now to avoid unexpected issues. We need to frequently update it.
'clickhouse-connect>=0.10.0',
'clickhouse-driver>=0.2.10',
'setuptools>=0.69',
Copy link
Author

Choose a reason for hiding this comment

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

btw, I assumed this was a mistake and you meant version 69.

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 2 comments.


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



def test_version_compatibility():
"""Check our version is never newer than dbts version"""
Copy link

Copilot AI Jan 14, 2026

Choose a reason for hiding this comment

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

Typo in the comment: "dbts version" should be "dbt's version" or "dbt version".

Suggested change
"""Check our version is never newer than dbts version"""
"""Check our version is never newer than dbt's version"""

Copilot uses AI. Check for mistakes.
@@ -1,3 +1,55 @@
[build-system]
requires = ["setuptools>=69", "wheel"]
Copy link

Copilot AI Jan 14, 2026

Choose a reason for hiding this comment

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

The setuptools version requirement was changed from "setuptools>=0.69" in setup.py to "setuptools>=69" in both the build-system requirements and runtime dependencies. This is a significant increase (from version 0.69 to version 69.x) and may break installations on older systems. While this may be intentional for the migration to pyproject.toml, please verify this is the intended version requirement change and ensure it's documented in the changelog.

Copilot uses AI. Check for mistakes.
Copy link
Author

Choose a reason for hiding this comment

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

For @koletzilla to confirm if this is needed and it was a mistake (the runtime one, the build time one should not matter)

@koletzilla koletzilla added this to the v1.10.0 milestone Jan 15, 2026
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 db34b5e to 08c5987 Compare January 16, 2026 16:00
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 2 potential issues.

[tool.setuptools.package-data]
"dbt.include.clickhouse" = [
"dbt_project.yml",
"sample_profiles.yml",
Copy link

Choose a reason for hiding this comment

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

Package data references non-existent file

Medium Severity

The package data configuration references sample_profiles.yml, but this file doesn't exist in the repository. The original setup.py did not include this file in its package_data configuration, so this appears to be an erroneous addition during the migration to pyproject.toml. While the build won't fail (setuptools silently skips missing files), the package won't include the expected sample profile that might be needed by users.

Fix in Cursor Fix in Web

f"Invalid metadata in pyproject.toml: package_version={clickhouse_version_str} is greater than "
f"dbt version. The adapter version should indicate the minimum supported "
f"dbt version. Current installed dbt-core version is {dbt_version_str}."
)
Copy link

Choose a reason for hiding this comment

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

Version test semantics differ from original build check

Medium Severity

The new version compatibility test has fundamentally different semantics from the original setup.py check. The original checked if the package version started with a hardcoded "1.9" string (static, build-time validation). The new test compares clickhouse_version <= dbt_version against the installed dbt-core (dynamic, test-time validation). This causes test failures when running against the minimum supported dbt-core>=1.9 (e.g., 1.9.0) while the adapter is 1.9.7, since Version("1.9.7") <= Version("1.9.0") is False. The original protection against misaligned version bumps is also lost.

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.

3 participants