可用于实时统计 GitCode OpenHarmony 组织下仓库的活跃度,生成多维度报告。支持按周/月/季度等时间维度分析,统计代码规模,智能过滤非活跃仓库,通过 GitCode API 获取数据并生成可视化 Markdown 报告。【此简介由AI生成】
Access rate limit exceeded. Please log in to continue.
OpenHarmony 活跃仓库统计工具
自动统计 GitCode OpenHarmony 组织下的仓库活跃度,生成多维度的活跃度报告。
数据源说明:本工具使用
gitcode.com/openharmony作为数据源,获取实时的仓库数据。
功能特性
- 🔍 多时间维度分析 - 按周/月/季度/半年/年度统计仓库活跃度
- 📊 代码规模统计 - 统计每个仓库的有效代码行数(排除空行和注释)
- 🎯 智能过滤 - 自动排除 third_party 仓库和长期未更新的仓库
- 📡 GitCode API - 使用 GitCode REST API 获取实时数据
- 📈 可视化报告 - 生成格式化的 Markdown 报告,包含排行榜和统计摘要
快速开始
1. 安装依赖
pip install -r requirements.txt
2. 配置 GitCode Token
在项目目录下创建 .env 文件,添加 GitCode Token:
# 从 .env.example 复制配置文件
cp .env.example .env
# 编辑 .env 文件,添加你的 GitCode Token
# GITCODE_TOKEN=your_token_here
或者通过环境变量设置:
# Linux/macOS
export GITCODE_TOKEN=your_token_here
# Windows (CMD)
set GITCODE_TOKEN=your_token_here
# Windows (PowerShell)
$env:GITCODE_TOKEN="your_token_here"
3. 运行脚本
# 基本使用
python src/main.py
# 指定配置文件
python src/main.py --config custom_config.yaml
# 强制刷新(忽略缓存)
python src/main.py --force-refresh
# 指定输出目录
python src/main.py --output-path ./custom_reports
4. 查看报告
报告将生成在 reports/activity_report.md:
cat reports/activity_report.md
项目结构
openharmony-active-repo-list/
├── README.md # 项目说明和使用指南
├── config.yaml # 配置文件(组织名、排除规则等)
├── .env.example # GitCode Token 配置示例
├── .env # GitCode Token 配置(本地,不提交)
├── .gitignore # 忽略 .env 和缓存数据
├── requirements.txt # Python 依赖
├── src/
│ ├── __init__.py
│ ├── github_api.py # GitCode API 封装
│ ├── activity_analyzer.py # 活跃度分析核心逻辑
│ ├── code_stats.py # 代码规模统计模块
│ ├── report_generator.py # Markdown 报告生成
│ └── main.py # 主入口脚本
├── data/
│ └── cache.json # API 响应缓存(避免重复请求)
└── reports/
└── activity_report.md # 生成的活跃度报告
配置说明
config.yaml 配置文件说明:
gitcode:
base_url: "https://api.gitcode.com" # GitCode API 地址
organization: "openharmony" # GitCode 组织名
filters:
exclude_patterns: # 排除的仓库名模式
- "third_party"
- "3rd_party"
- "vendor"
inactive_days: 365 # 超过此天数无提交则排除
time_ranges:
week: 7
month: 30
quarter: 90
halfyear: 182
year: 365
code_stats:
enabled: true
sample_large_repos: true # 大型仓库使用采样
sample_ratio: 0.8 # 采样比例(80%文件)
cache_enabled: true # 启用缓存
output:
report_path: "reports/activity_report.md"
top_n: 50 # 排行榜显示数量
show_full_list: true # 是否显示完整清单
报告内容
生成的报告包含以下内容:
- 📊 统计摘要 - 总仓库数、活跃仓库数、排除仓库数
- 🔥 按周活跃度 Top 50 - 近 7 天的提交统计
- 📅 按月度活跃度 Top 50 - 近 30 天的提交统计
- 📈 按季度活跃度 Top 50 - 近 90 天的提交统计
- 📊 按半年度活跃度 Top 50 - 近 182 天的提交统计
- 🏆 按年度活跃度 Top 50 - 近 365 天的提交统计
- 📋 完整活跃仓库清单 - 按综合评分排序
每个排行榜包含:排名、仓库名、GitCode链接、代码规模、Stars、提交数、最后提交时间
依赖要求
- Python 3.7+
- 详见
requirements.txt
注意事项
- GitCode Token 存储在
.env文件中,不会被提交到 Git 仓库 - 建议定期运行脚本以获取最新的活跃度数据
- 数据源为
gitcode.com/openharmony,确保获取的是实时同步的仓库数据
许可证
MIT License
Introduction
可用于实时统计 GitCode OpenHarmony 组织下仓库的活跃度,生成多维度报告。支持按周/月/季度等时间维度分析,统计代码规模,智能过滤非活跃仓库,通过 GitCode API 获取数据并生成可视化 Markdown 报告。【此简介由AI生成】
Customize your domain