Skip to main content

C language utils and tools based on the clang and binutils modules.

Project description

CI Status Documentation Status Test coverage percentage

uv ruff pypeline pre-commit

PyPI Version Supported Python versions License

C language utils and tools based on the clang and binutils modules.

Installation

Install clanguru using pipx for isolated installation:

pipx install clanguru

Usage

Clanguru provides four main commands for C/C++ code analysis and utility operations:

  • Documentation: Generate (minimal) documentation for C/C++ sources functions and classes. It supports multiple output formats including Myst Markdown, standard Markdown, and RestructuredText.
  • Testing: Create mock objects for unit testing C functions
  • Analysis: Understand object file dependencies and symbol usage. It can generate HTML and Excel reports.

Check the help message for more details:

clanguru --help


 Usage: clanguru [OPTIONS] COMMAND [ARGS]...

 C language utils and tools based on the libclang module.

╭─ Options ────────────────────────────────────────────────────────────╮
│ --version  -v        Show version and exit.                          │
│ --help               Show this message and exit.                     │
╰──────────────────────────────────────────────────────────────────────╯
╭─ Commands ───────────────────────────────────────────────────────────╮
│ docs      Generate documentation for C/C++ source code.              │
│ mock      Generate mocks for C functions and variables.              │
│ parse     Parse C source code and print the translation unit.        │
│ analyze   Analyze object files dependencies.                         │
╰──────────────────────────────────────────────────────────────────────╯

For detailed help on each command, use the --help option with the command name.

clanguru analyze --help

Object File Analysis

Clanguru can analyze object files to understand their dependencies and symbol usage. For this, you need to build your project and provide the compilation database (compile_commands.json). Also, ensure that the nm command-line tool is available in your system PATH.

To generate an html dynamic dependency report, run the following command:

clanguru analyze --compilation-database compile_commands.json --output-file dependencies.html --use-parent-deps

[!NOTE] Here is the generated HTML report for my smart home temperature sensor project: https://maxiniuc.com/objects_deps/index.html. I only wrote some lines of code to make a temperature sensor available as a matter device but the esp32 modules, matter stack, and all the libraries bring a lot of code and dependencies. 🫣 Feel free to move the nodes around and explore the dependencies.

If the output file ends with .xlsx, an Excel report will be generated instead of an HTML one.

Contributing

The project uses UV for dependencies management and packaging and the pypeline for streamlining the development workflow. Use pipx (or your favorite package manager) to install the pypeline in an isolated environment:

pipx install pypeline-runner

To bootstrap the project and run all the steps configured in the pypeline.yaml file, execute the following command:

pypeline run

For those using VS Code there are tasks defined for the most common commands:

  • run tests
  • run pre-commit checks (linters, formatters, etc.)
  • generate documentation

See the .vscode/tasks.json for more details.

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

clanguru-0.17.0.tar.gz (40.6 kB view details)

Uploaded Source

Built Distribution

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

clanguru-0.17.0-py3-none-any.whl (42.1 kB view details)

Uploaded Python 3

File details

Details for the file clanguru-0.17.0.tar.gz.

File metadata

  • Download URL: clanguru-0.17.0.tar.gz
  • Upload date:
  • Size: 40.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for clanguru-0.17.0.tar.gz
Algorithm Hash digest
SHA256 9edb2f66c7d3f1269d2612288dc030c0ec6c5ee22d0363bd972c2bc6f9215529
MD5 9d22106f18df65abe8161d920f00c18f
BLAKE2b-256 1edd02e2794c05e5f92b48a617ae0353eabccfdcb700b0c8e5b367e9a3243bf8

See more details on using hashes here.

Provenance

The following attestation bundles were made for clanguru-0.17.0.tar.gz:

Publisher: ci.yml on cuinixam/clanguru

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file clanguru-0.17.0-py3-none-any.whl.

File metadata

  • Download URL: clanguru-0.17.0-py3-none-any.whl
  • Upload date:
  • Size: 42.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for clanguru-0.17.0-py3-none-any.whl
Algorithm Hash digest
SHA256 54978c0e857291d7adfeea1f9b76fe082060ac5e9b119d7714e1ff70064f9687
MD5 8ea81e89b00ce695014c32aa3899008a
BLAKE2b-256 b3cccd6c9fbc4f250d3e2fad3d07d00d9a1278f63a129f2dc63e4efb2d37fe4e

See more details on using hashes here.

Provenance

The following attestation bundles were made for clanguru-0.17.0-py3-none-any.whl:

Publisher: ci.yml on cuinixam/clanguru

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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