tags: productivity, debugging, development, system design flow
CodeRoots [cr] is a CLI designed to visualize python source code into meaningful flowcharts that describes the relationship of various objects in the module.
- It works by parsing the given source file using
astand generates a json with the predefined schema. - The json can be parsed and converted to Mermaid diagrams to visualize the dependency tree as flowcharts.
Key features are:
- Generates a json report/mermaid diagram for given input file/directory
- If user provides directory path, report is generated for all py files of that directory
- Includes all kinds of python objects. ex: variables, functions, methods, classes etc.
- It can develop a report for py scripts locally which includes a complete traceback upto module level
- User can specify if they prefer json/mermaid as output by referring to the CLI help.
$ uv sync-> Installs the CLI in a virtual env and launches the shellcr --help-> Refer the coderoots CLI documentation
Note: uv supports the execution of cli/scripts without starting a virtual env explicitly.
ex: uv run cr
cr run -i ./tests/file.py -o mermaid-> Sample command to create the mermaid diagram which renders as a flowchart
Sample report created for a test file can be found in the report directory.
Note: template structure of mermaid diagrams may need some improvements.