git-graphable 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,28 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [ main ]
6
+ pull_request:
7
+ branches: [ main ]
8
+
9
+ jobs:
10
+ check:
11
+ name: Check and Test
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+
16
+ - name: Install uv
17
+ uses: astral-sh/setup-uv@v5
18
+ with:
19
+ enable-cache: true
20
+
21
+ - name: Set up Python
22
+ run: uv python install 3.13
23
+
24
+ - name: Install just
25
+ uses: extractions/setup-just@v2
26
+
27
+ - name: Run checks
28
+ run: just check
@@ -0,0 +1,30 @@
1
+ name: Publish
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - 'v*'
7
+
8
+ jobs:
9
+ publish:
10
+ name: Build and publish to PyPI
11
+ runs-on: ubuntu-latest
12
+ permissions:
13
+ id-token: write # Mandatory for trusted publishing
14
+ contents: read
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+
18
+ - name: Install uv
19
+ uses: astral-sh/setup-uv@v5
20
+ with:
21
+ enable-cache: true
22
+
23
+ - name: Set up Python
24
+ run: uv python install 3.13
25
+
26
+ - name: Build package
27
+ run: uv build
28
+
29
+ - name: Publish package
30
+ run: uv publish
@@ -0,0 +1,131 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so may contain sensitive information.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ htmlrep/
42
+ .pytest_worker_jsons/
43
+ .tox/
44
+ .nox/
45
+ .coverage
46
+ .coverage.*
47
+ .cache
48
+ nosetests.xml
49
+ coverage.xml
50
+ *.cover
51
+ *.py,cover
52
+ .hypothesis/
53
+ .pytest_cache/
54
+ cover/
55
+
56
+ # Translations
57
+ *.mo
58
+ *.pot
59
+
60
+ # Django stuff:
61
+ *.log
62
+ local_settings.py
63
+ db.sqlite3
64
+ db.sqlite3-journal
65
+
66
+ # Flask stuff:
67
+ instance/
68
+ .webassets-cache
69
+
70
+ # Scrapy stuff:
71
+ .scrapy
72
+
73
+ # Sphinx documentation
74
+ docs/_build/
75
+
76
+ # PyBuilder
77
+ .pybuilder/
78
+ target/
79
+
80
+ # Jupyter Notebook
81
+ .ipynb_checkpoints
82
+
83
+ # IPython
84
+ profile_default/
85
+ ipython_config.py
86
+
87
+ # PEP 582; used by e.g. github.com/lincolnloop/python-extern
88
+ __pypackages__/
89
+
90
+ # Celery stuff
91
+ celerybeat-schedule
92
+ celerybeat.pid
93
+
94
+ # SageMath libraries
95
+ *.sage.py
96
+
97
+ # Environments
98
+ .env
99
+ .venv
100
+ env/
101
+ venv/
102
+ ENV/
103
+ env.bak/
104
+ venv.bak/
105
+
106
+ # Spyder project settings
107
+ .spyderproject
108
+ .spyproject
109
+
110
+ # Rope project settings
111
+ .ropeproject
112
+
113
+ # mkdocs documentation
114
+ /site
115
+
116
+ # mypy
117
+ .mypy_cache/
118
+ .dmypy.json
119
+ dmypy.json
120
+
121
+ # Pyre type checker
122
+ .pyre/
123
+
124
+ # pytype static type analyzer
125
+ .pytype/
126
+
127
+ # Cython debug symbols
128
+ cython_debug/
129
+
130
+ # OS X
131
+ .DS_Store
@@ -0,0 +1 @@
1
+ 3.13
@@ -0,0 +1,92 @@
1
+ set dotenv-load
2
+
3
+ GIT_BRANCH:=`git branch --show-current`
4
+ GIT_COMMIT:=`git rev-parse HEAD`
5
+
6
+ @_:
7
+ just --list
8
+
9
+ _browser *args:
10
+ @uv run -m webbrowser -t {{ args }}
11
+
12
+ _cleandir name:
13
+ @rm -rf {{ name }}
14
+
15
+ _cleanfiles type:
16
+ @find . -type f -name "*.{{ type }}" -delete
17
+
18
+ [group('docs')]
19
+ usage:
20
+ PYTHONPATH=src uv run typer git_graphable.cli utils docs --name git-graphable --output USAGE.md
21
+
22
+ [group('env')]
23
+ @clean:
24
+ just _cleandir build
25
+ just _cleandir __pycache__
26
+ just _cleandir .coverage
27
+ just _cleandir .pytest_cache
28
+ just _cleandir .ruff_cache
29
+ just _cleandir htmlcov
30
+ just _cleandir htmlrep
31
+ just _cleandir _minted
32
+ just _cleandir svg-inkscape
33
+ just _cleandir docs/_build
34
+ just _cleandir docs/_extra
35
+
36
+ [group('env')]
37
+ fresh: nuke install
38
+
39
+ [group('env')]
40
+ install:
41
+ uv sync
42
+
43
+ [group('env')]
44
+ nuke: clean
45
+ just _cleandir .venv
46
+
47
+ [group('env')]
48
+ update:
49
+ uv sync --upgrade
50
+
51
+ [group('package')]
52
+ build:
53
+ uv build
54
+
55
+ [group('package')]
56
+ publish: build
57
+ uv publish
58
+
59
+ [group('qa')]
60
+ check: lint typing coverage
61
+
62
+ [group('qa')]
63
+ @coverage *args:
64
+ just test --cov=. --cov-report html --cov-report term-missing {{ args }}
65
+
66
+ [group('qa')]
67
+ [group('view')]
68
+ covrep:
69
+ just _browser htmlcov/index.html
70
+
71
+ [group('qa')]
72
+ lint:
73
+ uv run isort .
74
+ uv run ruff format
75
+ uv run ruff check --fix
76
+
77
+ [group('qa')]
78
+ @test *args:
79
+ uv run -m pytest --git-branch {{ GIT_BRANCH }} --git-commit {{ GIT_COMMIT }} --html-output htmlrep -n auto --should-open-report never {{ args }}
80
+
81
+ [group('qa')]
82
+ [group('view')]
83
+ testrep:
84
+ just _browser htmlrep/report.html
85
+
86
+ [group('qa')]
87
+ typing:
88
+ uv run ty check
89
+
90
+ [group('run')]
91
+ @run *args:
92
+ uv run git-graphable {{ args }}
@@ -0,0 +1,108 @@
1
+ Metadata-Version: 2.4
2
+ Name: git-graphable
3
+ Version: 0.1.0
4
+ Summary: A powerful tool to convert Git commit history into beautiful flowcharts.
5
+ Project-URL: Homepage, https://github.com/TheTrueSCU/git-graphable
6
+ Project-URL: Issues, https://github.com/TheTrueSCU/git-graphable/issues
7
+ Project-URL: Repository, https://github.com/TheTrueSCU/git-graphable
8
+ Author-email: Richard West <dopplereffect.us@gmail.com>
9
+ Keywords: analysis,d2,git,graph,hygiene,mermaid,topology,visualization
10
+ Requires-Python: >=3.13
11
+ Requires-Dist: graphable>=0.6.0
12
+ Provides-Extra: cli
13
+ Requires-Dist: rich>=13.0.0; extra == 'cli'
14
+ Requires-Dist: typer>=0.12.0; extra == 'cli'
15
+ Description-Content-Type: text/markdown
16
+
17
+ # Git Graphable
18
+
19
+ A powerful Python tool to convert Git commit history into beautiful, interactive flowcharts using the `graphable` library. Supporting Mermaid, D2, Graphviz, and PlantUML.
20
+
21
+ ## Git Plugin Support
22
+ When installed in your PATH, you can use this as a native Git plugin:
23
+ ```bash
24
+ git graphable .
25
+ ```
26
+
27
+ ## Features
28
+
29
+ - **Multi-Engine Support**: Export to Mermaid (.mmd), D2 (.d2), Graphviz (.dot), or PlantUML (.puml).
30
+ - **Automatic Visualization**: Generates and opens an image (SVG/PNG) automatically if no output is specified.
31
+ - **Advanced Highlighting**: Visualize author patterns, topological distance, and specific merge paths.
32
+ - **Hygiene Analysis**: Identify commits that are "behind" a base branch with divergence analysis.
33
+ - **Flexible Input**: Works with local repository paths or remote Git URLs.
34
+ - **Dual CLI**: Modern Rich/Typer interface with a robust argparse fallback for bare environments.
35
+
36
+ ## Installation
37
+
38
+ ```bash
39
+ # Using uv (recommended)
40
+ uv sync --all-extras
41
+ ```
42
+
43
+ ## Usage
44
+
45
+ For a complete reference of all command-line options, see the [USAGE.md](USAGE.md) file.
46
+
47
+ ```bash
48
+ # Basic usage (opens a Mermaid image)
49
+ uv run git-graphable .
50
+
51
+ # Specify an engine and output file
52
+ uv run git-graphable https://github.com/TheTrueSCU/graphable/ --engine d2 -o graph.svg
53
+
54
+ # Simplify the graph (only show branches/tags)
55
+ uv run git-graphable . --simplify
56
+ ```
57
+
58
+ ## Highlighting Options
59
+
60
+ Git Graphable provides several ways to highlight commits and relationships. Multiple options can be combined to layer information.
61
+
62
+ | Option | Target | Effect | Conflicts With |
63
+ | :--- | :--- | :--- | :--- |
64
+ | `--highlight-authors` | **Fill** | Unique color per author | Distance, Stale |
65
+ | `--highlight-distance-from` | **Fill** | Blue gradient fading by distance | Authors, Stale |
66
+ | `--highlight-stale` | **Fill** | Gradient white to red by age | Authors, Distance |
67
+ | `--highlight-path` | **Edge** | Thick Orange edge connecting nodes | None |
68
+ | `--highlight-critical` | **Stroke** | Thick Red Solid outline | None |
69
+ | `--highlight-diverging-from` | **Stroke** | Orange Dashed outline | None |
70
+ | `--highlight-orphans` | **Stroke** | Grey Dashed outline | None |
71
+ | `--highlight-long-running` | **Stroke/Edge** | Purple outline and thick Purple edge | None |
72
+
73
+ ### Highlighting Priorities
74
+ - **Fill**: `--highlight-authors`, `--highlight-distance-from`, and `--highlight-stale` are mutually exclusive.
75
+ - **Edge**: Path highlighting (Thick Orange) takes priority over Long-Running highlighting (Thick Purple).
76
+ - **Stroke**: Critical outlines (Thick Red) take priority over all other outlines (Divergence, Orphan, Long-Running).
77
+
78
+ ## Advanced Examples
79
+
80
+ ### Divergence Analysis (Hygiene)
81
+ Highlight commits that exist in `main` but are missing from your feature branches:
82
+ ```bash
83
+ uv run git-graphable . --highlight-diverging-from main
84
+ ```
85
+
86
+ ### Path Highlighting
87
+ See the exact sequence of commits between a feature branch and a specific tag:
88
+ ```bash
89
+ uv run git-graphable . --highlight-path develop..v1.0.0
90
+ ```
91
+
92
+ ### Large Repositories
93
+ For repositories with long histories, use the `--limit` flag to keep the graph readable and avoid engine rendering limits:
94
+ ```bash
95
+ uv run git-graphable . --limit 100 --highlight-authors
96
+ ```
97
+
98
+ ## Development
99
+
100
+ Run tests and linting:
101
+ ```bash
102
+ just check
103
+ ```
104
+
105
+ ### CI/CD
106
+ This project uses GitHub Actions for continuous integration and automated publishing:
107
+ - **CI**: Runs `just check` on all pushes and PRs to `main`.
108
+ - **Publish**: Automatically builds and publishes to PyPI when a version tag (`v*`) is pushed.
@@ -0,0 +1,92 @@
1
+ # Git Graphable
2
+
3
+ A powerful Python tool to convert Git commit history into beautiful, interactive flowcharts using the `graphable` library. Supporting Mermaid, D2, Graphviz, and PlantUML.
4
+
5
+ ## Git Plugin Support
6
+ When installed in your PATH, you can use this as a native Git plugin:
7
+ ```bash
8
+ git graphable .
9
+ ```
10
+
11
+ ## Features
12
+
13
+ - **Multi-Engine Support**: Export to Mermaid (.mmd), D2 (.d2), Graphviz (.dot), or PlantUML (.puml).
14
+ - **Automatic Visualization**: Generates and opens an image (SVG/PNG) automatically if no output is specified.
15
+ - **Advanced Highlighting**: Visualize author patterns, topological distance, and specific merge paths.
16
+ - **Hygiene Analysis**: Identify commits that are "behind" a base branch with divergence analysis.
17
+ - **Flexible Input**: Works with local repository paths or remote Git URLs.
18
+ - **Dual CLI**: Modern Rich/Typer interface with a robust argparse fallback for bare environments.
19
+
20
+ ## Installation
21
+
22
+ ```bash
23
+ # Using uv (recommended)
24
+ uv sync --all-extras
25
+ ```
26
+
27
+ ## Usage
28
+
29
+ For a complete reference of all command-line options, see the [USAGE.md](USAGE.md) file.
30
+
31
+ ```bash
32
+ # Basic usage (opens a Mermaid image)
33
+ uv run git-graphable .
34
+
35
+ # Specify an engine and output file
36
+ uv run git-graphable https://github.com/TheTrueSCU/graphable/ --engine d2 -o graph.svg
37
+
38
+ # Simplify the graph (only show branches/tags)
39
+ uv run git-graphable . --simplify
40
+ ```
41
+
42
+ ## Highlighting Options
43
+
44
+ Git Graphable provides several ways to highlight commits and relationships. Multiple options can be combined to layer information.
45
+
46
+ | Option | Target | Effect | Conflicts With |
47
+ | :--- | :--- | :--- | :--- |
48
+ | `--highlight-authors` | **Fill** | Unique color per author | Distance, Stale |
49
+ | `--highlight-distance-from` | **Fill** | Blue gradient fading by distance | Authors, Stale |
50
+ | `--highlight-stale` | **Fill** | Gradient white to red by age | Authors, Distance |
51
+ | `--highlight-path` | **Edge** | Thick Orange edge connecting nodes | None |
52
+ | `--highlight-critical` | **Stroke** | Thick Red Solid outline | None |
53
+ | `--highlight-diverging-from` | **Stroke** | Orange Dashed outline | None |
54
+ | `--highlight-orphans` | **Stroke** | Grey Dashed outline | None |
55
+ | `--highlight-long-running` | **Stroke/Edge** | Purple outline and thick Purple edge | None |
56
+
57
+ ### Highlighting Priorities
58
+ - **Fill**: `--highlight-authors`, `--highlight-distance-from`, and `--highlight-stale` are mutually exclusive.
59
+ - **Edge**: Path highlighting (Thick Orange) takes priority over Long-Running highlighting (Thick Purple).
60
+ - **Stroke**: Critical outlines (Thick Red) take priority over all other outlines (Divergence, Orphan, Long-Running).
61
+
62
+ ## Advanced Examples
63
+
64
+ ### Divergence Analysis (Hygiene)
65
+ Highlight commits that exist in `main` but are missing from your feature branches:
66
+ ```bash
67
+ uv run git-graphable . --highlight-diverging-from main
68
+ ```
69
+
70
+ ### Path Highlighting
71
+ See the exact sequence of commits between a feature branch and a specific tag:
72
+ ```bash
73
+ uv run git-graphable . --highlight-path develop..v1.0.0
74
+ ```
75
+
76
+ ### Large Repositories
77
+ For repositories with long histories, use the `--limit` flag to keep the graph readable and avoid engine rendering limits:
78
+ ```bash
79
+ uv run git-graphable . --limit 100 --highlight-authors
80
+ ```
81
+
82
+ ## Development
83
+
84
+ Run tests and linting:
85
+ ```bash
86
+ just check
87
+ ```
88
+
89
+ ### CI/CD
90
+ This project uses GitHub Actions for continuous integration and automated publishing:
91
+ - **CI**: Runs `just check` on all pushes and PRs to `main`.
92
+ - **Publish**: Automatically builds and publishes to PyPI when a version tag (`v*`) is pushed.
@@ -0,0 +1,35 @@
1
+ # `git-graphable`
2
+
3
+ Git graph to Mermaid/Graphviz/D2/PlantUML converter.
4
+
5
+ **Usage**:
6
+
7
+ ```console
8
+ $ git-graphable [OPTIONS] PATH
9
+ ```
10
+
11
+ **Arguments**:
12
+
13
+ * `PATH`: Path to local directory or git URL [required]
14
+
15
+ **Options**:
16
+
17
+ * `--date-format TEXT`: Date format for commit labels [default: %Y%m%d%H%M%S]
18
+ * `--engine [mermaid|graphviz|d2|plantuml]`: Visualization engine [default: mermaid]
19
+ * `-o, --output TEXT`: Output file path
20
+ * `--image`: Export as image even when output path is provided
21
+ * `--simplify`: Pass --simplify-by-decoration to git log
22
+ * `--limit INTEGER`: Limit the number of commits to process
23
+ * `--highlight-critical TEXT`: Branch names to highlight as critical
24
+ * `--highlight-authors`: Assign colors to different authors
25
+ * `--highlight-distance-from TEXT`: Base branch/hash for distance highlighting
26
+ * `--highlight-path TEXT`: Highlight path between two SHAs (START..END)
27
+ * `--highlight-diverging-from TEXT`: Base branch/hash for divergence/behind analysis
28
+ * `--highlight-orphans`: Highlight dangling/orphan commits
29
+ * `--highlight-stale INTEGER`: Threshold in days to highlight stale branch tips
30
+ * `--highlight-long-running INTEGER`: Threshold in days to highlight long-running branches
31
+ * `--long-running-base TEXT`: Base branch for long-running analysis [default: main]
32
+ * `--bare`: Force bare mode (no rich output)
33
+ * `--install-completion`: Install completion for the current shell.
34
+ * `--show-completion`: Show completion for the current shell, to copy it or customize the installation.
35
+ * `--help`: Show this message and exit.
@@ -0,0 +1,71 @@
1
+ [project]
2
+ authors = [
3
+ { name = "Richard West", email = "dopplereffect.us@gmail.com" },
4
+ ]
5
+ dependencies = [
6
+ "graphable>=0.6.0",
7
+ ]
8
+ description = "A powerful tool to convert Git commit history into beautiful flowcharts."
9
+ keywords = [
10
+ "analysis",
11
+ "d2",
12
+ "git",
13
+ "graph",
14
+ "hygiene",
15
+ "mermaid",
16
+ "topology",
17
+ "visualization",
18
+ ]
19
+ name = "git-graphable"
20
+ readme = "README.md"
21
+ requires-python = ">=3.13"
22
+ version = "0.1.0"
23
+
24
+ [project.optional-dependencies]
25
+ cli = [
26
+ "rich>=13.0.0",
27
+ "typer>=0.12.0",
28
+ ]
29
+
30
+ [project.scripts]
31
+ git-graphable = "git_graphable.cli:main"
32
+
33
+ [project.urls]
34
+ Homepage = "https://github.com/TheTrueSCU/git-graphable"
35
+ Issues = "https://github.com/TheTrueSCU/git-graphable/issues"
36
+ Repository = "https://github.com/TheTrueSCU/git-graphable"
37
+
38
+ [build-system]
39
+ build-backend = "hatchling.build"
40
+ requires = ["hatchling"]
41
+
42
+ [dependency-groups]
43
+ dev = [
44
+ "pytest-cov>=7.0.0",
45
+ "pytest-gitignore>=1.3",
46
+ "pytest-html-plus>=0.5.0",
47
+ "pytest-isort>=4.0.0",
48
+ "pytest-randomly>=4.0.1",
49
+ "pytest-timeout>=2.4.0",
50
+ "pytest-xdist>=3.8.0",
51
+ "pytest>=9.0.2",
52
+ "ruff>=0.15.4",
53
+ "ty>=0.0.20",
54
+ "typer-cli>=0.24.0",
55
+ ]
56
+
57
+ [tool.hatch.build.targets.wheel]
58
+ packages = ["src/git_graphable"]
59
+
60
+ [tool.uv]
61
+ package = true
62
+
63
+ [tool.coverage.run]
64
+ omit = [
65
+ "src/git_graphable/cli.py",
66
+ ]
67
+
68
+ [tool.coverage.report]
69
+ fail_under = 75
70
+ show_missing = true
71
+ skip_covered = true
@@ -0,0 +1,19 @@
1
+ from .core import (
2
+ CommitMetadata,
3
+ GitCommit,
4
+ GitLogConfig,
5
+ generate_summary,
6
+ process_repo,
7
+ )
8
+ from .parser import get_git_log
9
+ from .styler import export_graph
10
+
11
+ __all__ = [
12
+ "CommitMetadata",
13
+ "GitCommit",
14
+ "GitLogConfig",
15
+ "generate_summary",
16
+ "get_git_log",
17
+ "export_graph",
18
+ "process_repo",
19
+ ]