Starting from version 0.9.0, cpp-linter-hooks has migrated from using the clang-tools package to using Python wheel packages for clang-format and clang-tidy. This change provides better cross-platform compatibility, easier installation, and more reliable dependency management.
- Before: Used
clang-tools==0.15.1package - After: Uses
clang-formatandclang-tidywheel packages from PyPI
- Before: clang-format and clang-tidy were installed via
clang-toolspackage which managed binaries - After: clang-format and clang-tidy are installed as Python packages and available as executables
- Better Cross-Platform Support: Python wheels work consistently across different operating systems
- Simplified Installation: No need to manage binary installations separately
- More Reliable: No more issues with binary compatibility or single threaded execution
- Better Version Management: Each tool version is a separate package release
- No breaking changes: The pre-commit hook configuration remains exactly the same
- All existing
.pre-commit-config.yamlfiles will continue to work without modification
- The internal
ensure_installed()function now returns the tool name instead of a Path object - The
util.pymodule has been rewritten to useshutil.which()instead ofclang_tools.install - Tests have been updated to mock the new wheel-based installation
No action required! Your existing configuration will continue to work.
-
Update your development environment:
pip install clang-format clang-tidy
-
If you were importing from the utility module:
# Before from cpp_linter_hooks.util import ensure_installed path = ensure_installed("clang-format", "18") command = [str(path), "--version"] # After from cpp_linter_hooks.util import ensure_installed tool_name = ensure_installed("clang-format", "18") command = [tool_name, "--version"]
The wheel packages support the same LLVM versions as before:
- LLVM 16, 17, 18, 19, 20+
- The
--versionargument continues to work as expected
If you encounter "command not found" errors:
-
Ensure the wheel packages are installed:
pip install clang-format clang-tidy
-
Verify the tools are available:
clang-format --version clang-tidy --version
-
Check that the tools are in your PATH:
which clang-format which clang-tidy
If you need a specific version, you can install it explicitly:
pip install clang-format==18.1.8
pip install clang-tidy==18.1.8If you encounter any issues after the migration, please:
- Check this migration guide
- Search existing issues
- Create a new issue with:
- Your operating system
- Python version
- The exact error message
- Your
.pre-commit-config.yamlconfiguration