Skip to main content

Hawkmoth - Sphinx Autodoc for C

Project description

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.

Note

The C++ support is still in early stages of development, and lacks some fundamental features such as handling namespaces and documenting C++ specific features other than classes.

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 CONTRIBUTING.rst for more details.

Dependencies

Dependencies and their minimum versions:

  • Python 3.8

  • Sphinx 3

  • Clang library 6

  • Python 3 Bindings for Clang library 6

There are additional development and testing dependencies recorded in setup.cfg.

License

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

Contact

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hawkmoth-0.18.0.tar.gz (32.5 kB view details)

Uploaded Source

Built Distribution

hawkmoth-0.18.0-py3-none-any.whl (31.0 kB view details)

Uploaded Python 3

File details

Details for the file hawkmoth-0.18.0.tar.gz.

File metadata

  • Download URL: hawkmoth-0.18.0.tar.gz
  • Upload date:
  • Size: 32.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.2

File hashes

Hashes for hawkmoth-0.18.0.tar.gz
Algorithm Hash digest
SHA256 5ebe08d21914d929e6dfd3db5d019780ce8b2acda0496deac8fb2dd498998e17
MD5 64e0e7d3537bcf609b084dd4f360800a
BLAKE2b-256 110bf019c272d1cabc588e9d238250b006ae0227fe3dde1f93d3591ed29f2efd

See more details on using hashes here.

File details

Details for the file hawkmoth-0.18.0-py3-none-any.whl.

File metadata

  • Download URL: hawkmoth-0.18.0-py3-none-any.whl
  • Upload date:
  • Size: 31.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.2

File hashes

Hashes for hawkmoth-0.18.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b43145950112db7ea30c5c1669b402a46b1b2234c253475f17a3801a93271c99
MD5 122dcedf59a68c7e4c1b018842fb842f
BLAKE2b-256 b99e5c4ba3478aa501058fedfaff5c8d88a907d3c615d043644e3a7b0829d886

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page