LLVM/Clang Toolchain Build Tools - Rust-powered toolchain packaging with Python bindings
Project description
clang-tool-chain-bins
clang-tool-chain-bins is the package and CLI for querying and installing the archived LLVM, Clang, MSVC-adjacent, and related tool bundles managed in this repository.
It is designed for machine consumption first:
- per-archive JSON indexes for every
*.tar.zst - aggregate tool index for exact and glob lookup
- JSON Lines query output for scripting and AI agents
- install resolution with cache tracking and concurrency-safe locking
Install
pip install clang-tool-chain-bins
The CLI uses ~/.clang-tool-chain as its default cache and install root. Set CLANG_TOOL_CHAIN_DOWNLOAD_PATH or pass --home-dir to use a different location.
Python API
The published package now exposes an importable top-level API at clang_tool_chain_bins.
from clang_tool_chain_bins import ensure, install, is_installed, query, resolve_one
matches = query("clang", platform="win", arch="x86_64")
selected = resolve_one("clang", platform="win", arch="x86_64", version="21.1.5", component="clang")
if not is_installed("clang", platform="win", arch="x86_64", version="21.1.5", component="clang"):
result = ensure("clang", platform="win", arch="x86_64", version="21.1.5", component="clang")[0]
print(result.install_path)
Public API types:
ToolMatchQueryResultInstallResult
Public API functions:
query(*patterns, ...)resolve(tool, ...)resolve_one(tool, ...)is_installed(tool, ...)install(tool, ...)ensure(tool, ...)try_install(tool, ...)
Query CLI
query is the discovery command. Default JSONL output returns one matched entry per line.
- Patterns without glob characters are exact matches.
- Patterns containing
*,?, or[]use glob matching. - Matching is case-insensitive against both normalized
tool_nameand the archivedfile_name. - Filters narrow matches by
platform,arch,version, andcomponent. - Output is JSON Lines by default, one matched entry per line. Use
--prettyfor a human-readable table plus per-match source URL and install path details.
Exact lookup:
clang-tool-chain-bins query clang
Glob lookup:
clang-tool-chain-bins query "llvm-*"
Multiple patterns in one call:
clang-tool-chain-bins query clang clang++ --platform linux --arch x86_64
Pretty output:
clang-tool-chain-bins query clang++ --pretty
Typical JSONL shape:
{"query":"clang","tool_name":"clang","file_name":"clang","component":"clang","version":"21.1.5","platform":"linux","arch":"x86_64","archive_url":"https://...","source_urls":["https://..."],"archive_sha256":"...","local_cache_path":"...","install_path":"...","installed":false}
Each JSON line for a match includes the aggregate index metadata plus derived local state such as:
querytool_nameandfile_namecomponent,version,platform,archarchive_filename,archive_path,archive_sha256,archive_urlsource_urlspath_in_archive,tool_type,tool_sha256,sizeparts,download_kind,probe_urlslocal_cache_pathinstall_pathinstalled
installed is a local state check against the selected home directory. It becomes true when the install directory or its done.txt marker already exists there; it is not a remote availability check.
install_path is always the resolved destination for that archive candidate, even when installed is false. source_urls resolves to the concrete download URL list for that match; for normal archives it is a one-item list, and for multipart archives it contains the part URLs.
If a query has no matches, the JSONL stream emits a marker line like {"query":"missing-tool","matched":false}.
Index selection for query works like this:
--index PATHuses that local aggregate index file.CLANG_TOOL_CHAIN_BINS_INDEX_URLoverrides the remote index URL when--indexis not set.- Otherwise the CLI first tries to discover a repo-relative raw GitHub
tool-index.json. - If that remote lookup fails, it falls back to the packaged local index at
tools/data/tool-index.json.
Install CLI
install resolves an exact tool or filename to one or more archive candidates, then downloads and extracts the selected archive.
installdoes not support globs.- Matching is exact against
tool_nameorfile_name. - If more than one archive matches, the command exits with an error unless you add filters or pass
--all. - Output is always JSON, one object per installed candidate.
--dry-runprints the install plan without downloading or extracting anything.
Install a single archive:
clang-tool-chain-bins install clang --platform linux --arch x86_64
Preview the plan only:
clang-tool-chain-bins install clang --platform linux --arch x86_64 --dry-run
If multiple archives match, narrow the selection with:
--platform--arch--version--component
Use --all to install every matching archive.
Typical install result:
{"operation":"install","status":"installed","tool_name":"clang","component":"clang","version":"21.1.5","platform":"linux","arch":"x86_64","install_path":"~/.clang-tool-chain/clang/linux/x86_64","archive_sha256":"...","archive_url":"https://...","dry_run":false}
Possible status values include:
installedalready_installeddry_run
The installer is concurrency-safe for each component/platform/arch target:
- archives are cached under
HOME/archives/ - installs land under
HOME/<component>/<platform>/<arch>/ - a per-target lock file prevents concurrent writers
done.txtrecords the installed archive hash and source URL
Download behavior:
file://archive URLs are copied directly- HTTP(S) archive URLs are downloaded automatically
install uses the packaged local aggregate index unless --index is provided. Unlike query, it does not try to fetch a remote index automatically.
Index Generation
Generate or refresh sidecar indexes and the aggregate tool index:
clang-tool-chain-bins-index
Publishing
Build and validate release artifacts locally:
clang-tool-chain-bins-publish --skip-upload
Publish to TestPyPI:
clang-tool-chain-bins-publish --testpypi
Publish to PyPI:
clang-tool-chain-bins-publish
By default the publish script reads the token from PYPI_TOKEN.
Repository Scope
This repository still contains maintainer-oriented archive build scripts under tools/. The published package hardens the artifact boundary so wheel and sdist contents are limited to intentional code, metadata, tests, and generated tool index data rather than the raw archive payloads.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file clang_tool_chain_bins-0.4.1.tar.gz.
File metadata
- Download URL: clang_tool_chain_bins-0.4.1.tar.gz
- Upload date:
- Size: 53.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b0ed5f955047ec46fe1608e75570377372da564c2c37a3b0ffd70721035004cc
|
|
| MD5 |
f9739797f819d95b3d305a2b2fcb4bbd
|
|
| BLAKE2b-256 |
1fe7dd6b109aaf79a2d10ae556354f7dad879b8b8ba4f2b56d998114ed151555
|
File details
Details for the file clang_tool_chain_bins-0.4.1-cp310-abi3-win_amd64.whl.
File metadata
- Download URL: clang_tool_chain_bins-0.4.1-cp310-abi3-win_amd64.whl
- Upload date:
- Size: 538.3 kB
- Tags: CPython 3.10+, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e3892b124162a3d979ffbd1d12df5c6b59d8f6d97275d9ad2e13290851e453da
|
|
| MD5 |
beb91918150c094f3d7e8b8631e94efe
|
|
| BLAKE2b-256 |
dda250cb84207ec5d239fe7a51c4d3d13b5b2f15525e59845c6edcf3193047c6
|
File details
Details for the file clang_tool_chain_bins-0.4.1-cp310-abi3-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: clang_tool_chain_bins-0.4.1-cp310-abi3-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 901.1 kB
- Tags: CPython 3.10+, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
75fd6fe04562f6324175b4b3f3b3c797305b9035b678a2cbea8cc1bbbfa9236d
|
|
| MD5 |
6f61eccbc4f02b8b8a6f5f88541b3e65
|
|
| BLAKE2b-256 |
a97045530959322a625946e1bff264a0dd4843c9d6c15c52327707703bae798e
|
File details
Details for the file clang_tool_chain_bins-0.4.1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: clang_tool_chain_bins-0.4.1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 645.3 kB
- Tags: CPython 3.10+, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
68ac3580d4d5f3cda23fb19d85717f6089c5b84e19eb7c1f31c83edd3b45d126
|
|
| MD5 |
691434838971f34823b945e6f03e100a
|
|
| BLAKE2b-256 |
732f1d29716de2e2769133984dfacef92604ce9549579890a5f88bf2ea538812
|
File details
Details for the file clang_tool_chain_bins-0.4.1-cp310-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: clang_tool_chain_bins-0.4.1-cp310-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 676.8 kB
- Tags: CPython 3.10+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d37803e26a7a72aa7a023fbc72b7fc7b2dcfcfda886631bae6251ba446377a62
|
|
| MD5 |
0763d9458be65796f83c0814c98a3b07
|
|
| BLAKE2b-256 |
3e5fc20fa85a00d89900bde113832321f8de316aa0714d3fe84dd988311f02f7
|
File details
Details for the file clang_tool_chain_bins-0.4.1-cp310-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: clang_tool_chain_bins-0.4.1-cp310-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 765.6 kB
- Tags: CPython 3.10+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b127afe5dd787b2eba219fe1b45ee2e9915340fb2d50e23da7a7b33aa26eba07
|
|
| MD5 |
4e23c93418e5604a9ee4b64e4707594e
|
|
| BLAKE2b-256 |
8f1da1a4c82ca3b0c8f0c56b63965877bd3bdb4ec358e0c67a040a96b72c9864
|