code-maat-python 0.1.0__tar.gz → 0.1.1__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.
- code_maat_python-0.1.1/PKG-INFO +134 -0
- code_maat_python-0.1.1/README.md +106 -0
- {code_maat_python-0.1.0 → code_maat_python-0.1.1}/code_maat_python/__init__.py +1 -1
- {code_maat_python-0.1.0 → code_maat_python-0.1.1}/pyproject.toml +1 -1
- code_maat_python-0.1.0/PKG-INFO +0 -545
- code_maat_python-0.1.0/README.md +0 -517
- {code_maat_python-0.1.0 → code_maat_python-0.1.1}/LICENSE +0 -0
- {code_maat_python-0.1.0 → code_maat_python-0.1.1}/code_maat_python/__main__.py +0 -0
- {code_maat_python-0.1.0 → code_maat_python-0.1.1}/code_maat_python/analyses/__init__.py +0 -0
- {code_maat_python-0.1.0 → code_maat_python-0.1.1}/code_maat_python/analyses/age.py +0 -0
- {code_maat_python-0.1.0 → code_maat_python-0.1.1}/code_maat_python/analyses/authors.py +0 -0
- {code_maat_python-0.1.0 → code_maat_python-0.1.1}/code_maat_python/analyses/churn.py +0 -0
- {code_maat_python-0.1.0 → code_maat_python-0.1.1}/code_maat_python/analyses/communication.py +0 -0
- {code_maat_python-0.1.0 → code_maat_python-0.1.1}/code_maat_python/analyses/coupling.py +0 -0
- {code_maat_python-0.1.0 → code_maat_python-0.1.1}/code_maat_python/analyses/effort.py +0 -0
- {code_maat_python-0.1.0 → code_maat_python-0.1.1}/code_maat_python/analyses/entities.py +0 -0
- {code_maat_python-0.1.0 → code_maat_python-0.1.1}/code_maat_python/analyses/revisions.py +0 -0
- {code_maat_python-0.1.0 → code_maat_python-0.1.1}/code_maat_python/analyses/soc.py +0 -0
- {code_maat_python-0.1.0 → code_maat_python-0.1.1}/code_maat_python/analyses/summary.py +0 -0
- {code_maat_python-0.1.0 → code_maat_python-0.1.1}/code_maat_python/cli.py +0 -0
- {code_maat_python-0.1.0 → code_maat_python-0.1.1}/code_maat_python/output/__init__.py +0 -0
- {code_maat_python-0.1.0 → code_maat_python-0.1.1}/code_maat_python/parser.py +0 -0
- {code_maat_python-0.1.0 → code_maat_python-0.1.1}/code_maat_python/pipeline.py +0 -0
- {code_maat_python-0.1.0 → code_maat_python-0.1.1}/code_maat_python/transformers/__init__.py +0 -0
- {code_maat_python-0.1.0 → code_maat_python-0.1.1}/code_maat_python/transformers/grouper.py +0 -0
- {code_maat_python-0.1.0 → code_maat_python-0.1.1}/code_maat_python/transformers/team_mapper.py +0 -0
- {code_maat_python-0.1.0 → code_maat_python-0.1.1}/code_maat_python/transformers/time_grouper.py +0 -0
- {code_maat_python-0.1.0 → code_maat_python-0.1.1}/code_maat_python/utils/__init__.py +0 -0
- {code_maat_python-0.1.0 → code_maat_python-0.1.1}/code_maat_python/utils/math.py +0 -0
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: code-maat-python
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: Modern Python tool for mining and analyzing version control system data
|
|
5
|
+
License: GPL-3.0
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Keywords: vcs,git,analysis,mining,coupling,churn
|
|
8
|
+
Author: Cameron Yick
|
|
9
|
+
Author-email: cameron.yick@gmail.com
|
|
10
|
+
Requires-Python: >=3.10,<4.0
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
20
|
+
Classifier: Topic :: Software Development :: Version Control
|
|
21
|
+
Requires-Dist: click (>=8.1.0,<9.0.0)
|
|
22
|
+
Requires-Dist: pandas (>=2.0.0,<3.0.0)
|
|
23
|
+
Requires-Dist: python-dateutil (>=2.8.0,<3.0.0)
|
|
24
|
+
Project-URL: Homepage, https://github.com/hydrosquall/code-maat-python
|
|
25
|
+
Project-URL: Repository, https://github.com/hydrosquall/code-maat-python
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
|
|
28
|
+
# code-maat-python
|
|
29
|
+
|
|
30
|
+
[](https://opensource.org/licenses/GPL-3.0)
|
|
31
|
+
[](https://www.python.org/downloads/)
|
|
32
|
+
|
|
33
|
+
A Python implementation of [Code Maat](https://github.com/adamtornhill/code-maat) by Adam Tornhill. Analyzes Git repository history to identify code coupling, change patterns, and team dynamics.
|
|
34
|
+
|
|
35
|
+
## Overview
|
|
36
|
+
|
|
37
|
+
code-maat-python extracts insights from version control history:
|
|
38
|
+
|
|
39
|
+
- Temporal coupling: Files that change together frequently
|
|
40
|
+
- Code churn: Change frequency and stability metrics
|
|
41
|
+
- Knowledge distribution: Contributor patterns and code ownership
|
|
42
|
+
- Team coordination: Communication needs inferred from code changes
|
|
43
|
+
|
|
44
|
+
These analyses help identify architectural dependencies not visible in static code structure, inform code review priorities, and understand how teams interact with code over time.
|
|
45
|
+
|
|
46
|
+
## Why Use This Tool?
|
|
47
|
+
|
|
48
|
+
Version control history contains information about code dependencies that aren't captured by static analysis. Files that frequently change together often share hidden coupling through business logic, data structures, or implicit contracts, even when they don't import each other directly.
|
|
49
|
+
|
|
50
|
+
Research shows that files with high temporal coupling have 2-10x higher defect rates ([Predicting Faults from Cached History, MSR 2008](https://dl.acm.org/doi/10.1145/1453101.1453106)). Understanding these patterns helps with:
|
|
51
|
+
|
|
52
|
+
- Prioritizing code review effort on coupled changes
|
|
53
|
+
- Identifying coordination requirements between team members
|
|
54
|
+
- Finding knowledge silos and ownership concentration
|
|
55
|
+
- Discovering stable versus volatile areas of the codebase
|
|
56
|
+
|
|
57
|
+
## Installation
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
# Using pip
|
|
61
|
+
pip install code-maat-python
|
|
62
|
+
|
|
63
|
+
# From source with Poetry
|
|
64
|
+
git clone https://github.com/hydrosquall/code-maat-python.git
|
|
65
|
+
cd code-maat-python
|
|
66
|
+
poetry install
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Quick Start
|
|
70
|
+
|
|
71
|
+
Generate a Git log in the required format:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
cd your-project
|
|
75
|
+
git log --all -M -C --numstat --date=short --pretty=format:'--%h--%cd--%cn' > git.log
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Run a coupling analysis to find files that frequently change together:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
code-maat-python coupling git.log --min-coupling 50 --rows 10
|
|
82
|
+
# Or: python -m code_maat_python coupling git.log --min-coupling 50 --rows 10
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Example output:
|
|
86
|
+
```csv
|
|
87
|
+
entity,coupled,degree,average-revs
|
|
88
|
+
src/models/user.py,src/views/profile.py,87,45
|
|
89
|
+
src/api/auth.py,src/middleware/session.py,76,32
|
|
90
|
+
src/utils/validators.py,src/forms/registration.py,65,28
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
This indicates `user.py` and `profile.py` change together in 87% of commits where either file changes, based on 45 average revisions. High coupling may indicate shared responsibilities or implicit dependencies worth reviewing.
|
|
94
|
+
|
|
95
|
+
## Available Analyses
|
|
96
|
+
|
|
97
|
+
code-maat-python provides 17 analysis types:
|
|
98
|
+
|
|
99
|
+
| Command | Description | Use Case |
|
|
100
|
+
|---------|-------------|----------|
|
|
101
|
+
| `coupling` | Temporal coupling between file pairs | Identify files that frequently change together |
|
|
102
|
+
| `soc` | Sum of coupling scores per entity | Aggregate coupling metric for prioritization |
|
|
103
|
+
| `entity-churn` | Lines added/deleted per entity over time | Measure change volatility |
|
|
104
|
+
| `age` | Time since last modification | Identify stable or abandoned code |
|
|
105
|
+
| `communication` | Shared code changes between authors | Map coordination requirements |
|
|
106
|
+
| `authors` | Number of distinct authors per entity | Measure knowledge distribution |
|
|
107
|
+
| `entity-ownership` | Line contribution percentage by author | Determine primary code owners |
|
|
108
|
+
| `main-dev` | Primary contributor by lines changed | Identify domain experts |
|
|
109
|
+
| `main-dev-by-revs` | Primary contributor by commit count | Identify active maintainers |
|
|
110
|
+
| `refactoring-main-dev` | Primary contributor to refactorings | Track code quality effort |
|
|
111
|
+
| `revisions` | Commit count per entity | Find frequently modified files |
|
|
112
|
+
| `abs-churn` | Aggregate churn over time windows | Track development activity trends |
|
|
113
|
+
| `author-churn` | Per-author contribution over time | Analyze individual contribution patterns |
|
|
114
|
+
| `entity-effort` | Commit count per entity | Quantify development effort distribution |
|
|
115
|
+
| `fragmentation` | Author distribution per entity | Detect coordination overhead |
|
|
116
|
+
| `summary` | Repository-wide statistics | Overview metrics |
|
|
117
|
+
| `entities` | List of all tracked entities | Verify log parsing scope |
|
|
118
|
+
|
|
119
|
+
See [REFERENCE.md](REFERENCE.md) for detailed command documentation.
|
|
120
|
+
|
|
121
|
+
## Documentation
|
|
122
|
+
|
|
123
|
+
- [Setup Guide](docs/SETUP.md) — Git log format, shell aliases, advanced options
|
|
124
|
+
- [Use Cases & Best Practices](docs/USE_CASES.md) — Application scenarios and analysis patterns
|
|
125
|
+
- [Command Reference](REFERENCE.md) — Complete command documentation
|
|
126
|
+
- [FAQ](docs/FAQ.md) — Common questions and further reading
|
|
127
|
+
- [Contributing](CONTRIBUTING.md) — Contribution guidelines
|
|
128
|
+
|
|
129
|
+
## License
|
|
130
|
+
|
|
131
|
+
GPL-3.0 — see [LICENSE](LICENSE) for details.
|
|
132
|
+
|
|
133
|
+
This project is inspired by and compatible with [Code Maat](https://github.com/adamtornhill/code-maat) by Adam Tornhill.
|
|
134
|
+
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# code-maat-python
|
|
2
|
+
|
|
3
|
+
[](https://opensource.org/licenses/GPL-3.0)
|
|
4
|
+
[](https://www.python.org/downloads/)
|
|
5
|
+
|
|
6
|
+
A Python implementation of [Code Maat](https://github.com/adamtornhill/code-maat) by Adam Tornhill. Analyzes Git repository history to identify code coupling, change patterns, and team dynamics.
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
code-maat-python extracts insights from version control history:
|
|
11
|
+
|
|
12
|
+
- Temporal coupling: Files that change together frequently
|
|
13
|
+
- Code churn: Change frequency and stability metrics
|
|
14
|
+
- Knowledge distribution: Contributor patterns and code ownership
|
|
15
|
+
- Team coordination: Communication needs inferred from code changes
|
|
16
|
+
|
|
17
|
+
These analyses help identify architectural dependencies not visible in static code structure, inform code review priorities, and understand how teams interact with code over time.
|
|
18
|
+
|
|
19
|
+
## Why Use This Tool?
|
|
20
|
+
|
|
21
|
+
Version control history contains information about code dependencies that aren't captured by static analysis. Files that frequently change together often share hidden coupling through business logic, data structures, or implicit contracts, even when they don't import each other directly.
|
|
22
|
+
|
|
23
|
+
Research shows that files with high temporal coupling have 2-10x higher defect rates ([Predicting Faults from Cached History, MSR 2008](https://dl.acm.org/doi/10.1145/1453101.1453106)). Understanding these patterns helps with:
|
|
24
|
+
|
|
25
|
+
- Prioritizing code review effort on coupled changes
|
|
26
|
+
- Identifying coordination requirements between team members
|
|
27
|
+
- Finding knowledge silos and ownership concentration
|
|
28
|
+
- Discovering stable versus volatile areas of the codebase
|
|
29
|
+
|
|
30
|
+
## Installation
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
# Using pip
|
|
34
|
+
pip install code-maat-python
|
|
35
|
+
|
|
36
|
+
# From source with Poetry
|
|
37
|
+
git clone https://github.com/hydrosquall/code-maat-python.git
|
|
38
|
+
cd code-maat-python
|
|
39
|
+
poetry install
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Quick Start
|
|
43
|
+
|
|
44
|
+
Generate a Git log in the required format:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
cd your-project
|
|
48
|
+
git log --all -M -C --numstat --date=short --pretty=format:'--%h--%cd--%cn' > git.log
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Run a coupling analysis to find files that frequently change together:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
code-maat-python coupling git.log --min-coupling 50 --rows 10
|
|
55
|
+
# Or: python -m code_maat_python coupling git.log --min-coupling 50 --rows 10
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Example output:
|
|
59
|
+
```csv
|
|
60
|
+
entity,coupled,degree,average-revs
|
|
61
|
+
src/models/user.py,src/views/profile.py,87,45
|
|
62
|
+
src/api/auth.py,src/middleware/session.py,76,32
|
|
63
|
+
src/utils/validators.py,src/forms/registration.py,65,28
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
This indicates `user.py` and `profile.py` change together in 87% of commits where either file changes, based on 45 average revisions. High coupling may indicate shared responsibilities or implicit dependencies worth reviewing.
|
|
67
|
+
|
|
68
|
+
## Available Analyses
|
|
69
|
+
|
|
70
|
+
code-maat-python provides 17 analysis types:
|
|
71
|
+
|
|
72
|
+
| Command | Description | Use Case |
|
|
73
|
+
|---------|-------------|----------|
|
|
74
|
+
| `coupling` | Temporal coupling between file pairs | Identify files that frequently change together |
|
|
75
|
+
| `soc` | Sum of coupling scores per entity | Aggregate coupling metric for prioritization |
|
|
76
|
+
| `entity-churn` | Lines added/deleted per entity over time | Measure change volatility |
|
|
77
|
+
| `age` | Time since last modification | Identify stable or abandoned code |
|
|
78
|
+
| `communication` | Shared code changes between authors | Map coordination requirements |
|
|
79
|
+
| `authors` | Number of distinct authors per entity | Measure knowledge distribution |
|
|
80
|
+
| `entity-ownership` | Line contribution percentage by author | Determine primary code owners |
|
|
81
|
+
| `main-dev` | Primary contributor by lines changed | Identify domain experts |
|
|
82
|
+
| `main-dev-by-revs` | Primary contributor by commit count | Identify active maintainers |
|
|
83
|
+
| `refactoring-main-dev` | Primary contributor to refactorings | Track code quality effort |
|
|
84
|
+
| `revisions` | Commit count per entity | Find frequently modified files |
|
|
85
|
+
| `abs-churn` | Aggregate churn over time windows | Track development activity trends |
|
|
86
|
+
| `author-churn` | Per-author contribution over time | Analyze individual contribution patterns |
|
|
87
|
+
| `entity-effort` | Commit count per entity | Quantify development effort distribution |
|
|
88
|
+
| `fragmentation` | Author distribution per entity | Detect coordination overhead |
|
|
89
|
+
| `summary` | Repository-wide statistics | Overview metrics |
|
|
90
|
+
| `entities` | List of all tracked entities | Verify log parsing scope |
|
|
91
|
+
|
|
92
|
+
See [REFERENCE.md](REFERENCE.md) for detailed command documentation.
|
|
93
|
+
|
|
94
|
+
## Documentation
|
|
95
|
+
|
|
96
|
+
- [Setup Guide](docs/SETUP.md) — Git log format, shell aliases, advanced options
|
|
97
|
+
- [Use Cases & Best Practices](docs/USE_CASES.md) — Application scenarios and analysis patterns
|
|
98
|
+
- [Command Reference](REFERENCE.md) — Complete command documentation
|
|
99
|
+
- [FAQ](docs/FAQ.md) — Common questions and further reading
|
|
100
|
+
- [Contributing](CONTRIBUTING.md) — Contribution guidelines
|
|
101
|
+
|
|
102
|
+
## License
|
|
103
|
+
|
|
104
|
+
GPL-3.0 — see [LICENSE](LICENSE) for details.
|
|
105
|
+
|
|
106
|
+
This project is inspired by and compatible with [Code Maat](https://github.com/adamtornhill/code-maat) by Adam Tornhill.
|