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.1.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.1-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: redknot-0.0.1.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.1.tar.gz
Algorithm Hash digest
SHA256 7a02e10d402dc759e42961e60886644abe7ff9d548f202790ac9ff16ec90d52f
MD5 e7eb81b884ffa2aaba964a5d105d07e4
BLAKE2b-256 bb80e70da4188813864c24389880cd96b70c56e62e06769c8ea79a367fb51c81

See more details on using hashes here.

File details

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

File metadata

  • Download URL: redknot-0.0.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a5c0e8e469fdef43912a1c01a42eb6f4359de57d17dd1324f06531fcf4cf29dc
MD5 5063ed5b64109f6a90d634a4dbf1bebb
BLAKE2b-256 9fa408171d93a0b9bc19ac294107fb203877173da3c6424370a00a094223d758

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