This is a direct port of the Git log graphing code, which draws directed acyclic commit graphs as ASCII art. It was done very mechanically and quickly, so the code is not Pythonic. Dependencies on Git specifics should be gone but look and feel remains.
This project is alpha quality and subject to breaking API changes.
Note
💡 If you are thinking about doing a large refactoring, please submit an issue for discussion first; I consider it potentially worthwhile to stay close to the Git source.
Available for install/upgrade from PyPI:
pip install -U asciidag
As usual, it is best to install your packages into a virtual environment.
examples/demo.py
is included in the installation directory and is
executable. The core functionality is:
from asciidag.graph import Graph
from asciidag.node import Node
graph = Graph()
root = Node('root')
grandpa = Node('grandpa', parents=[root])
tips = [
Node('child', parents=[
Node('mom', parents=[
Node('grandma', parents=[
Node('greatgrandma', parents=[]),
]),
grandpa,
]),
Node('dad', parents=[
Node('bill', parents=[
Node('martin'),
Node('james'),
Node('paul'),
Node('jon'),
])]),
Node('stepdad', parents=[grandpa]),
]),
Node('foo', [Node('bar')]),
]
graph.show_nodes(tips)
Output:
copyright: | © 2016 Sam Brightman |
---|---|
license: | GNU General Public License v2.0, see LICENSE for more details. |