Skip to content

Conversation

@akkik04
Copy link
Contributor

@akkik04 akkik04 commented Dec 22, 2025

Closes #607

Summary

Adds a minimal pre-commit configuration so pylint runs automatically on changed Python files when committing.

  • Introduces .pre-commit-config.yaml with two local hooks:
    • pylint (clickhouse_connect) – runs pylint only on changed Python files under clickhouse_connect/
    • pylint (tests) – runs pylint only on changed Python files under tests/
  • Hooks use the existing pylintrc and do not add any extra formatting/whitespace checks beyond what pylint already enforces.

This keeps the current linting behavior but automates it at commit time and limits the scope to modified files instead of re-linting the entire repo.

(Usage example for contributors):

pip install -r requirements-dev.txt
pre-commit install

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

@joe-clickhouse
Copy link
Contributor

Hi @akkik04, This is great! Thanks, I've been meaning to get around to doing this for a while now. I'm in and out over the next week so I'll get it approved when I'm back.

@akkik04
Copy link
Contributor Author

akkik04 commented Dec 22, 2025

Hi @akkik04, This is great! Thanks, I've been meaning to get around to doing this for a while now. I'm in and out over the next week so I'll get it approved when I'm back.

Sounds good, thanks!

Copy link
Contributor

@joe-clickhouse joe-clickhouse left a comment

Choose a reason for hiding this comment

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

Look good! Just want to pin the pylint and astroid versions to match what's run in CI.

@joe-clickhouse
Copy link
Contributor

Failing because pre-commit 4.5.1 specifies python_requires >= 3.10 but we still test against 3.9. Looks like pre-commit v4.3.0 allows python 3.9 so maybe pin pre-commit to v4.3.0. Separately, I'll need to do some work to drop clickhouse-connect's support for 3.9.

@akkik04
Copy link
Contributor Author

akkik04 commented Dec 30, 2025

addressed.

Copy link
Contributor

@joe-clickhouse joe-clickhouse left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@joe-clickhouse joe-clickhouse merged commit a61168f into ClickHouse:main Jan 5, 2026
35 checks passed
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.

Add pre-commit + pylint integration

2 participants