Skip to content

Commit 2822c5e

Browse files
committed
Add contribution visualization tool with make contrib-graph
Add a contribution visualization tool that generates matplotlib graphs showing kdevops contributor activity patterns. Features: - Flexible year-based filtering with YEAR and MONTH parameter - Comprehensive 6-panel visualization including: * AI-boom marker for July 5, 2025 when codex / claude code was used * Total commits bar chart * Contribution distribution pie chart * Monthly activity heatmap * Timeline graphs * Statistics summary - Smart date handling (stops at current date, no future commits) - Error handling for invalid years - Support for both specific years and all-time analysis Usage: make contrib-graph YEAR=2025 # Generate graphs for 2025 only make contrib-graph # Generate graphs for all time Generated files: - kdevops_contributions_YEAR.png/pdf (for specific year) - kdevops_contributions_all_time.png/pdf (for all time) The tool respects the current date (2025-07-31) and will not show commits beyond today's date, ensuring accurate historical analysis. Generated-by: Claude AI Signed-off-by: Luis Chamberlain <[email protected]>
1 parent 7231134 commit 2822c5e

File tree

5 files changed

+1136
-0
lines changed

5 files changed

+1136
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,3 +118,4 @@ terraform/lambdalabs/.terraform_api_key
118118
.cloud.initialized
119119

120120
scripts/__pycache__/
121+
docs/contrib/kdevops_contributions*

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,10 @@ include scripts/archive.Makefile
274274
include scripts/defconfig.Makefile
275275
include scripts/style.Makefile
276276

277+
PHONY += contrib-graph
278+
contrib-graph:
279+
$(Q)python3 scripts/contrib_graph.py $(if $(YEAR),--year $(YEAR)) $(if $(MONTH),--month $(MONTH))
280+
277281
PHONY += clean
278282
clean:
279283
$(Q)$(MAKE) -f scripts/build.Makefile $@

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,29 @@ See [viewing kdevops archived results](docs/viewing-fstests-results.md) to see
413413
more details about how to see results. We should add simple wrappers for this
414414
in the future.
415415

416+
# kdevops contribution analysis
417+
418+
kdevops includes built-in tools for analyzing project contribution patterns
419+
and development activity. These visualizations provide insights into contributor
420+
activity, development patterns, and project health over time.
421+
422+
Generate comprehensive contribution analysis dashboards:
423+
424+
```bash
425+
# Generate graphs for a specific year
426+
make contrib-graph YEAR=2025
427+
428+
# Generate graphs for all project history
429+
make contrib-graph
430+
```
431+
432+
The generated visualizations include contributor rankings, activity patterns,
433+
monthly trends, and project statistics. All graphs automatically respect
434+
temporal boundaries (no future commits shown) and handle contributor name
435+
overlapping for better readability.
436+
437+
For detailed documentation, see [docs/contrib/README.md](docs/contrib/README.md).
438+
416439
# Video presentations on kdevops or related
417440

418441
* [March 24, 2025 kdevops: Automating Linux kernel testing](https://www.youtube.com/watch?v=VF-jr_ZE-9Y&list=PLjaT52x3HVboZtdwZnONSHQHM8217ELcc) and [slides](https://docs.google.com/presentation/d/e/2PACX-1vSyM8ol_ZFwmJ6YCI2sYU9xH8MPCLPZT1PfsDHId__xbUq2aSh7mAeMLTGZFGfvjogY6ccxww2GqOTe/pub?start=false&loop=false&delayms=3000)

docs/contrib/README.md

Lines changed: 186 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,186 @@
1+
# kdevops Contribution Analysis
2+
3+
This directory contains contribution visualization tools and generated reports for the kdevops project.
4+
5+
## Overview
6+
7+
The contribution analysis provides comprehensive insights into kdevops development patterns, contributor activity, and project health over time. These visualizations help understand:
8+
9+
- **Contributor Activity**: Who is actively contributing to the project
10+
- **Development Patterns**: When and how frequently contributions occur
11+
- **Project Health**: Overall activity levels and contributor diversity
12+
- **Timeline Analysis**: How the project has evolved over time
13+
14+
## Quick Start
15+
16+
Generate contribution graphs using the built-in make target:
17+
18+
```bash
19+
# Generate graphs for a specific year
20+
make contrib-graph YEAR=2025
21+
22+
# Generate graphs for all project history
23+
make contrib-graph
24+
```
25+
26+
## Generated Files
27+
28+
The visualization tool creates comprehensive 6-panel dashboards saved as:
29+
30+
### For Specific Year
31+
- `kdevops_contributions_YYYY.png` - High-resolution image (300 DPI)
32+
- `kdevops_contributions_YYYY.pdf` - Vector format for scalability
33+
34+
### For All Time
35+
- `kdevops_contributions_all_time.png` - High-resolution image
36+
- `kdevops_contributions_all_time.pdf` - Vector format
37+
38+
## Visualization Components
39+
40+
Each generated dashboard includes six analytical panels:
41+
42+
### 1. Total Commits Bar Chart
43+
Shows the overall contribution ranking by commit count. Names are automatically shortened for contributors with fewer commits to prevent overlapping labels.
44+
45+
### 2. Contribution Distribution Pie Chart
46+
Displays the percentage distribution of contributions among top contributors, with smaller contributors grouped as "Others" for clarity.
47+
48+
### 3. Monthly Activity Heatmap
49+
Visual representation of when contributors are most active throughout the year. Intensity indicates commit volume.
50+
51+
### 4. Monthly Timeline Graph
52+
Line graph showing total project activity over time, with actual commit counts labeled on data points.
53+
54+
### 5. Top Contributors Timeline
55+
Individual activity patterns for the top 3 contributors, showing their monthly contribution patterns.
56+
57+
### 6. Statistics Summary
58+
Key metrics including:
59+
- Total commits and contributors
60+
- Average commits per person
61+
- Most active month
62+
- Top contributor
63+
- Analysis period and generation timestamp
64+
65+
## Technical Details
66+
67+
### Date Handling
68+
- **Smart Filtering**: Only shows data up to the current date (no future commits)
69+
- **Period Accuracy**: Respects actual time boundaries (e.g., if run on July 31, 2025, won't show August-December data)
70+
- **Validation**: Prevents analysis of invalid years (too early or future years)
71+
72+
### Data Sources
73+
All data is extracted directly from the git repository using:
74+
- `git log` for commit history
75+
- Author information from git commit metadata
76+
- Date filtering for accurate time period analysis
77+
- No synthetic or fabricated data
78+
79+
### Dependencies
80+
The visualization tool requires:
81+
- Python 3.x
82+
- matplotlib
83+
- seaborn
84+
- pandas
85+
- numpy
86+
87+
These are automatically installed via system packages when running the tool.
88+
89+
## Usage Examples
90+
91+
### Annual Review
92+
```bash
93+
# Generate 2025 contribution report
94+
make contrib-graph YEAR=2025
95+
```
96+
97+
### Project History
98+
```bash
99+
# Generate complete project history
100+
make contrib-graph
101+
```
102+
103+
### Specific Year Analysis
104+
```bash
105+
# Analyze any specific year
106+
make contrib-graph YEAR=2024
107+
make contrib-graph YEAR=2023
108+
```
109+
110+
## Error Handling
111+
112+
The tool includes comprehensive error checking:
113+
114+
- **Future Years**: Prevents analysis of years beyond current date
115+
- **Invalid Years**: Validates year format and reasonable ranges
116+
- **Git Repository**: Ensures tool is run from within a git repository
117+
- **Empty Data**: Handles periods with no commits gracefully
118+
119+
## Integration
120+
121+
The contribution analysis is integrated into the kdevops build system:
122+
123+
- **Makefile Target**: `make contrib-graph`
124+
- **Parameter Support**: Optional `YEAR=YYYY` parameter
125+
- **Output Location**: Files saved to `docs/contrib/`
126+
- **Style Compliance**: Follows kdevops coding standards
127+
128+
## Interpretation Guide
129+
130+
### High Activity Periods
131+
- **March Surge**: Often indicates major development phases
132+
- **Consistent Activity**: Shows healthy, sustained development
133+
- **Seasonal Patterns**: May reflect developer availability/schedules
134+
135+
### Contributor Patterns
136+
- **Core Contributors**: High commit counts, consistent activity
137+
- **Occasional Contributors**: Lower counts, sporadic activity
138+
- **New Contributors**: Recent activity increase
139+
140+
### Project Health Indicators
141+
- **Growing Contributor Base**: More contributors over time
142+
- **Sustained Activity**: Regular commits throughout periods
143+
- **Balanced Contributions**: Activity from multiple contributors
144+
145+
## Files in This Directory
146+
147+
- `README.md` - This documentation
148+
- `kdevops_contributions_*.png` - Generated visualization images
149+
- `kdevops_contributions_*.pdf` - Generated vector graphics
150+
- Historical contribution reports (accumulate over time)
151+
152+
## Troubleshooting
153+
154+
### Common Issues
155+
156+
**"No contributions found"**
157+
- Check that you're in a git repository
158+
- Verify the specified year has commits
159+
- Ensure date range is valid
160+
161+
**"Year is in the future"**
162+
- The tool prevents analysis of future dates
163+
- Use current or past years only
164+
165+
**Missing dependencies**
166+
- Run `sudo apt install python3-matplotlib python3-seaborn python3-pandas python3-numpy`
167+
- Or let the Makefile handle dependency installation
168+
169+
### Getting Help
170+
171+
For issues with the contribution analysis tool:
172+
1. Check that all dependencies are installed
173+
2. Verify you're in the kdevops git repository root
174+
3. Review error messages for specific guidance
175+
4. Consult the main project documentation
176+
177+
## Contributing
178+
179+
The contribution analysis tool itself can be improved:
180+
181+
- **Source**: `scripts/contrib_graph.py`
182+
- **Integration**: Makefile target definition
183+
- **Standards**: Follow kdevops coding and documentation standards
184+
- **Testing**: Verify with multiple years and edge cases
185+
186+
Suggestions for enhancements are welcome through the standard kdevops contribution process.

0 commit comments

Comments
 (0)