Repository navigation
feat: move clang-include-cleaner, clang-apply-replacements and ccache-bin into packages/ - #10
Merged
Merged
Conversation
Package the clang-apply-replacements utility from LLVM's clang-tools-extra as a Python wheel for distribution on PyPI. Based on the clang-tidy-wheel project by Dominic Kempf (ssciwr).
- Rename version file: clang-include-cleaner_version.txt - Rename package directory: clang_apply_replacements -> clang_include_cleaner - Update __init__.py: executable name, env var, package refs - Update CMakeLists.txt: build target clang-include-cleaner - Update pyproject.toml: project name, scripts, version source - Update README.md: all project documentation - Update .github/workflows/release.yml: CI references - Update .gitignore: data directory path - Update test/test_executable.py: import paths, executable name
clang-include-cleaner is available as a CMake build target from LLVM 16.0.0 onwards. Start with latest stable 22.1.7 as the first release.
LLVM 9.0.0 does not have a GitHub release (404). Start from 13.0.0 which: - is widely available in modern distros (Ubuntu 22.04, Debian 12, RHEL 9) - consistently uses the .src.tar.xz filename format - eliminates the need for version-specific URL branching in CMakeLists.txt
LLVM 13.0.0 fails to compile on modern toolchains: - uintptr_t undeclared (GCC 13+ stricter <cstdint>) - lseek64 unavailable on musl libc Both fixed in 14.0.0 (D119051 et al).
LLVM 14.0.0 also fails on modern toolchains: - uintptr_t fix (D119051) only landed in 15.0.0 - lseek64 musl fix (D128254) only landed in 15.0.0 15.0.0 is the minimum that compiles with GCC 13+ and musl libc.
- Fix CMakeLists.txt: Clang headers are at lib/clang/<FULL_VERSION>/include not lib/clang/<MAJOR>/include (broke at 15.0.0 where compilation succeeded but install step failed) - Bump to 16.0.0: lseek64 musl fix (D128254) only available in 16.0.0+
…armv7l - Remove clang resource headers install: clang-apply-replacements only needs the binary, not builtin headers. Path resolution was broken across LLVM versions (headers go to lib/clang/X.Y/ but directory structure varies). - Remove musllinux armv7l from CI matrix: cibuildwheel has no Docker image for this combination (quay.io/pypa/musllinux_1_2_armv7l 404). - Add fail-fast: false so one failing job doesn't cancel all others.
…#1) * chore: revamp README with user-focused structure - Rewrite README as user-focused documentation: add Why, Quick Start, Usage examples, FAQ, Troubleshooting, Platform Support, and Related Projects sections - Add Table of Contents, badge wall, and cross-references to the cpp-linter ecosystem hub - Extract maintainer content (build/release instructions) to new CONTRIBUTING.md - Add SECURITY.md with vulnerability reporting policy and binary integrity statement * fix: correct broken links and unverified claims in README - Replace 404 discussions link with issues link - Replace 404 LLVM docs link with clang-tools-extra index - Fix broken [cpp-linter][] reference in FAQ - Remove unverified --edit flag claim - Fix issue template links in CONTRIBUTING.md (templates don't exist yet) - All 25 external links verified with curl (all 200) - Visual improvements: add --- separator, callout boxes, compact requirements table * Update README to remove HTML tags from title * Remove license badge from README Removed license badge from README.md. * Update CONTRIBUTING.md * docs: remove Security & Troubleshooting, add related wheel projects - Drop Security section and SECURITY.md (binaries are upstream LLVM, security issues belong there) - Drop Troubleshooting section (minimal value for a thin wrapper) - Add clang-format-wheel, clang-tidy-wheel, clang-apply-replacements-wheel to Related Projects * Remove Python version badge from README Removed Python version badge from README. * Fix badge display in README.md * Remove cpp-linter links from README Removed links to cpp-linter resources from README. * Update README.md * Remove cpp-linter references from README Removed references to cpp-linter-action and cpp-linter-hooks from the README. * docs: drop Requirements, Acknowledgments; merge pipx/Verify into Installation * docs: remove How It Works, Platform Support; trim Related Projects; fix inaccurate cpp-linter-action claim * docs: polish README — move warnings up, fix version, remove ads, add --help * docs: strip to packaging essentials — defer usage docs to upstream * docs: tighten CONTRIBUTING — merge release sections, clarify packaging-only scope
…#2) This PR revamps the README and adds a CONTRIBUTING.md, matching the same structure used in [clang-include-cleaner#1](cpp-linter/clang-include-cleaner-wheel#1). ## Changes ### README.md (rewritten) - User-focused structure with badge wall (PyPI version, Platform, Build, Downloads, cpp-linter hub) - Table of Contents for easy navigation - Installation section with `pip install`, `pipx` tip for CI, verify command - Related Projects section linking to clang-format-wheel, clang-tidy-wheel, and clang-include-cleaner - Contributing section (links to CONTRIBUTING.md and issues) - License section ### CONTRIBUTING.md (new) - Reporting Issues and Pull Requests guidelines - Development Setup (clone, install, run tests) - Releasing section covering build process, versioning, and step-by-step release instructions - Manual workflow trigger inputs table
) * chore: auto draft release and auto-tag on version change - Add release-drafter.yml: creates/updates a draft GitHub Release when a PR changes clang-apply-replacements_version.txt - Add auto-tag.yml: on push to main, auto-creates and pushes the git tag when the version file changed - Update CONTRIBUTING.md to reflect the new automated flow The existing release.yml (tag-triggered build+publish) is unchanged. * chore: add prepare-release workflow and improve release-drafter - New prepare-release.yml: manually trigger to auto-create a version bump PR with consistent title and description every time - Improved release-drafter.yml: - Auto-labels the PR as 'release' - Uses PR body as release notes in the draft - Fixes duplicate comments by updating existing bot comment - Updated CONTRIBUTING.md with both automated and manual release paths * chore: drop release-drafter, simplify to 3 workflows Remove release-drafter.yml — the PR itself serves as the release draft. No need for a separate GitHub Draft Release that adds complexity. Final workflow count: 3 (prepare-release + auto-tag + release) * Apply suggestions from code review Co-authored-by: Xianpeng Shen <xianpeng.shen@gmail.com> * chore: add monitor-llvm workflow to track upstream releases Daily cron checks llvm/llvm-project for new stable releases. Creates an issue labeled 'llvm-update' when a newer version is found, with instructions to use the prepare-release workflow. * fix: address code review findings prepare-release.yml: - Remove stale 'draft GitHub Release' reference in PR body - Use heredoc + sed to avoid shell string quoting issues - Handle re-run: delete stale branch before creating new one auto-tag.yml: - Fix workflow_dispatch: skip diff check on manual trigger (previously would never create a tag because no new commit) monitor-llvm.yml: - Replace --paginate with --per-page 100 to avoid nested array edge case in gh api + --jq - Use heredoc + --body-file to avoid leading whitespace in issue body (was causing code-block rendering)
When the prepare-release workflow runs multiple times for the same version, the remote release/vX.Y.Z branch already exists from a prior run. The local checkout from main doesn't have that commit, so git push is rejected as a non-fast-forward. Delete the remote branch first (if it exists) so the push always succeeds.
chore: bump version to 17.0.6 Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
fix: undefine GCC14 __arm_streaming macro on aarch64 builds GCC 14 on aarch64 (manylinux container) defines __arm_streaming as a macro for ARM SME support. When the C preprocessor expands this inside kw_ ## __arm_streaming (from Clang's TokenKinds.def), it produces kw_ ## [[...] which is invalid token pasting. Adding -U__arm_streaming to CMAKE_C_FLAGS and CMAKE_CXX_FLAGS cancels GCC's macro definition, allowing Clang's own __arm_streaming identifier to be used without interference. -U on a non-existent macro is a no-op, so this is safe on all platforms. Closes the aarch64 build failure in the Build + Release Wheels workflow.
Follow the layout the other cpp-linter READMEs move to: name, two badges, one sentence, a link line, then Quick start, Usage, Supported versions, Contributing and License. The wheel bundles no builtin headers and the binary is not statically linked. LICENSE.md is plain Apache 2.0; the LLVM Exceptions apply to the bundled binary only. pipx is preinstalled on GitHub-hosted runners, not on all runners. Usage now shows the clang-tidy --export-fixes flow, run as written, and Supported versions lists what PyPI has. Fix the 404 Discussions link in CONTRIBUTING.md and the 404 Documentation URL in pyproject.toml (shown on PyPI).
Follow the layout the other cpp-linter READMEs move to: name, two badges, one sentence, a link line, then Quick start, Usage, Supported versions, Contributing and License. clang-include-cleaner also reports missing includes, not only unused ones. The binary is not statically linked. LICENSE.md is plain Apache 2.0; the LLVM Exceptions apply to the bundled binary only. pipx is preinstalled on GitHub-hosted runners, not on all runners. Usage now runs the tool on one file with a compilation database, as written. Fix the 404 Discussions link in CONTRIBUTING.md and the 404 Documentation URL in pyproject.toml (shown on PyPI).
chore: bump version to 23.1.4
A DNS lookup of pypi.org failed inside the manylinux i686 container while pip installed the build requirements. pip gave up after its default 5 retries (about 8 seconds), and fail-fast then cancelled the other 10 wheel builds, so v23.1.6 was not published. - publish.yml: fail-fast: false, so the other platforms finish and only the failed job needs a re-run. - pyproject.toml: PIP_RETRIES=10 in the cibuildwheel environment, so pip keeps retrying for several minutes. Co-authored-by: Xianpeng Shen <3353385+shenxianpeng@users.noreply.github.com>
In the clang-include-cleaner v23.1.6 release, a DNS lookup of pypi.org failed inside the manylinux i686 container and pip gave up after its default 5 retries (about 8 seconds). This repo builds wheels the same way. Set PIP_RETRIES=10 in the cibuildwheel environment, so pip keeps retrying for several minutes. fail-fast is already off here. Co-authored-by: Xianpeng Shen <3353385+shenxianpeng@users.noreply.github.com>
…ow (#12) * chore: build and test the wheels with the shared cpp-linter workflow * chore: call the shared binary wheel workflow from main
…uilding LLVM (#24) * feat!: repackage the static binaries with hatch-prebuilt instead of building LLVM * chore: call the shared wheel workflows from main * test: check the command after uv tool install and pip install --user The smoke test takes --bin for the new runs in the shared wheel tests. Until that change is merged, the test workflow points at its branch. * build: use hatch-prebuilt 0.2 and the shared workflows from main * docs: point the links at the renamed repository * docs: use the renamed repository directory in the setup steps --------- Co-authored-by: Xianpeng Shen <3353385+shenxianpeng@users.noreply.github.com>
…uilding LLVM (#16) * chore: build and test the wheels with the shared cpp-linter workflow * chore: call the shared source-built wheel workflow from main * feat!: repackage the static binaries with hatch-prebuilt instead of building LLVM * chore: call the shared wheel workflows from main * fix: find the builtin headers after uv tool install and pip install --user on Windows Both installers put the command away from the headers on Windows. With hatch-prebuilt 0.2 the wheel keeps the executable and the headers together in the clang_include_cleaner package, and a console script starts it. The smoke test takes --bin for the new uv tool and --user runs. Until hatch-prebuilt 0.2 and the cpp-linter/.github change are released, the build and the test workflow point at their branches. * build: use hatch-prebuilt 0.2 and the shared workflows from main * docs: point the links at the renamed repository * docs: use the renamed repository directory in the setup steps
* chore: release with the shared cpp-linter wheel workflows * fix: keep gh-action-pypi-publish v1.14.3 * refactor: build the wheels with hatch-prebuilt * chore: call the shared wheel workflows from main * test: check the command after uv tool install and pip install --user The smoke test takes --bin for the new runs in the shared wheel tests, and skips the man page check there. Until that change is merged, the test workflow points at its branch. * test: call the shared wheel tests from main again
…ion (#17) * refactor: configure the build in pyproject.toml and share the automation The recipe is now three lines of [tool.hatch.metadata.hooks.prebuilt], so hatch_build.py goes. The five small workflows (labels, pre-commit, release drafts, LLVM updates, stale issues) become one automation.yml that calls wheel-automation.yml in cpp-linter/.github, and test.yml only names the shared workflow. CONTRIBUTING.md and zizmor.yml go too: the org-wide guide and the runbooks in cpp-linter/.github cover them. The wheels are the same as before, byte for byte, but for the README. * refactor: call the shared workflows in cpp-linter/wheels * build: require hatch-prebuilt 0.3 from PyPI and the wheels workflows from main
* chore: release with the shared cpp-linter wheel workflows * fix: keep gh-action-pypi-publish v1.14.3 * refactor: build the wheels with hatch-prebuilt * chore: call the shared wheel workflows from main * test: check the command after uv tool install and pip install --user The smoke test takes --bin for the new runs in the shared wheel tests, and skips the man page check there. Until that change is merged, the test workflow points at its branch. * test: call the shared wheel tests from main again * refactor: share the automation from cpp-linter/wheels The labeler, pre-commit, release-drafter, monitor and stale workflows become one automation.yml that calls wheel-automation.yml in cpp-linter/wheels, which also releases each new ccache version through the cpp-linter-publisher App. test.yml and publish.yml call the wheels workflows; CONTRIBUTING.md and zizmor.yml go, the README points to the org guide and the wheel runbooks. The ccache recipe stays in hatch_build.py, now with hatch-prebuilt 0.3.
…ion (#25) The recipe moves from hatch_build.py into [tool.hatch.metadata.hooks.prebuilt], read by hatch-prebuilt 0.3. The labeler, pre-commit, release-drafter, monitor and stale workflows become one automation.yml that calls wheel-automation.yml in cpp-linter/wheels, which also releases each new LLVM version through the cpp-linter-publisher App. test.yml and publish.yml call the wheels workflows; CONTRIBUTING.md and zizmor.yml go, the README points to the org guide and the wheel runbooks.
Co-authored-by: cpp-linter-publisher[bot] <361267204+cpp-linter-publisher[bot]@users.noreply.github.com>
…-cleaner The repository files go; the README and project.urls point here, and the package joins the catalog.
…y-replacements The repository files go; the README and project.urls point here, and the package joins the catalog.
The repository files go and the links point here. [tool.wheels] carries what test.yml and automation.yml passed to the shared workflows: the version file, the upstream and its latest release, the source code for the GitHub release, MSVC, and the runners and containers. The recipe gives the uv targets and the release notes, and the code follows the repository's formatting. binary-wheels.yml installs hatch-prebuilt with its minisign extra, which the ccache recipe needs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Moves three more packages into
packages/, each with its history:clang-include-cleanerclang-apply-replacementsccache-binEach package gets two commits: a
git filter-repo --to-subdirectory-filterimport, then one that removes the repository files, points the README andproject.urlshere, and sets[tool.wheels].moved-from: the defaults fit them.test.ymlandautomation.ymlpassed to the shared workflows:[tool.wheels]: the version file, upstreamccacheand its latest release, the GPL source archive for the GitHub release, MSVC, and its runners and containers (riscv64 and s390x on QEMU);minisignextra, which the ccache recipe needs to check signatures.The Linux x86_64 wheels built here match the ones on PyPI (clang-include-cleaner 23.1.6, clang-apply-replacements 23.1.6, ccache-bin 4.14.4) file for file, except METADATA. Those versions are already on PyPI, so the merge releases nothing.
Before merging
cpp-linter/wheels,publish.yml, environmentpypi(testpypi): clang-include-cleaner, clang-apply-replacements, ccache-bin.Checked
pytest: 35 passed; pre-commit clean.python -m hatch_prebuilt infoandrelease-notesfor ccache-bin;python hatch_build.py sourcedownloads and verifies the source archive.