Skip to main content

Dependency Graph from Python imports

Project description

Carport

Dependency Graph from Python imports (CARPORT).

Installation

pip install carport

Usage

# WIP
from carport.core import ImportGraph

depg = ImportGraph(root = '..', project='carport')
# vars(depg)
ignore_nodes = ['io', 'IPython', 'pprint', 'subprocess']
dot = depg.to_dot(ignore_nodes=ignore_nodes)
dot
'digraph  {\n"carport.vis";\n"carport.core";\npathlib;\nnetworkx;\nast;\ngraphviz;\nkroki;\n"carport.vis" -> "carport.core"  [key=0];\npathlib -> "carport.core"  [key=0];\nnetworkx -> "carport.core"  [key=0];\nast -> "carport.core"  [key=0];\ngraphviz -> "carport.vis"  [key=0];\nkroki -> "carport.vis"  [key=0];\n}\n'
dotg = depg.draw_dot(ignore_nodes=ignore_nodes)
dotg

d2 = depg.to_d2(ignore_nodes=ignore_nodes)
d2
'\n        vars: { \n            d2-config: { \n                layout-engine: elk \n                } \n            }\n        direction: right\n        **.style.border-radius: 99\n        *.style.font: mono\n        \nsubprocess -> carport.vis\nIPython -> carport.vis\nast -> carport.core\npathlib -> carport.core\nnetworkx -> carport.core\nio -> carport.core\ngraphviz -> carport.vis\ncarport.vis -> carport.core\nkroki -> carport.vis\nio: null\nIPython: null\npprint: null\nsubprocess: null'
d2g = depg.draw_d2(ignore_nodes=ignore_nodes)
d2g

TODOs:

[] imports concerning __init__.py

[] py_d2 to d2 (like graphviz to graphviz)

Related

import-deps: Github

pydeps: Github

snakefood3: Github

kroki: online editor, python-interface

D2: doc, online editor, python-interface

Statistics

GitHub Repo stars PyPI - Downloads

Copyright

Copyright © 2024 onward Felidz. All rights reserved, with certain parts of the project specifically licensed and subject to different terms and conditions, e.g., source code of the project under the Apache-2.0 license; you may not use this project except in compliance with the license.

Citation

BibTeX citation:

@misc{felidz2024,
  author = {Felidz},
  title = {Carport},
  year = {2024},
  publisher = {GitHub},
  journal = {GitHub repository},
  howpublished = {\url{https://github.com/felidz/carport}}
}

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

carport-0.1.1.tar.gz (11.7 kB view hashes)

Uploaded Source

Built Distribution

carport-0.1.1-py3-none-any.whl (11.0 kB view hashes)

Uploaded Python 3

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