Skip to main content

A package for creating directed graph from python files

Project description

Code2graph

This repo contains a project for creating a directed graph from python files in a specific destination. The code2graph generates a dot files that can be visualized by Graphviz (or any other application). If you want code2graph also can generate an svg/png file but if your host machine doesn't have enough memory it will face problems to visualize huge projects.

Each node in the graph is a function in the python files and it points to all other functions/libraries that have been used in that function.

NOTE:

This project has been tested only on Linux and not on Windows or Mac.

Installation

This program has been published as a pip package and can be installed via below command:

pip install code2graph

Usage

$ code2graph.py -h
Usage:
    test.py PATH [ --svg] [ --png] [--scope=<SCP>]
    test.py [ -h | --help ]
    test.py -v

Arguments:
    PATH                The path to directory that you want to generate its graph. This can be the root of a project and code2graph will recursively finds all the python files there or just any directory containing python files. Note: the path must end with "/" for example:("/home/guest/workspace/")

Options:
    -h --help           Show this screen
    --svg               Generates an svg file in addition to the dot files
    --png               Generates a png file in addition to the dot files
    --scope=<SCP>       Defines the scope of the generating graph:
                        file --> graph (dot file + svg/png) will be created only for each python file and will be saved with the same name and at the same path of the file
                        project --> graph (dot file + svg/png) will be created only for the whole project (PATH) and single graphs will not be created for each python file
                        all --> both will be generated [default: all]
    -v                  Version

# Example usage:
$ code2graph.py /home/user/workspace/code2graph/sample_graph/ --png --scope all

The above example usage will generate one dot file and one png file for each python file in the sample_graph directory and in addition to that it will also generate one dot file and one png file for all the python files in that directroy which you can see here as an example: c2g-project

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

code2graph-0.0.5.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

code2graph-0.0.5-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file code2graph-0.0.5.tar.gz.

File metadata

  • Download URL: code2graph-0.0.5.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.30.0 CPython/3.6.9

File hashes

Hashes for code2graph-0.0.5.tar.gz
Algorithm Hash digest
SHA256 8db536cddcc036be405e53478b709c78aaa5bd83d10b468508b57067d416cb5a
MD5 4036df0c8b5719ea27840c8d35aa17dd
BLAKE2b-256 9d1e829c0da5238d4182a7cd02922593039683c3a2b05498a32bfcf7a8308454

See more details on using hashes here.

File details

Details for the file code2graph-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: code2graph-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 6.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.30.0 CPython/3.6.9

File hashes

Hashes for code2graph-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 aea0b66e5c8a9a96bdc755795ebd061bfec16406b927bbe2d1f4dce98e586c82
MD5 5a6b39f70d50c033d8dc42c4aeb4175a
BLAKE2b-256 9acb7725de8bcf20a70f1bf15775d1325c7366ba32738309e661de41085d03b9

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page