Skip to main content

Reads and parses documentation from header files in pure Python.

Project description

PyPI version CI codecov

The docblock package reads and parses documentation from C++ header files. It should also work out of the box for C header files, but that is currently untested. It is opinionated and explicitly does not cover all edge cases of the C++ grammar, but hopes to provide sufficient utility for most use cases. The package assumes documentation blocks are formatted using C-style comments, as follows:

/**
 * Text
 */
void func();

That is, the documentation block starts with /* or /**, and ends with */. Any starting * on documentation lines in the block are allowed, but not required.

To avoid parsing issues, non-documentation block comments SHOULD NOT use C-style comments.

The docblock package is a pure Python package and depends only on pyparsing. It can be installed as

pip install docblock

Example usage

TODO

Why docblock?

Parsing documentation from header files is common practice to generate documentation, particularly in mixed-language projects where the C++ components are intended to be used from another language. One tool that simplifies this for C++-to-Python is pybind11_mkdoc. That tool, however, relies on clang and the LLVM project to parse C++ documentation blocks: great if you're already using clang, but very heavy-handed if you do not.

This is where docblock comes in: it is a pure Python package that does not aim to parse all of C++'s grammar, but only extracts the documentation block's content and the function point it documents. That is far easier to implement (not requiring a full compiler), but does mean it will very likely not parse all documentation blocks correctly. Feel free to open an issue if you have an example that is not parsed correctly by docblock.

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

docblock-0.0.1.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

docblock-0.0.1-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file docblock-0.0.1.tar.gz.

File metadata

  • Download URL: docblock-0.0.1.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.9.17 Linux/5.15.0-1041-azure

File hashes

Hashes for docblock-0.0.1.tar.gz
Algorithm Hash digest
SHA256 2272b3d567274923266f8037cfb3c1cd7490408b7ad40ebdaab701479cae4660
MD5 60dd896cfae74d6e5f8c4e95b42d95b6
BLAKE2b-256 35d8ba0f872c31a31e0b8f05d7ec0b7fa73356cf6b2565fcb56a8fe680b0e6bd

See more details on using hashes here.

File details

Details for the file docblock-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: docblock-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 6.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.9.17 Linux/5.15.0-1041-azure

File hashes

Hashes for docblock-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8e4e40641ce679e3a5fca73e75293212af4e20d3d1527089d6dfc2418f222cd3
MD5 b320855a52aa809fb5afa022358b2576
BLAKE2b-256 7a165e9c60057b4a93f36ee92bb5701fa889236dfa591592694e3172dbc98a5d

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