Skip to content

shiva-s30/coderoots

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

coderoots

Trace dependency tree for objects in python

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 ast and 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.

Usage

  • $ uv sync -> Installs the CLI in a virtual env and launches the shell
  • cr --help -> Refer the coderoots CLI documentation

Note: uv supports the execution of cli/scripts without starting a virtual env explicitly. ex: uv run cr

Example

  • 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.

About

Framework to trace dependency tree for objects in python

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages