Created
March 1, 2026 01:38
-
-
Save mono0926/5388a58e85cd917f644deeb8bad35bad to your computer and use it in GitHub Desktop.
Flutterフレームワークコミット頻度分析
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import subprocess | |
| import pandas as pd | |
| import matplotlib.pyplot as plt | |
| # 1. Gitのコミット履歴を抽出 | |
| print("Extracting commit logs...") | |
| result = subprocess.run(['git', 'log', '--date=short', '--format=%ad'], capture_output=True, text=True, check=True) | |
| commits = result.stdout.strip().split('\n') | |
| # 2. データフレームの作成と集計 | |
| df = pd.DataFrame(commits, columns=['date']) | |
| df['date'] = pd.to_datetime(df['date']) | |
| df.set_index('date', inplace=True) | |
| # 月ごとのコミット数を集計 (MEを使用) | |
| monthly_commits = df.resample('ME').size() | |
| # 6ヶ月の移動平均を計算(トレンドの可視化) | |
| rolling_mean = monthly_commits.rolling(window=6, center=True).mean() | |
| # 3. グラフの描画 | |
| fig, ax = plt.subplots(figsize=(16, 8)) | |
| # 生データは薄く表示し、移動平均線を強調 | |
| ax.plot(monthly_commits.index, monthly_commits.values, color='#0468d7', alpha=0.3, label='Monthly Commits (Raw)') | |
| ax.plot(rolling_mean.index, rolling_mean.values, color='#0468d7', linewidth=3, label='6-Month Rolling Average (Trend)') | |
| ax.set_title('Flutter Repository Commit Velocity (Full History) & Milestones', fontsize=18, fontweight='bold') | |
| ax.set_xlabel('Year', fontsize=12) | |
| ax.set_ylabel('Number of Commits', fontsize=12) | |
| # Flutterの歴史とAIトレンドのイベント定義 | |
| events = { | |
| '2018-12-04': ('Flutter 1.0', 'blue'), | |
| '2021-03-03': ('Flutter 2.0', 'blue'), | |
| '2021-06-29': ('GitHub Copilot', 'red'), | |
| '2022-05-11': ('Flutter 3.0', 'blue'), | |
| '2022-11-30': ('ChatGPT', 'green'), | |
| '2023-03-14': ('GPT-4', 'purple'), | |
| '2024-06-20': ('Claude 3.5 Sonnet', 'orange'), | |
| '2025-01-01': ('AI Agents Era', 'brown') | |
| } | |
| for date_str, (label, color) in events.items(): | |
| date = pd.to_datetime(date_str) | |
| ax.axvline(date, color=color, linestyle='--', alpha=0.8) | |
| # テキストラベルを見やすく配置(Y軸の上部に配置) | |
| ax.text(date, ax.get_ylim()[1] * 0.95, f' {label}', color=color, rotation=90, va='top', ha='right', fontsize=11, fontweight='bold') | |
| # 凡例の位置を左上に移動(全期間表示で右側にデータが寄るため) | |
| ax.legend(fontsize=12, loc='upper left') | |
| ax.grid(True, alpha=0.3) | |
| fig.tight_layout() | |
| # 画像として保存 | |
| plt.savefig('flutter_velocity_full_history.png', dpi=300) | |
| print("Saved full history plot to flutter_velocity_full_history.png 🚀") | |
| plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment