Skip to main content

A lightweight dependency graph generator for C and more.

Project description

RedKnot



GitHub Created At GitHub commit activity GitHub contributors
GitHub last commit PyPI - Downloads

A simple dependency graph generator powered by mermaid.js

What it does

RedKnot is a dependency tree generator for your projects. It scans through the files in your project and graphs out the connections between them using mermaid.js.

Example of a graph generated by RedKnot

Features

Currently supported languages:

  • C
  • C++

RedKnot can output just the mermaid.js code as well as a simple formatted HTML document which renders the mermaid.js graph.

Installation

RedKnot can be installed via pip:

pip install redknot

You can verify the installation by running:

redknot -version
RedKnot Version 0.0.1
By Sanyam Asthana

MIT License, 2025

Usage

To use RedKnot, just run redknot in your project folder.

redknot
graph TD
stdio.h --> helper.c
stdlib.h --> helper.c
helper.h --> helper.c
stdio.h --> utils.c
stdlib.h --> utils.c
utils.h --> utils.c
stdio.h --> main.c
stdlib.h --> main.c
helper.h --> main.c
utils.h --> main.c

To save the output of RedKnot to a file, you can redirect it using the redirection operator:

redknot > file.txt

To generate an HTML file which displays the graph, you can use the -html flag:

redknot -html
        <!DOCTYPE html>
        <html lang="en">
        <head>
            <meta charset="UTF-8">
            <meta name="viewport" content="width=device-width, initial-scale=1.0">
            <title>MermaDep Graph</title>
        </head>
        <body>
            <pre class="mermaid">
        
				graph TD
				stdio.h --> helper.c
				stdlib.h --> helper.c
				helper.h --> helper.c
				stdio.h --> utils.c
				stdlib.h --> utils.c
				utils.h --> utils.c
				stdio.h --> main.c
				stdlib.h --> main.c
				helper.h --> main.c
				utils.h --> main.c

            </pre>

            <script type="module">
                import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@11/dist/mermaid.esm.min.mjs';
            </script>
        </body>
        </html>

To save the HTML output in an HTML file, you can redirect it using the redirection operator:

redknot -html > index.html

By default, RedKnot displays any errors while reading files as mermaid.js comments. You can disable the comments by passing the -nocomm flag. The -html flag has comments disabled by default.

Author's Notes

Usually, I would put a section of technical details here, but since this is a one-file project which was made in like 10 minutes, there are not really a lot of details I can possible give. I am working towards supporting more languages like Python and Java, and any contribution to the project would mean a lot!

License

MIT License

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

redknot-0.0.2.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

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

redknot-0.0.2-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file redknot-0.0.2.tar.gz.

File metadata

  • Download URL: redknot-0.0.2.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for redknot-0.0.2.tar.gz
Algorithm Hash digest
SHA256 5c27d7269b03344cb1c48951a6681b2b2e982bdad8b112808da296c1afcd7f62
MD5 d71212165175d29e33f6a19af3a5c40f
BLAKE2b-256 6141db97d1ca895d4a1781cdb9d6dca1dff1cf68782f796a3209e88a2ee5f964

See more details on using hashes here.

File details

Details for the file redknot-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: redknot-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for redknot-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f94ab79c61b8a17a62633a4eb8919d4d73445521bd2fdf5b3ab4e830e2f2a210
MD5 3c6789d6c9e6af9cdeb9c3db2b26515c
BLAKE2b-256 00df1964e2e59fb5f88aba8129dd6ae5a66908085bc535ceb21ddfc81a835908

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