Skip to main content

Hawkmoth - Sphinx Autodoc for C

Project description

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

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

Larval Stage

Hawkmoth is a project very much in its infancy. The main idea is clear, the rough implementation is there and mostly working, even documentation is starting to shape up, but there are bugs, testing is inadequate, there are no promises about backwards compatible changes, it’s not packaged, etc. But it’s usable if you’re not afraid to try software that might be a bit rough around the edges.

Example

Given C source code with rather familiar looking documentation comments:

/**
 * Get foo out of bar.
 */
void foobar();

and a directive in the Sphinx project:

.. c:autodoc:: filename.c

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

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

reStructuredText style field lists are the native way of documenting function parameters and return values and so on, but there’s limited compatibility with Javadoc or Doxygen style @tags.

Documentation

More documentation, with examples, is available in the doc directory in the source tree, obviously in Sphinx format and using the directive extension. Pre-built documentation is available at Read the Docs.

Download

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

Dependencies

  • Python 3.4

  • Sphinx 1.8

  • Clang 6.0

  • Python 3 Bindings for Clang 6.0

These are the versions Hawkmoth is currently being developed and tested against. Other versions might work, but no guarantees.

Installation

In Sphinx conf.py, point sys.path at Hawkmoth, add hawkmoth to extensions, and point cautodoc_root at the source tree.

You may need to set LD_LIBRARY_PATH so that the Clang library can be found. For example:

export LD_LIBRARY_PATH=$(llvm-config --libdir)

(Did I say the project is in its early stages?)

License

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

Contact

IRC channel #hawkmoth on freenode.

Mailing list hawkmoth@freelists.org. Subscription information at the list home page.

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.1.0.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

hawkmoth-0.1.0-py3-none-any.whl (9.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: hawkmoth-0.1.0.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.5.3

File hashes

Hashes for hawkmoth-0.1.0.tar.gz
Algorithm Hash digest
SHA256 57fd6f55acb56e703a4cf213ab590ce43c46362db742b0b45cf83de9b7b2ad46
MD5 abfe591ee6b945fdec122f6965930e7b
BLAKE2b-256 f9950fabddf21ba6312eeb5d82a6b1eb25762b8824bd17619cd7c5de434e1ae1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hawkmoth-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.5.3

File hashes

Hashes for hawkmoth-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1642c9745995a3e9fe51726c8593cbd41727df303b67e5f2247b9fbbdaceb400
MD5 6e9c151168e4e228cf3508b98b447a54
BLAKE2b-256 390921f8c1a5a6806dc6619e941fc7ff44b1dee07ef77e22b37fdc2621378f80

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