gitinsight-cli 0.1.0__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.
- gitinsight_cli-0.1.0/.github/copilot-instructions.md +26 -0
- gitinsight_cli-0.1.0/.github/workflows/release.yml +70 -0
- gitinsight_cli-0.1.0/.gitignore +222 -0
- gitinsight_cli-0.1.0/.python-version +1 -0
- gitinsight_cli-0.1.0/PKG-INFO +152 -0
- gitinsight_cli-0.1.0/README.md +134 -0
- gitinsight_cli-0.1.0/build_wheel.sh +27 -0
- gitinsight_cli-0.1.0/docs/demand.md +489 -0
- gitinsight_cli-0.1.0/gitinsight/__init__.py +7 -0
- gitinsight_cli-0.1.0/gitinsight/__main__.py +92 -0
- gitinsight_cli-0.1.0/gitinsight/analysis.py +541 -0
- gitinsight_cli-0.1.0/gitinsight/charts.py +849 -0
- gitinsight_cli-0.1.0/gitinsight/dashboard.py +622 -0
- gitinsight_cli-0.1.0/gitinsight/git_reader.py +225 -0
- gitinsight_cli-0.1.0/gitinsight/report.py +26 -0
- gitinsight_cli-0.1.0/pyproject.toml +37 -0
- gitinsight_cli-0.1.0/uv.lock +361 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# 项目速览
|
|
2
|
+
- 这是一个本地 Git 仓库分析工具:`main.py` 负责入口、日志与进度输出;分析链路为 `git_reader.py -> analysis.py -> charts.py -> dashboard.py -> report.py`。
|
|
3
|
+
- 输出物是可视化仪表板 HTML:`git_analysis_<repo_name>.html`,由 `dashboard.py` 拼装图表与 KPI 卡片。
|
|
4
|
+
- Git 日志通过 `git_reader.get_git_log()` 读取,并缓存到 `git_reader.py` 同级的 `.cache/.git_log_<hash>.cache`(默认 1 天有效)。
|
|
5
|
+
|
|
6
|
+
# 关键数据流与结构
|
|
7
|
+
- `git_reader.parse_git_log()` 产出两个 DataFrame:
|
|
8
|
+
- `commits_df`:`hash/author/email/datetime_str/message/insertions/deletions`
|
|
9
|
+
- `file_stats_df`:`hash/filepath/insertions/deletions`
|
|
10
|
+
- `analysis.prepare_dataframe()` 统一处理时区(`Asia/Shanghai`)并添加字段:`local_time/date/date_6am_cutoff/time_in_6am_day`;凌晨提交以 06:00 作为分界。
|
|
11
|
+
- `analysis.filter_automated_commits()` 按 `datetime_str` 以 `+0000` 结尾过滤自动化提交(先过滤后计算指标)。
|
|
12
|
+
- `analysis.compute_insights()` 聚合所有指标并返回给 `dashboard.build_dashboard_html()`,包括 `author_stats`、`monthly_trends`、`daily_commits`、`code_activity`、`code_stability`、`file_heatmap` 等。
|
|
13
|
+
|
|
14
|
+
# 图表与仪表板约定
|
|
15
|
+
- 图表构建集中在 `charts.py`,仪表板布局 + JS 交互在 `dashboard.py`。
|
|
16
|
+
- `dashboard._render_chart_div()` 会解析 pyecharts 生成的 HTML 片段并嵌入页面;`devData`/雷达图/日历图等开发者面板数据在服务端预计算。
|
|
17
|
+
- ECharts 资源通过 CDN 引入(`https://assets.pyecharts.org/assets/v5/echarts.min.js`)。
|
|
18
|
+
|
|
19
|
+
# 常用开发/运行方式
|
|
20
|
+
- 依赖由 `pyproject.toml` 管理(`uv sync`);入口脚本为 `python main.py <git_repo_path>`,或运行后交互输入路径(见 `README.md`)。
|
|
21
|
+
- Windows 控制台编码已在 `main.py` 中处理(`sys.stdout`/`stderr` UTF-8 包装),保持此模式以支持中文/emoji 输出。
|
|
22
|
+
|
|
23
|
+
# 贡献时的约定与示例
|
|
24
|
+
- 新增指标请在 `analysis.py` 中计算并在 `compute_insights()` 中返回,再在 `charts.py`/`dashboard.py` 中渲染。
|
|
25
|
+
- 新图表优先复用 `charts.py` 的现有风格(`pyecharts` + 统一尺寸 + `opts` 配置)。
|
|
26
|
+
- 若需复用作者维度统计,参考 `compute_author_stats()` 的字段:`is_active/phase/contribution_level/night_ratio`。
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
name: Auto Release Wheel
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [ "main" ]
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: write
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
build-and-release:
|
|
13
|
+
name: Build and Release Wheel
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
|
|
16
|
+
steps:
|
|
17
|
+
- name: Checkout code
|
|
18
|
+
uses: actions/checkout@v4
|
|
19
|
+
|
|
20
|
+
- name: Install uv
|
|
21
|
+
uses: astral-sh/setup-uv@v5
|
|
22
|
+
|
|
23
|
+
- name: Set up Python
|
|
24
|
+
run: uv python install
|
|
25
|
+
|
|
26
|
+
- name: Generate Version Number
|
|
27
|
+
id: version
|
|
28
|
+
run: |
|
|
29
|
+
# Use current timestamp as version: YYYY.MM.DD.HHMMSS
|
|
30
|
+
# Using UTC time to avoid timezone confusion and ensure monotonicity
|
|
31
|
+
VERSION_NUM=$(date -u +'%Y.%m.%d.%H%M%S')
|
|
32
|
+
echo "VERSION_NUM=$VERSION_NUM" >> $GITHUB_ENV
|
|
33
|
+
echo "Generated version: $VERSION_NUM"
|
|
34
|
+
|
|
35
|
+
- name: Update pyproject.toml version
|
|
36
|
+
run: |
|
|
37
|
+
# Simple sed replacement for the version field
|
|
38
|
+
# Matches 'version = "..."'
|
|
39
|
+
sed -i "s/version = \".*\"/version = \"${{ env.VERSION_NUM }}\"/" pyproject.toml
|
|
40
|
+
echo "Updated pyproject.toml version:"
|
|
41
|
+
grep "version =" pyproject.toml
|
|
42
|
+
|
|
43
|
+
- name: Build Wheel
|
|
44
|
+
run: |
|
|
45
|
+
uv build
|
|
46
|
+
|
|
47
|
+
# Verify the output
|
|
48
|
+
echo "Build artifacts:"
|
|
49
|
+
ls -l dist/
|
|
50
|
+
|
|
51
|
+
- name: Create Release
|
|
52
|
+
uses: softprops/action-gh-release@v2
|
|
53
|
+
with:
|
|
54
|
+
tag_name: "v${{ env.VERSION_NUM }}"
|
|
55
|
+
name: "Release v${{ env.VERSION_NUM }}"
|
|
56
|
+
files: dist/*.whl
|
|
57
|
+
make_latest: true
|
|
58
|
+
body: |
|
|
59
|
+
Auto-generated release from GitHub Actions.
|
|
60
|
+
Version: ${{ env.VERSION_NUM }}
|
|
61
|
+
Build Time: $(date)
|
|
62
|
+
|
|
63
|
+
## Platform Support
|
|
64
|
+
This release contains a **Pure Python Wheel** (`*-py3-none-any.whl`).
|
|
65
|
+
It is compatible with:
|
|
66
|
+
- ✅ **Windows (x64/ARM64)**
|
|
67
|
+
- ✅ **Linux (x64/ARM64)**
|
|
68
|
+
- ✅ **macOS (x64/ARM64)**
|
|
69
|
+
|
|
70
|
+
Requires Python 3.12+.
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[codz]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py.cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
.pybuilder/
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pyenv
|
|
86
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
87
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
88
|
+
# .python-version
|
|
89
|
+
|
|
90
|
+
# pipenv
|
|
91
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
92
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
93
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
94
|
+
# install all needed dependencies.
|
|
95
|
+
# Pipfile.lock
|
|
96
|
+
|
|
97
|
+
# UV
|
|
98
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
99
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
100
|
+
# commonly ignored for libraries.
|
|
101
|
+
# uv.lock
|
|
102
|
+
|
|
103
|
+
# poetry
|
|
104
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
105
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
106
|
+
# commonly ignored for libraries.
|
|
107
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
108
|
+
# poetry.lock
|
|
109
|
+
# poetry.toml
|
|
110
|
+
|
|
111
|
+
# pdm
|
|
112
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
113
|
+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
|
|
114
|
+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
|
|
115
|
+
# pdm.lock
|
|
116
|
+
# pdm.toml
|
|
117
|
+
.pdm-python
|
|
118
|
+
.pdm-build/
|
|
119
|
+
|
|
120
|
+
# pixi
|
|
121
|
+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
|
|
122
|
+
# pixi.lock
|
|
123
|
+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
|
|
124
|
+
# in the .venv directory. It is recommended not to include this directory in version control.
|
|
125
|
+
.pixi
|
|
126
|
+
|
|
127
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
128
|
+
__pypackages__/
|
|
129
|
+
|
|
130
|
+
# Celery stuff
|
|
131
|
+
celerybeat-schedule
|
|
132
|
+
celerybeat.pid
|
|
133
|
+
|
|
134
|
+
# Redis
|
|
135
|
+
*.rdb
|
|
136
|
+
*.aof
|
|
137
|
+
*.pid
|
|
138
|
+
|
|
139
|
+
# RabbitMQ
|
|
140
|
+
mnesia/
|
|
141
|
+
rabbitmq/
|
|
142
|
+
rabbitmq-data/
|
|
143
|
+
|
|
144
|
+
# ActiveMQ
|
|
145
|
+
activemq-data/
|
|
146
|
+
|
|
147
|
+
# SageMath parsed files
|
|
148
|
+
*.sage.py
|
|
149
|
+
|
|
150
|
+
# Environments
|
|
151
|
+
.env
|
|
152
|
+
.envrc
|
|
153
|
+
.venv
|
|
154
|
+
env/
|
|
155
|
+
venv/
|
|
156
|
+
ENV/
|
|
157
|
+
env.bak/
|
|
158
|
+
venv.bak/
|
|
159
|
+
|
|
160
|
+
# Spyder project settings
|
|
161
|
+
.spyderproject
|
|
162
|
+
.spyproject
|
|
163
|
+
|
|
164
|
+
# Rope project settings
|
|
165
|
+
.ropeproject
|
|
166
|
+
|
|
167
|
+
# mkdocs documentation
|
|
168
|
+
/site
|
|
169
|
+
|
|
170
|
+
# mypy
|
|
171
|
+
.mypy_cache/
|
|
172
|
+
.dmypy.json
|
|
173
|
+
dmypy.json
|
|
174
|
+
|
|
175
|
+
# Pyre type checker
|
|
176
|
+
.pyre/
|
|
177
|
+
|
|
178
|
+
# pytype static type analyzer
|
|
179
|
+
.pytype/
|
|
180
|
+
|
|
181
|
+
# Cython debug symbols
|
|
182
|
+
cython_debug/
|
|
183
|
+
|
|
184
|
+
# PyCharm
|
|
185
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
186
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
187
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
188
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
189
|
+
.idea/
|
|
190
|
+
|
|
191
|
+
# Abstra
|
|
192
|
+
# Abstra is an AI-powered process automation framework.
|
|
193
|
+
# Ignore directories containing user credentials, local state, and settings.
|
|
194
|
+
# Learn more at https://abstra.io/docs
|
|
195
|
+
.abstra/
|
|
196
|
+
|
|
197
|
+
# Visual Studio Code
|
|
198
|
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
|
|
199
|
+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
|
200
|
+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
|
|
201
|
+
# you could uncomment the following to ignore the entire vscode folder
|
|
202
|
+
# .vscode/
|
|
203
|
+
|
|
204
|
+
# Ruff stuff:
|
|
205
|
+
.ruff_cache/
|
|
206
|
+
|
|
207
|
+
# PyPI configuration file
|
|
208
|
+
.pypirc
|
|
209
|
+
|
|
210
|
+
# Marimo
|
|
211
|
+
marimo/_static/
|
|
212
|
+
marimo/_lsp/
|
|
213
|
+
__marimo__/
|
|
214
|
+
|
|
215
|
+
# Streamlit
|
|
216
|
+
.streamlit/secrets.toml
|
|
217
|
+
|
|
218
|
+
.cache/
|
|
219
|
+
|
|
220
|
+
*.html
|
|
221
|
+
|
|
222
|
+
.DS_Store
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.12
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: gitinsight-cli
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A powerful collection of Git repository analysis tools and visualizations.
|
|
5
|
+
Project-URL: Homepage, https://github.com/Rain-kl/GitInsight
|
|
6
|
+
Project-URL: Bug Tracker, https://github.com/Rain-kl/GitInsight/issues
|
|
7
|
+
Author-email: Ryan <ryan@arctel.net>
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Requires-Python: >=3.12
|
|
13
|
+
Requires-Dist: loguru>=0.7.3
|
|
14
|
+
Requires-Dist: pandas>=3.0.0
|
|
15
|
+
Requires-Dist: pyecharts>=2.0.0
|
|
16
|
+
Requires-Dist: tqdm>=4.67.3
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
|
|
19
|
+
# GitInsight
|
|
20
|
+
|
|
21
|
+
GitRepository Analysis and Visualization Tool / Git 仓库分析与可视化工具
|
|
22
|
+
|
|
23
|
+
<!-- PROJECT SHIELDS -->
|
|
24
|
+
|
|
25
|
+
[![MIT License][license-shield]][license-url]
|
|
26
|
+
|
|
27
|
+
[![Python Version][python-version]][python-version]
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## 目录
|
|
32
|
+
|
|
33
|
+
- [GitInsight](#gitinsight)
|
|
34
|
+
- [目录](#目录)
|
|
35
|
+
- [上手指南](#上手指南)
|
|
36
|
+
- [开发前的配置要求](#开发前的配置要求)
|
|
37
|
+
- [**安装步骤**](#安装步骤)
|
|
38
|
+
- [文件目录说明](#文件目录说明)
|
|
39
|
+
- [开发的架构](#开发的架构)
|
|
40
|
+
- [部署](#部署)
|
|
41
|
+
- [使用到的框架](#使用到的框架)
|
|
42
|
+
- [贡献者](#贡献者)
|
|
43
|
+
- [如何参与开源项目](#如何参与开源项目)
|
|
44
|
+
|
|
45
|
+
### 上手指南
|
|
46
|
+
|
|
47
|
+
###### 开发前的配置要求
|
|
48
|
+
|
|
49
|
+
1. Python >= 3.12
|
|
50
|
+
2. uv (推荐使用 uv 进行包管理) 或 pip
|
|
51
|
+
|
|
52
|
+
###### **安装步骤**
|
|
53
|
+
|
|
54
|
+
1. Clone the repo
|
|
55
|
+
|
|
56
|
+
```sh
|
|
57
|
+
git clone https://github.com/Rain-kl/GitInsight.git
|
|
58
|
+
cd GitInsight
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
2. Install as a command-line tool
|
|
62
|
+
|
|
63
|
+
```sh
|
|
64
|
+
# Install from PyPI
|
|
65
|
+
uv tool install gitinsight-cli
|
|
66
|
+
|
|
67
|
+
# Install from the current checkout
|
|
68
|
+
uv tool install .
|
|
69
|
+
|
|
70
|
+
# Or install directly from GitHub
|
|
71
|
+
uv tool install git+https://github.com/Rain-kl/GitInsight.git
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
3. Run the tool
|
|
75
|
+
|
|
76
|
+
```sh
|
|
77
|
+
gitinsight /path/to/git/repository
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Upgrade or uninstall the tool:
|
|
81
|
+
|
|
82
|
+
```sh
|
|
83
|
+
uv tool upgrade gitinsight-cli
|
|
84
|
+
uv tool uninstall gitinsight-cli
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
For local development:
|
|
88
|
+
|
|
89
|
+
```sh
|
|
90
|
+
uv sync
|
|
91
|
+
uv run gitinsight /path/to/git/repository
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### 文件目录说明
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
GitInsight
|
|
98
|
+
├── .github/ # GitHub 配置
|
|
99
|
+
├── gitinsight/ # 源代码目录
|
|
100
|
+
│ ├── __init__.py
|
|
101
|
+
│ ├── __main__.py # 程序入口
|
|
102
|
+
│ ├── analysis.py # 分析逻辑 (Pandas)
|
|
103
|
+
│ ├── charts.py # 图表绘制 (Pyecharts)
|
|
104
|
+
│ ├── dashboard.py # 仪表盘展示
|
|
105
|
+
│ ├── git_reader.py # Git日志读取
|
|
106
|
+
│ └── report.py # 报告生成
|
|
107
|
+
├── .gitignore
|
|
108
|
+
├── pyproject.toml # 项目配置与依赖
|
|
109
|
+
├── uv.lock # 依赖锁定文件
|
|
110
|
+
└── README.md # 项目说明
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### 开发的架构
|
|
114
|
+
|
|
115
|
+
本项目主要由数据读取、数据分析、图表生成和仪表盘展示四个部分组成。
|
|
116
|
+
- `git_reader.py`: 负责读取 Git 仓库的提交日志。
|
|
117
|
+
- `analysis.py`: 使用 Pandas 对日志数据进行清洗和统计分析。
|
|
118
|
+
- `charts.py`: 使用 Pyecharts 生成各类可视化图表。
|
|
119
|
+
- `dashboard.py`: 整合图表生成 HTML 仪表盘。
|
|
120
|
+
|
|
121
|
+
请阅读架构文档(如有)查阅为该项目的架构。
|
|
122
|
+
|
|
123
|
+
### 部署
|
|
124
|
+
|
|
125
|
+
本项目为 Python 命令行工具,可直接本地运行或打包发布到 PyPI。
|
|
126
|
+
暂无特殊部署部署。
|
|
127
|
+
|
|
128
|
+
### 使用到的框架
|
|
129
|
+
|
|
130
|
+
- [Pandas](https://pandas.pydata.org/) - Data structures and analysis tools
|
|
131
|
+
- [Pyecharts](https://github.com/pyecharts/pyecharts) - Python Echarts Plotting Library
|
|
132
|
+
- [Loguru](https://github.com/Delgan/loguru) - Python logging made (stupidly) simple
|
|
133
|
+
- [Hatchling](https://hatch.pypa.io/latest/) - Modern, extensible Python build backend
|
|
134
|
+
|
|
135
|
+
### 贡献者
|
|
136
|
+
|
|
137
|
+
请阅读**CONTRIBUTING.md** 查阅为该项目做出贡献的开发者。
|
|
138
|
+
|
|
139
|
+
#### 如何参与开源项目
|
|
140
|
+
|
|
141
|
+
贡献使开源社区成为一个学习、激励和创造的绝佳场所。你所作的任何贡献都是**非常感谢**的。
|
|
142
|
+
|
|
143
|
+
1. Fork the Project
|
|
144
|
+
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
|
|
145
|
+
3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
|
|
146
|
+
4. Push to the Branch (`git push origin feature/AmazingFeature`)
|
|
147
|
+
5. Open a Pull Request
|
|
148
|
+
|
|
149
|
+
<!-- links -->
|
|
150
|
+
[license-shield]: https://img.shields.io/github/license/shaojintian/Best_README_template.svg?style=flat-square
|
|
151
|
+
[license-url]: https://github.com/Rain-kl/GitInsight/blob/main/LICENSE
|
|
152
|
+
[python-version]:https://img.shields.io/pypi/pyversions/pandas
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
# GitInsight
|
|
2
|
+
|
|
3
|
+
GitRepository Analysis and Visualization Tool / Git 仓库分析与可视化工具
|
|
4
|
+
|
|
5
|
+
<!-- PROJECT SHIELDS -->
|
|
6
|
+
|
|
7
|
+
[![MIT License][license-shield]][license-url]
|
|
8
|
+
|
|
9
|
+
[![Python Version][python-version]][python-version]
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## 目录
|
|
14
|
+
|
|
15
|
+
- [GitInsight](#gitinsight)
|
|
16
|
+
- [目录](#目录)
|
|
17
|
+
- [上手指南](#上手指南)
|
|
18
|
+
- [开发前的配置要求](#开发前的配置要求)
|
|
19
|
+
- [**安装步骤**](#安装步骤)
|
|
20
|
+
- [文件目录说明](#文件目录说明)
|
|
21
|
+
- [开发的架构](#开发的架构)
|
|
22
|
+
- [部署](#部署)
|
|
23
|
+
- [使用到的框架](#使用到的框架)
|
|
24
|
+
- [贡献者](#贡献者)
|
|
25
|
+
- [如何参与开源项目](#如何参与开源项目)
|
|
26
|
+
|
|
27
|
+
### 上手指南
|
|
28
|
+
|
|
29
|
+
###### 开发前的配置要求
|
|
30
|
+
|
|
31
|
+
1. Python >= 3.12
|
|
32
|
+
2. uv (推荐使用 uv 进行包管理) 或 pip
|
|
33
|
+
|
|
34
|
+
###### **安装步骤**
|
|
35
|
+
|
|
36
|
+
1. Clone the repo
|
|
37
|
+
|
|
38
|
+
```sh
|
|
39
|
+
git clone https://github.com/Rain-kl/GitInsight.git
|
|
40
|
+
cd GitInsight
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
2. Install as a command-line tool
|
|
44
|
+
|
|
45
|
+
```sh
|
|
46
|
+
# Install from PyPI
|
|
47
|
+
uv tool install gitinsight-cli
|
|
48
|
+
|
|
49
|
+
# Install from the current checkout
|
|
50
|
+
uv tool install .
|
|
51
|
+
|
|
52
|
+
# Or install directly from GitHub
|
|
53
|
+
uv tool install git+https://github.com/Rain-kl/GitInsight.git
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
3. Run the tool
|
|
57
|
+
|
|
58
|
+
```sh
|
|
59
|
+
gitinsight /path/to/git/repository
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Upgrade or uninstall the tool:
|
|
63
|
+
|
|
64
|
+
```sh
|
|
65
|
+
uv tool upgrade gitinsight-cli
|
|
66
|
+
uv tool uninstall gitinsight-cli
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
For local development:
|
|
70
|
+
|
|
71
|
+
```sh
|
|
72
|
+
uv sync
|
|
73
|
+
uv run gitinsight /path/to/git/repository
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### 文件目录说明
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
GitInsight
|
|
80
|
+
├── .github/ # GitHub 配置
|
|
81
|
+
├── gitinsight/ # 源代码目录
|
|
82
|
+
│ ├── __init__.py
|
|
83
|
+
│ ├── __main__.py # 程序入口
|
|
84
|
+
│ ├── analysis.py # 分析逻辑 (Pandas)
|
|
85
|
+
│ ├── charts.py # 图表绘制 (Pyecharts)
|
|
86
|
+
│ ├── dashboard.py # 仪表盘展示
|
|
87
|
+
│ ├── git_reader.py # Git日志读取
|
|
88
|
+
│ └── report.py # 报告生成
|
|
89
|
+
├── .gitignore
|
|
90
|
+
├── pyproject.toml # 项目配置与依赖
|
|
91
|
+
├── uv.lock # 依赖锁定文件
|
|
92
|
+
└── README.md # 项目说明
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### 开发的架构
|
|
96
|
+
|
|
97
|
+
本项目主要由数据读取、数据分析、图表生成和仪表盘展示四个部分组成。
|
|
98
|
+
- `git_reader.py`: 负责读取 Git 仓库的提交日志。
|
|
99
|
+
- `analysis.py`: 使用 Pandas 对日志数据进行清洗和统计分析。
|
|
100
|
+
- `charts.py`: 使用 Pyecharts 生成各类可视化图表。
|
|
101
|
+
- `dashboard.py`: 整合图表生成 HTML 仪表盘。
|
|
102
|
+
|
|
103
|
+
请阅读架构文档(如有)查阅为该项目的架构。
|
|
104
|
+
|
|
105
|
+
### 部署
|
|
106
|
+
|
|
107
|
+
本项目为 Python 命令行工具,可直接本地运行或打包发布到 PyPI。
|
|
108
|
+
暂无特殊部署部署。
|
|
109
|
+
|
|
110
|
+
### 使用到的框架
|
|
111
|
+
|
|
112
|
+
- [Pandas](https://pandas.pydata.org/) - Data structures and analysis tools
|
|
113
|
+
- [Pyecharts](https://github.com/pyecharts/pyecharts) - Python Echarts Plotting Library
|
|
114
|
+
- [Loguru](https://github.com/Delgan/loguru) - Python logging made (stupidly) simple
|
|
115
|
+
- [Hatchling](https://hatch.pypa.io/latest/) - Modern, extensible Python build backend
|
|
116
|
+
|
|
117
|
+
### 贡献者
|
|
118
|
+
|
|
119
|
+
请阅读**CONTRIBUTING.md** 查阅为该项目做出贡献的开发者。
|
|
120
|
+
|
|
121
|
+
#### 如何参与开源项目
|
|
122
|
+
|
|
123
|
+
贡献使开源社区成为一个学习、激励和创造的绝佳场所。你所作的任何贡献都是**非常感谢**的。
|
|
124
|
+
|
|
125
|
+
1. Fork the Project
|
|
126
|
+
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
|
|
127
|
+
3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
|
|
128
|
+
4. Push to the Branch (`git push origin feature/AmazingFeature`)
|
|
129
|
+
5. Open a Pull Request
|
|
130
|
+
|
|
131
|
+
<!-- links -->
|
|
132
|
+
[license-shield]: https://img.shields.io/github/license/shaojintian/Best_README_template.svg?style=flat-square
|
|
133
|
+
[license-url]: https://github.com/Rain-kl/GitInsight/blob/main/LICENSE
|
|
134
|
+
[python-version]:https://img.shields.io/pypi/pyversions/pandas
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
set -e
|
|
3
|
+
|
|
4
|
+
# Get the directory of the script
|
|
5
|
+
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
6
|
+
cd "$script_dir"
|
|
7
|
+
|
|
8
|
+
# Clean up previous build artifacts
|
|
9
|
+
echo "Cleaning up previous builds..."
|
|
10
|
+
rm -rf dist/
|
|
11
|
+
rm -rf build/
|
|
12
|
+
rm -rf *.egg-info
|
|
13
|
+
|
|
14
|
+
# Build the package using uv
|
|
15
|
+
if command -v uv &> /dev/null; then
|
|
16
|
+
echo "Building with uv..."
|
|
17
|
+
uv build
|
|
18
|
+
else
|
|
19
|
+
echo "uv not found, falling back to python build module..."
|
|
20
|
+
# Ensure build module is installed
|
|
21
|
+
python3 -m pip install --upgrade build
|
|
22
|
+
python3 -m build
|
|
23
|
+
fi
|
|
24
|
+
|
|
25
|
+
echo "------------------------------------------------"
|
|
26
|
+
echo "Build complete! Wheel file can be found in dist/"
|
|
27
|
+
ls -lh dist/*.whl
|