Skip to main content

clang-api-doc

Generate C API documentation using libclang Python bindings.

For an example see the documentation.

PyPI version CI Codacy Badge

Why?

Ideally, code should be self-documenting. To me that means little to no documentation should be needed in the code itself, as it strongly tends to harm readability if the code already explains itself. The remaining use-cases for documentation are typically

  • API references, in particular assumed usage contracts
  • usage examples
  • installation instructions
  • general introductions

This project focuses on generating API references, as the other use-cases tend to be written separate from the code.

The markdown-files generated by clang-api-doc can be used in any way you wish to create your final documentation, for example

  • mkdocs
  • sphinx
  • transform to a different format using pandoc

Installation

The clang-api-doc package is on PyPI, so you can use pip, poetry, or whatever you like to install it, for example pip install clang-api-doc.

To install it locally and in editable mode, simply install poetry and run poetry install and to load the virtual environment run poetry shell.

CLI usage

Simply call clang-api-doc once per file you wish to document, e.g.

clang-api-doc -i 'include/mylib/first.h' -o 'docs/first.md'
clang-api-doc -i 'include/mylib/second.h' -o 'docs/second.md'

or once per folder, e.g.

clang-api-doc -i 'include/mylib/' -o 'docs/'

Python package usage

from clang_api_doc import clang_api_doc

for file_in, file_out in zip(input_files, output_files):
    clang_api_doc.transform_file(file_in, file_out)

Metadata

Release files for clang-api-doc 0.4.0

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

Source distribution (sdist)

Source distribution for clang-api-doc 0.4.0
File Size Uploaded
clang-api-doc-0.4.0.tar.gz 5.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for clang-api-doc 0.4.0
File Interpreter ABI Platform
clang_api_doc-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 12.1 kB

Release files / clang-api-doc-0.4.0.tar.gz

Download URL clang-api-doc-0.4.0.tar.gz
Size 5.8 kB
Tags Source
SHA-256 checksum
How to use checksums
5e04bfac611aeaa7ffd9cb17f8df080d78eae54df573d5acf1dcf364f3e0ef82
BLAKE2b-256 checksum
How to use checksums
a0be4da637cf90b02c222fd5fd8238113743072559e5cdf505726bded30f257c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.8 CPython/3.8.11 Linux/5.8.0-1040-azure

Release files / clang_api_doc-0.4.0-py3-none-any.whl

Download URL clang_api_doc-0.4.0-py3-none-any.whl
Size 6.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
71e256058d87b7e0fb88a604e6e0737f443e0565fbba6ab1d75a96afad5d4e36
BLAKE2b-256 checksum
How to use checksums
a125036682a1047afcc3f403d604637672592fb21bbd362ccc89cea195236de1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.8 CPython/3.8.11 Linux/5.8.0-1040-azure

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

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