Skip to main content

A sphinx autodoc extension for c modules

Project description

sphinx-c-autodoc
================

|build-status| |coverage| |black| |docs|

Dual-licensed under MIT or the `UNLICENSE <https://unlicense.org>`_.

.. inclusion_begin

A basic attempt at extending `Sphinx`_ and `autodoc`_ to work with C files.

The idea is to add support for similar directives that `autodoc`_ provides. i.e.

A function in ``my_c_file.c``:

.. code-block:: c

/**
* A simple function that adds.
*
* @param a: The initial value
* @param b: The value to add to `a`
*
* @returns The sum of `a` and `b`.
*
*
int my_adding_function(int a, int b) {
return a + b;
}

Could be referenced in documentation as:

.. code-block:: rst

.. autocfunction:: my_c_file.c::my_adding_function

With the resulting documentation output of:

.. Note this isn't using the c:function directive because that doesn't work on
pypi

int my_adding_function(int a, int b)
A simple function that adds.

:Parameters:
* **a** - The initial value
* **b** - The value to add to `a`

:Returns: The sum of `a` and `b`

.. _autodoc: https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html
.. _Sphinx: https://www.sphinx-doc.org/en/master/index.html

Requires
--------

* `clang <https://pypi.org/project/clang/>`_
* `beautifulsoup4 <https://www.crummy.com/software/BeautifulSoup/bs4/doc/>`_

Similar Tools
-------------

* `hawkmoth <https://github.com/jnikula/hawkmoth>`_ a sphinx extension that
which will document all of a C file. It supports being able to regex list
files and have those files be documented.
* `breathe <https://github.com/michaeljones/breathe>`_ A doxygen output to
sphinx tool.

.. |build-status| image:: https://github.com/speedyleion/sphinx-c-autodoc/workflows/Python%20package/badge.svg
:alt: Build Status
:scale: 100%
:target: https://github.com/speedyleion/sphinx-c-autodoc/actions?query=workflow%3A%22Python+package%22

.. |coverage| image:: https://codecov.io/gh/speedyleion/sphinx-c-autodoc/branch/master/graph/badge.svg
:alt: Coverage
:scale: 100%
:target: https://codecov.io/gh/speedyleion/sphinx-c-autodoc

.. |black| image:: https://img.shields.io/badge/code%20style-black-000000.svg
:alt: Code Style
:scale: 100%
:target: https://github.com/psf/black

.. |docs| image:: https://readthedocs.org/projects/sphinx-c-autodoc/badge/?version=latest
:alt: Documentation Status
:target: https://sphinx-c-autodoc.readthedocs.io/en/latest/?badge=latest

.. inclusion_end

Full Documentation
------------------

The complete documentation can be found at https://sphinx-c-autodoc.readthedocs.io/en/latest

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

sphinx_c_autodoc-1.2.0.tar.gz (31.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sphinx_c_autodoc-1.2.0-py3-none-any.whl (34.1 kB view details)

Uploaded Python 3

File details

Details for the file sphinx_c_autodoc-1.2.0.tar.gz.

File metadata

  • Download URL: sphinx_c_autodoc-1.2.0.tar.gz
  • Upload date:
  • Size: 31.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.1 CPython/3.11.4

File hashes

Hashes for sphinx_c_autodoc-1.2.0.tar.gz
Algorithm Hash digest
SHA256 c7d371d19b1e0d10a9e3b5be63ee6444dda249737b4a1390998c5b0c566dbe9d
MD5 f9aaef1a559c5ff8827e6c697ff4c79b
BLAKE2b-256 e15e36732ffe0c92e344b4171df57272d892a54a3926f827407523227d387683

See more details on using hashes here.

File details

Details for the file sphinx_c_autodoc-1.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for sphinx_c_autodoc-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c4e9fb491aa07973055a47bbade0dbc15ee719c21206290646fee6193aa25177
MD5 cd66f802a8c380a6c4e10a261f76da07
BLAKE2b-256 00d6ffa86b8cf99b3b266494c410433e1e2bd2975d5db9979ae937d6b1dd02ff

See more details on using hashes here.

Supported by

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