Skip to main content

GitHub tag (latest SemVer) BSD-2-Clause Makefile CI Build and Deploy Documentation Read the Docs PyPI Downloads

Hawkmoth - Sphinx Autodoc for C

Hawkmoth is a minimalistic Sphinx C and C++ Domain autodoc directive extension to incorporate formatted C and C++ source code comments written in reStructuredText into Sphinx based documentation. It uses Clang Python Bindings for parsing, and generates C and C++ Domain directives for C and C++ API documentation, and more. In short, Hawkmoth is Sphinx Autodoc for C/C++.

Hawkmoth aims to be a compelling alternative for documenting C and C++ projects using Sphinx, mainly through its simplicity of design, implementation and use.

Example

Given C source code with rather familiar looking documentation comments:

/**
 * Get foo out of bar.
 *
 * :param bar: Name of the bar.
 */
void foobar(const char *bar);

and a directive in the Sphinx project:

.. c:autofunction:: foobar
   :file: filename.c

you can incorporate code documentation into Sphinx. It’s as simple as that.

You can document functions, their parameters and return values, structs, classes, unions, their members, macros, function-like macros, enums, enumeration constants, typedefs, variables, as well as have generic documentation comments not attached to any symbols.

See the documentation examples section for more, with sample output.

Documentation

Documentation on how to install, configure and use Hawkmoth, as well as write documentation comments, with examples, is available for both the latest release and the version currently in development.

The same is also hosted at Read the Docs.

Installation

You can install Hawkmoth from PyPI with:

pip install hawkmoth

You’ll additionally need to install Clang and Python 3 bindings for it through your distro’s package manager; they are not available via PyPI. For further details, see the documentation.

Alternatively, installation packages are available for:

In Sphinx conf.py, add hawkmoth to extensions, and point hawkmoth_root at the source tree. See the extension documentation for details.

Development and Contributing

Hawkmoth source code is available on GitHub. The development version can be checked out via git using this command:

git clone https://github.com/jnikula/hawkmoth.git

Please file bugs and feature requests as GitHub issues. Contributions are welcome as GitHub pull requests.

See the developer documentation for details.

Dependencies

Dependencies and their minimum versions:

  • Python 3.9

  • Sphinx 3

  • Clang library 6

  • Python 3 Bindings for Clang library 6

There are additional development and testing dependencies recorded in pyproject.toml.

License

Hawkmoth is free software, released under the 2-Clause BSD License.

Contact

IRC channel #hawkmoth on OFTC IRC network. GitHub issues and discussions.

Metadata

Release files for hawkmoth 0.22.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 hawkmoth 0.22.0
File Size Uploaded
hawkmoth-0.22.0.tar.gz 26.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for hawkmoth 0.22.0
File Interpreter ABI Platform
hawkmoth-0.22.0-py3-none-any.whl Python 3 none any Details

Total release size: 58.0 kB

Release files / hawkmoth-0.22.0.tar.gz

Download URL hawkmoth-0.22.0.tar.gz
Size 26.0 kB
Tags Source
SHA-256 checksum
How to use checksums
bb65c16da7857ee5ec2f2bf3dd05626dc040b44b4662615afab6323769159f10
BLAKE2b-256 checksum
How to use checksums
1c50fa6009e1edbf341aa25d86d9527063f851a8ce3f19250aa355c2d49cb1da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-httpx/0.28.1

Release files / hawkmoth-0.22.0-py3-none-any.whl

Download URL hawkmoth-0.22.0-py3-none-any.whl
Size 32.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2af3cad13f5e9a7961a88f6eda6c7ca8f534e1f1303c486dbba50b936827c28f
BLAKE2b-256 checksum
How to use checksums
ccc5747efb92bc91841f0b737483cd2d5bd7700427d9dbf9a9aaf2ff8096bbfd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-httpx/0.28.1

Release history Release notifications | RSS feed

This release

0.22.0 This release

2 release files

0.21.0

2 release files

0.19.0

2 release files

0.18.0

2 release files

0.17.0

2 release files

0.16.0

2 release files

0.15.0

2 release files

0.13.0

2 release files

0.12.0

2 release files

0.10.0

2 release files

0.9.0

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6

2 release files

0.5

2 release files

0.4

2 release files

0.3

2 release files

0.2

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