GitHub Contribution Graph in your terminal โ for hackers who prefer Unicode over UI
Project description
๐ต๏ธโโ๏ธ GitHub Stats Heatmap
Your GitHub activity, visualized โ hacker style.
Features โข Quick Start โข Installation โข Live Refresh โข Plugins โข Roadmap โข Contributing โข Changelog
โก TL;DR
- What: Terminal-based GitHub contribution heatmap viewer
- Why: Instantly visualize your GitHub activity in your terminal, hacker style
- How:
pipx install gh-stats-heatmap gh-stats-heatmap
- Features: Live refresh, plugin system, global leaderboards, themes, analytics, compare mode, and more!
- Platforms: macOS, Linux, Windows
๐ What's New
๐ผ๏ธ UI & Legend Improvements (v1.0.2)
- Legend is now a high-contrast Rich panel: Instantly see what each block means, with clear colors and a plain-language explanation.
- Improved accessibility and readability for all terminal themes.
๐ Package Successfully Published! (v1.0.1)
The GitHub Stats Heatmap tool is now available on PyPI with easy installation methods!
Installation Options:
- ๐ pipx (Recommended):
pipx install gh-stats-heatmap - ๐ PyPI:
pip install gh-stats-heatmap - ๐บ Homebrew:
brew tap gizmet/tap && brew install gizmet/tap/ghstats
โก Live Refresh Mode
Experience real-time GitHub stats with auto-updating displays! Perfect for demos, monitoring, and live presentations.
New Features:
- ๐ Real-time Updates: Auto-refresh every 30+ seconds
- ๐ก๏ธ Rate Limit Protection: Smart handling of GitHub API limits
- ๐ญ Demo Mode: Seamless fallback to realistic sample data
- ๐ Status Indicators: Clear visual feedback (LIVE/RATE LIMITED/DEMO)
- ๐พ Data Caching: Maintains display even when API is unavailable
# Try it now!
ghstats yourusername --live
See the Live Refresh Mode section for complete details.
โจ Features
| Category | Features |
|---|---|
| ๐ฏ Core | Zero-config heatmaps โข Rich terminal output โข Cross-platform |
| ๐จ Themes | GitHub, dark, light, matrix, cyberpunk, monochrome โข Custom JSON themes |
| ๐ผ๏ธ UI | High-contrast, panel-based legend for easy interpretation |
| ๐ Analytics | Streaks, trends, busiest month, activity patterns โข Multiple sparklines โข Advanced analytics โข Smart insights |
| ๐ Compare | Side-by-side user comparison โข Per-user themes โข Diff highlighting โข Overlap analysis |
| ๐ Leaderboards | Repository/organization contributors โข Global top contributors |
| ๐ Plugins | Extensible plugin system โข Global leaderboard plugin |
| ๐ฎ TUI | Interactive terminal UI โข Multiple views โข Cell selection โข Theme switching |
| โก Live | Real-time refresh mode โข Auto-updating displays โข Rate limit protection โข Demo mode โข Smart caching |
Tip: The heatmap legend is now always clear and easy to read, with high-contrast colors and a plain-language explanationโperfect for all terminal backgrounds and accessibility needs.
๐ Quick Start
# Install with pipx (easiest)
pipx install gh-stats-heatmap
# Or install from PyPI
pip install gh-stats-heatmap
# Instant visualization
ghstats yourusername
# Compare two developers
ghstats user1 --compare user2
# With global context
ghstats username --global-leaderboard --token YOUR_TOKEN
# Live refresh for demos
ghstats username --live
# Live refresh with custom interval
ghstats username --live --refresh-interval 60
๐ฆ Installation
๐ pipx Install (Recommended for CLI tools)
# Install pipx if you don't have it
pip install pipx
pipx ensurepath
# Install ghstats
pipx install gh-stats-heatmap
๐ PyPI Install
pip install gh-stats-heatmap
๐บ Homebrew Install (macOS/Linux)
# Add the tap
brew tap gizmet/tap
# Install ghstats
brew install gizmet/tap/ghstats
You can also view and contribute to the Homebrew formula at: https://github.com/Gizmet/homebrew-tap
๐ง From Source
git clone https://github.com/Gizmet/github-contribution-heatmap-viewer
cd github-contribution-heatmap-viewer
pip install -e .
๐ฏ Usage Examples
| Command | Result |
|---|---|
ghstats torvalds |
View Linus's contributions |
ghstats gizmet --theme matrix |
Cyberpunk-style heatmap |
ghstats user1 --compare user2 |
Side-by-side comparison |
ghstats user1 --compare user2 --theme dark --theme2 matrix |
Enhanced comparison with different themes |
ghstats --plugin global-leaderboard |
Top GitHub contributors |
ghstats username --tui |
Interactive TUI mode |
ghstats username --live |
Real-time updates |
ghstats username --live --refresh-interval 30 |
Custom refresh interval |
ghstats username --watch |
Watch mode (alias for --live) |
๐ Plugin System
Available Plugins
ghstats --list-plugins
๐ Global Leaderboard Plugin
Shows top GitHub contributors worldwide using GraphQL API:
# Standalone plugin
ghstats --plugin global-leaderboard --token YOUR_TOKEN
# Integrated with heatmap
ghstats username --global-leaderboard --token YOUR_TOKEN
Features:
- ๐ Resilient - Retry logic, fallback data, network error handling
- ๐ Rich Data - Contributions, followers, rankings
- ๐จ Beautiful Output - Formatted tables with proper alignment
- โก Fast - Optimized GraphQL queries with pagination
๐ฎ Interactive TUI Mode
Experience your GitHub stats with an interactive terminal interface:
# Launch TUI mode
ghstats username --tui
# TUI with custom theme
ghstats username --tui --theme matrix
# TUI with API token
ghstats username --tui --token YOUR_TOKEN
Features:
- ๐ Multiple Views: Heatmap, stats, compare, and settings views
- ๐ฏ Interactive Navigation: Switch views and explore data
- ๐จ Theme Switching: Change themes on the fly
- ๐ Detailed Analytics: Comprehensive statistics tables
- ๐ Data Refresh: Reload data without restarting
Navigation:
h= Heatmap views= Stats viewv= Compare viewo= Settings viewt= Change themer= Refresh dataq= Quit
See TUI.md for complete documentation.
๐จ Themes
Built-in Themes
github- GitHub's official colorsdark- Dark terminal aestheticlight- Light terminal friendlymatrix- Green terminal matrix vibecyberpunk- Neon magenta/yellow/cyanmonochrome- Clean black and white
Custom Themes
Create your own with JSON:
{
"name": "My Theme",
"colors": ["#ebedf0", "#9be9a8", "#40c463", "#30a14e", "#216e39"]
}
๐ Sample Output
โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ ๐ต๏ธโโ๏ธ GitHub Stats Heatmap โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ โ
โ GitHub Contributions: torvalds (Past 52 Weeks) โ
โ โ
โ M โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ T โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ W โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ T โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ F โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ S โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ S โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ
โ Weekly Activity: โโโโโโโโโโ
โโโโโโโโโโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโ โ
โ Monthly Trend: โโโโโโ โ
โ Consistency: โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ Trend: ๐ Accelerating | Peak: This week (24 contributions) | Consistency: โ
Good (85%) โ
โ โ
โ Legend: โ = 0 โ = 1-3 โ = 4-6 โ = 7+ โ
โ โ
โ โก Current streak: 1 days | ๐ Total contributions: 2885 | ๐
Active days: 344/364 โ
โ (94.5%) | ๐ Longest streak: 66 days | ๐ This month: 170 | ๐ Inactive weeks: 0 | ๐
โ
โ Busiest week: 157 contributions (Week 36) | ๐ฅ Most active weekday: S | ๐ Busiest โ
โ month: May | ๐ด Least active weekday: T | ๐ Avg/week: 55.5 | ๐ Trend: Up (+241) โ
โ โ
โ ๐ฏ Consistency: 85/100 | โก Pattern: Weekday focused (Monday peak, Tuesday low) โ
โ ๐ฑ Seasonal: Strong Summer preference | ๐ Momentum: +25% | ๐
Weekend work: 15% โ
โ โฐ Peak hours: Early week focus (Monday peak) | ๐ด Burnout risk: Low (healthy pace) โ
โ ๐ฏ Improvement: High potential (few gaps) โ
โ โ
โ ๐ญ You've contributed 2885 times in the last 52 weeks. Your consistency is excellent. โ
โ You're a weekday warrior. You show a strong summer preference. You're gaining momentum. โ
โ You prefer weekday work. You have great potential for growth. You're on a 1-day streak โ
โ with increasing activity. โ
โ โ
โ ๐ Global GitHub Contributors โ
โ โโโโโโโโฌโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโ โ
โ โ Rank โ User โ Name โ Contributions โ Followers โ โ
โ โโโโโโโโผโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโผโโโโโโโโโโโโค โ
โ โ 1 โ @Charles-Chrismann โ Charles Chrismann โ 12,290 โ 16,017 โ โ
โ โ 2 โ @lllyasviel โ lllyasviel โ 9,121 โ 19,979 โ โ
โ โ 3 โ @phodal โ Fengda Huang โ 9,052 โ 20,351 โ โ
โ โ 4 โ @skydoves โ Jaewoong Eum โ 7,045 โ 12,058 โ โ
โ โ 5 โ @jeresig โ John Resig โ 6,066 โ 18,881 โ โ
โ โโโโโโโโดโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโดโโโโโโโโโโโโ โ
โ โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
๐ ๏ธ API Tokens
๐ When You Need GitHub API Tokens
Required for:
- ๐ Private repository data - Access to private repo contributions
- ๐ Repository leaderboards - Top contributors in specific repos
- ๐ข Organization leaderboards - Contributors within organizations
- ๐ Global leaderboard plugin - Worldwide top GitHub contributors
- ๐ Integrated global leaderboard - Combined heatmap + leaderboard
- ๐ Higher rate limits - 5000 requests/hour vs 60 requests/hour
Not required for:
- โ Public profile heatmaps - Basic contribution visualization
- โ Public user statistics - Streaks, trends, patterns
- โ Compare mode - Side-by-side public user comparison
- โ Theme customization - All theme features
- โ Live refresh mode - Auto-updating displays (with rate limits)
๐ Creating a GitHub API Token
- Go to GitHub Settings: https://github.com/settings/tokens
- Click "Generate new token" โ "Generate new token (classic)"
- Set token name: e.g., "ghstats-cli"
- Select scopes:
- โ
public_repo(for public repository data) - โ
read:org(for organization leaderboards) - โ
read:user(for user profile data)
- โ
- Click "Generate token"
- Copy the token (store it securely - you won't see it again!)
๐ป Using Your Token
# Set as environment variable (recommended)
export GITHUB_TOKEN=your_token_here
ghstats username
# Or pass directly via command line
ghstats username --token your_token_here
# For global leaderboard
ghstats --plugin global-leaderboard --token your_token_here
# Combined heatmap + leaderboard
ghstats username --global-leaderboard --token your_token_here
๐ Security Best Practices
- Never commit tokens to version control
- Use environment variables instead of command line arguments
- Set minimal permissions - only grant necessary scopes
- Rotate tokens regularly - regenerate every 90 days
- Use different tokens for different applications
๐ Rate Limits
| Authentication | Rate Limit | Use Case |
|---|---|---|
| None | 60 requests/hour | Basic public profiles |
| Token | 5000 requests/hour | Full features, private repos |
๐ ๏ธ Troubleshooting
"API rate limit exceeded"
# Check your rate limit status
ghstats username --token your_token_here
# Wait for reset or use demo mode
ghstats username --live # Automatically uses demo mode when rate limited
"Not found" for private repos
# Ensure token has correct scopes
ghstats username --token your_token_here
Token not working
# Verify token is valid
curl -H "Authorization: token your_token_here" https://api.github.com/user
๐ง Plugin Development
Extend functionality with custom plugins:
from plugins.base import GhStatsPlugin
class MyPlugin(GhStatsPlugin):
def name(self) -> str:
return "my-plugin"
def description(self) -> str:
return "My custom plugin"
def requires_token(self) -> bool:
return False
def execute(self, **kwargs) -> Dict[str, Any]:
# Your plugin logic here
return {"success": True, "data": "..."}
๐ Roadmap
| Status | Feature | Description |
|---|---|---|
| โ Complete | Core heatmap rendering | Beautiful terminal output with Unicode blocks |
| โ Complete | Theme system | Built-in + custom JSON themes |
| โ Complete | Statistics engine | Streaks, trends, patterns, analytics |
| โ Complete | Compare mode | Side-by-side user comparison |
| โ Complete | Plugin architecture | Extensible plugin system |
| โ Complete | Global leaderboard | Top GitHub contributors worldwide |
| โ Complete | Live refresh | Real-time updates |
| ๐ In Progress | Export features | PNG, HTML, JSON export |
| ๐ In Progress | TUI mode | Interactive terminal UI |
| ๐ Planned | Team analytics | Organization insights |
| ๐ Planned | Historical trends | Year-over-year comparisons |
| ๐ Planned | Custom metrics | User-defined contribution types |
๐๏ธ Project Structure
github-contribution-heatmap-viewer/
โโโ ghstats.py # CLI entry point
โโโ github_api.py # GitHub API integration
โโโ heatmap.py # Grid generation logic
โโโ render.py # Rich terminal rendering
โโโ utils.py # Utility functions
โโโ plugins/ # Plugin system
โ โโโ __init__.py # Plugin manager
โ โโโ base.py # Base plugin class
โ โโโ global_leaderboard.py # Global leaderboard plugin
โโโ tests/ # Test suite
โโโ themes/ # Theme definitions
โโโ README.md # This file
๐งช Development
# Install in development mode
pip install -e .
# Run tests
pytest
# Run with coverage
pytest --cov=.
# Format code
black .
# Lint code
flake8 .
๐ค Contributing
We welcome contributions! Here's how:
- ๐ด Fork the repository
- ๐ฑ Create a feature branch:
git checkout -b feature/amazing-thing - ๐ฅ Commit your changes:
git commit -m 'Add amazing thing' - ๐ Push to the branch:
git push origin feature/amazing-thing - ๐ฌ Open a Pull Request
Guidelines:
- Follow PEP 8 style guidelines
- Add tests for new functionality
- Update documentation for new features
- Write clear commit messages
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Acknowledgments
- Rich - Beautiful terminal rendering
- GitHub API - Data source
- Unicode - For the glorious โโโโ blocks
- committers.top - Inspiration for global leaderboards
Made with โค๏ธ for developers who live in the terminal
โญ Star this repo if you find it useful! โญ
โก Live Refresh Mode
Experience real-time GitHub stats with auto-updating displays perfect for demos, monitoring, and live presentations:
# Basic live refresh (30s minimum interval)
ghstats username --live
# Custom refresh interval
ghstats username --live --refresh-interval 60
# Watch mode (alias for --live)
ghstats username --watch
# Live refresh with compare mode
ghstats username --compare user2 --live
# Live refresh with custom theme
ghstats username --live --theme matrix
๐ฏ Live Refresh Features
- ๐ Auto-Updating: Real-time data refresh with customizable intervals
- ๐ก๏ธ Rate Limit Protection: Automatic detection and graceful handling of GitHub API rate limits
- ๐ญ Demo Mode: Seamless fallback to realistic sample data when rate limited
- ๐ Status Indicators: Clear visual feedback (LIVE/RATE LIMITED/DEMO)
- ๐พ Data Caching: Uses cached data when API calls fail
- โฐ Smart Intervals: Minimum 30-second intervals to prevent rate limiting
- ๐จ Theme Support: Full theme compatibility in live mode
- ๐ Compare Mode: Side-by-side live comparison of multiple users
๐ญ Demo Mode
When rate limited, the live refresh automatically switches to demo mode:
- Realistic Data: Generates authentic-looking contribution patterns
- Weekday Patterns: Higher activity on weekdays, lower on weekends
- Random Variation: Natural-looking contribution counts and patterns
- Seamless Transition: No interruption to the live display
๐ Status Display
Live refresh provides comprehensive status information:
Last update: 14:30:25 | Updates: 15 | Status: LIVE | Next refresh in 60s
Rate limit: 4850/5000 requests remaining | Reset at 15:00:00
Status Types:
[green]LIVE[/green]- Real-time data from GitHub API[yellow]RATE LIMITED[/yellow]- Using cached data due to rate limits[yellow]DEMO[/yellow]- Using sample data in demo mode
๐ก๏ธ Error Handling
- Retry Logic: Automatic retry with exponential backoff
- Graceful Degradation: Falls back to cached data when API fails
- Rate Limit Awareness: Detects and handles GitHub API rate limits
- User Feedback: Clear error messages and status updates
๐ For detailed documentation, see LIVE_REFRESH.md
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gh_stats_heatmap-1.0.2.tar.gz.
File metadata
- Download URL: gh_stats_heatmap-1.0.2.tar.gz
- Upload date:
- Size: 1.9 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3bc2e262128eba2068570152d9eeec9dec0e9e3ab8d05f55eddaede66f3db3ee
|
|
| MD5 |
1ff13a8514d18dbd88e41dff2d7dd6e1
|
|
| BLAKE2b-256 |
fa6d2137692594ba41e9856514639b965fbb8b5b29f5dead00612aa7dbf7d88f
|
File details
Details for the file gh_stats_heatmap-1.0.2-py3-none-any.whl.
File metadata
- Download URL: gh_stats_heatmap-1.0.2-py3-none-any.whl
- Upload date:
- Size: 36.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c37bbca91e28e0afa1831e8837fc85b15a6e6a45c591db49c3549bedf56ab8a6
|
|
| MD5 |
ab408c17b8fda463969fb39d7bf3a07c
|
|
| BLAKE2b-256 |
10d86a87286af639ee0d92a27f5bf443614b97a67363a87f762f7f89d170c63e
|