Skip to main content

clangquill

ClangQuill Logo

image

Parse Doxygen-documented C++ with libclang and generate MyST Markdown API docs for Sphinx.

clangquill reads your C++ headers with libclang, extracts classes, functions, namespaces, enums and their documentation comments into a SQLite intermediate representation, and renders MyST Markdown pages. Every symbol becomes a real Sphinx C++ domain object ({cpp:class}, {cpp:function}, …) — so the generated API appears in objects.inv and cross-references like any hand-written page, with inter-symbol links resolved through {cpp:any}.

Features

  • libclang-based parsing of real C++ (c++20 / c++23 / c++26), including Doxygen comments and compile_commands.json support.
  • First-class Sphinx integration — output is MyST Markdown backed by the Sphinx C++ domain, so symbols cross-reference and show up in the search index.
  • Three front-ends for the same pipeline: a Sphinx extension, a clangquill CLI, and a Python API.
  • Incremental builds — a persistent SQLite IR plus a hash cache skip re-parsing unchanged inputs, rewrite only pages whose content changed, and delete pages for symbols that disappeared.
  • Customizable output via per-kind Jinja2 templates you can override one file at a time.
  • Choosable page layout (clangquill_group_by): one page per symbol, per file, per class, or a browsable namespace hierarchy (see below).
  • Pluggable comment parsers (Doxygen by default).

Installation

clangquill is published on PyPI. Install it with uv:

uv pip install clangquill

(Plain pip install clangquill works too.)

The Linux wheels bundle a self-contained libclang 23 from the official LLVM release, so parsing works out of the box with no system LLVM required. That bundled libclang needs glibc ≥ 2.35 (manylinux_2_35); on older distributions, build from source against your own libclang instead.

Quick start

Sphinx extension

For the common case you do not need to drive the parser yourself: enable the bundled extension and it runs the whole pipeline — parse → SQLite → MyST — at build time, regenerating pages into your source tree before Sphinx reads them.

# conf.py
extensions = ["clangquill.sphinx_ext"]  # pulls in myst_parser automatically

clangquill_input = ["../include/**/*.hpp"]
clangquill_compile_commands = "../build"  # dir holding compile_commands.json
clangquill_output_dir = "api"             # written under the Sphinx srcdir

clangquill_compile_commands is required by the extension: it parses with the flags your build system actually uses instead of guessing them, so a conf.py without it fails the build. Generate the database with cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON, meson setup or Bear. The CLI and Python API still accept manual --std/-I/-D flags.

Then reference the generated toctree from your root document:

```{toctree}
api/index
```

Every knob is a clangquill_* config value mirroring a field of clangquill.config.Config — including clangquill_template_dirs, clangquill_include_undocumented, clangquill_comment_parser and clangquill_group_by. See the configuration guide for the full reference.

Command line

The same pipeline is available standalone, handy for previewing output or wiring clangquill into a non-Sphinx build:

$ clangquill build include/geo.hpp -o docs/api --std c++20 -I include
Parsed 7 symbol(s) from 1 file(s).
Wrote 1 page(s) to /path/to/docs/api.

Run clangquill build --help for the full set of options, which mirror the clangquill_* config values.

Python API

Once a project has been parsed into the SQLite IR, the generator renders it into MyST Markdown: one page per top-level symbol plus an index.md toctree.

from clangquill.generator import Generator
from clangquill.store import Store

with Store.open("api.sqlite") as store:
    Generator(store).generate("docs/api")

Page layout

clangquill_group_by (CLI --group-by, API generate(group_by=...)) chooses how symbols are partitioned into pages:

  • symbol (default) — one page per top-level symbol. A single root namespace collapses its whole subtree onto one page.
  • file — one page per parsed source file.
  • class — one page per documented class/namespace. Splits a colossal namespace into a page per member class, but the root index still lists every page in one flat toctree.
  • namespace — a browsable hierarchy. The root index links only the top-level namespaces; each namespace gets a navigational hub page whose toctree links its sub-namespaces, one page per class, one page per free-function name (overloads together), a single lumped operators page, and grouped types (enums/typedefs/aliases/concepts) and constants (variables/macros) pages. Best for large libraries where a flat index would be unreadable: you drill down all namespaces → everything in a namespace → individual class/function pages.

Incremental builds

Set clangquill_cache_dir (or the matching CLI/API option) to make rebuilds incremental. clangquill keeps the SQLite IR and a small bookkeeping cache between runs and:

  • skips the parse when no input — or transitively #included header — changed, reusing the cached IR instead of invoking libclang again;
  • rewrites only the pages whose content changed; and
  • deletes pages whose symbols disappeared.

Without a cache directory the build is stateless: it re-parses into a throwaway database and rewrites every page each time.

Templates

Templates are the customization point. The Jinja environment looks up {kind}.md.jinja (e.g. class.md.jinja, function.md.jinja) in your own template directories before the bundled defaults, so dropping in a file of the same name overrides just that kind:

Generator(store, template_dirs=["my_templates"]).generate("docs/api")

See the templates guide for the available templates and context variables.

Building from source

clangquill ships a compiled C++ core (clangquill._core) built with scikit-build-core, CMake and nanobind. A standard install builds it:

uv pip install .
uv run python -c "from clangquill import _core; print(_core.have_libclang())"

The core optionally links libclang; when libclang-dev (or an LLVM prefix via LibClang_ROOT) of LLVM 17 or newer is available at build time the extraction backend is enabled. Pass -DCLANGQUILL_WITH_LIBCLANG=ON to require it — the configure then fails instead of silently falling back to the stub backend when no libclang is found or the one found is too old.

Documentation

Contributing

Contributions are welcome — see CONTRIBUTING.md. In short:

uv sync --extra dev
uvx pre-commit install
uv run pytest      # Python test suite
make cpp-test      # C++ (Catch2) unit tests

License

clangquill is released under the BSD 2-Clause License — see LICENSE. The Linux wheels additionally bundle libclang, distributed under the Apache-2.0 WITH LLVM-exception license.

Credits

This package was created with Cookiecutter and the renefritze/python_cookiecutter project template.

Release files for clangquill 2.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for clangquill 2.1.2
File Size Uploaded
clangquill-2.1.2.tar.gz 1.9 MB Details

Built distributions (wheels)

Table of built distributions (wheels) for clangquill 2.1.2
File Interpreter ABI Platform
clangquill-2.1.2-cp312-abi3-win_amd64.whl CPython 3.12 abi3 Windows x86-64 Details
clangquill-2.1.2-cp312-abi3-manylinux_2_35_x86_64.whl CPython 3.12 abi3 Linux glibc 2.35+ x86-64 Details
clangquill-2.1.2-cp312-abi3-manylinux_2_35_aarch64.whl CPython 3.12 abi3 Linux glibc 2.35+ ARM64 Details

Total release size: 157.2 MB

Release files / clangquill-2.1.2.tar.gz

Download URL clangquill-2.1.2.tar.gz
Size 1.9 MB
Tags Source
SHA-256 checksum
How to use checksums
f0498cca99ecc22f9762f74b226d106ad80242bb3ea52be811803ce4d86e2fef
BLAKE2b-256 checksum
How to use checksums
5b1ffb02096222eb10e946f172b770a6475272fd3f0b0769570c2564efd38bd3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 21, 2026.

Transparency log

Release files / clangquill-2.1.2-cp312-abi3-win_amd64.whl

Download URL clangquill-2.1.2-cp312-abi3-win_amd64.whl
Size 34.4 MB
Tags CPython 3.12 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
0ae11b84f4da6b4668481c7182b2cab1ea3190f37f2f0b67542dab1818bfc783
BLAKE2b-256 checksum
How to use checksums
3cb9babbd0f7834ad27a1c977d96684c617fe63436904378b462a8527cc324d5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 21, 2026.

Transparency log

Release files / clangquill-2.1.2-cp312-abi3-manylinux_2_35_x86_64.whl

Download URL clangquill-2.1.2-cp312-abi3-manylinux_2_35_x86_64.whl
Size 62.4 MB
Tags CPython 3.12 Linux glibc 2.35+ x86-64 abi3
SHA-256 checksum
How to use checksums
6e7903f8def7e5cefddc3e2ceccea79eacc148f4e565eb2985ef56a2472bb2d7
BLAKE2b-256 checksum
How to use checksums
c86d7dca424b220b42eabd17deb28006be37af4050fc7af035323fa16cae24d1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 21, 2026.

Transparency log

Release files / clangquill-2.1.2-cp312-abi3-manylinux_2_35_aarch64.whl

Download URL clangquill-2.1.2-cp312-abi3-manylinux_2_35_aarch64.whl
Size 58.4 MB
Tags CPython 3.12 Linux glibc 2.35+ ARM64 abi3
SHA-256 checksum
How to use checksums
a392de04910027302c3f711fe74ea63d917604fcf267550ee3d4ea8362504cb0
BLAKE2b-256 checksum
How to use checksums
bc6eb83c29076d62ac8a1be5a14688125d128c437f33fc0f9aed20a58bee7109
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 21, 2026.

Transparency log

Release history Release notifications | RSS feed

2.1.3

4 release files

This release

2.1.2 This release

4 release files

2.1.1

4 release files

2.1.0

4 release files

2.0.0

4 release files

1.2.0

4 release files

1.1.0

4 release files

1.0.0

4 release files

0.17.0

4 release files

0.15.0

4 release files

0.9.0

3 release files

0.8.3

3 release files

0.8.2

3 release files

0.8.1

3 release files

0.8.0

3 release files

0.7.0

3 release files

0.6.2

3 release files

0.6.1

3 release files

0.6.0

3 release files

0.5.1

3 release files

0.5.0

3 release files

0.4.0

3 release files

0.3.0

3 release files

0.2.4

3 release files

0.2.3

3 release files

0.2.2

3 release files

0.2.1

3 release files

0.2.0

3 release files

0.1.1

3 release files

0.1.0

3 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page