Skip to content

Commit 355e5f9

Browse files
v0.12.0: watch run 并行化 + portfolio summary + CI/release 自动化
#54 watch_run 并行化: - 重构 watch_run 为 multiprocessing.Pool(默认 workers=4) - 49 只串行 60-90min → 并行 ~15-20min (4x 加速) - 新增 --workers N(默认 4)和 --serial(强制串行,调试用) - 单股逻辑提取为 _run_single_subprocess (可独立调用) - imap_unordered 边跑边汇总评级变化 #55 CI + 自动 release: - .github/workflows/ci.yml:PR + push 时 Python 3.10/3.11/3.12 跑 pytest + CLI 冒烟 - .github/workflows/release.yml:v*.*.* tag 触发自动 release + 跑测试 + 自动生成 changelog(since last tag)+ GitHub Release #56 portfolio summary(依赖 #47 买入价): - 新 stockwise portfolio summary 命令 - 总成本/总市值/总浮盈 + 加权 5y ROE/PE/股息率 - 行业集中度(>30% 标红集中风险) - 卖出信号热力(high/medium 计数) - 评级分布 + 单股浮盈明细(按浮盈率降序,超 5% 标色) 测试:76/76 pass。 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent a3aac85 commit 355e5f9

4 files changed

Lines changed: 323 additions & 44 deletions

File tree

.github/workflows/ci.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
python-version: ["3.10", "3.11", "3.12"]
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Set up Python ${{ matrix.python-version }}
20+
uses: actions/setup-python@v5
21+
with:
22+
python-version: ${{ matrix.python-version }}
23+
cache: pip
24+
25+
- name: Install dependencies
26+
run: |
27+
python -m pip install --upgrade pip
28+
pip install -e ".[dev]"
29+
30+
- name: Run tests
31+
run: pytest -q
32+
33+
- name: Verify CLI imports
34+
run: |
35+
python -c "from stockwise.cli import cli; print('OK')"
36+
python -m stockwise --help

.github/workflows/release.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*.*.*"
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
steps:
14+
- uses: actions/checkout@v4
15+
with:
16+
fetch-depth: 0
17+
18+
- name: Set up Python
19+
uses: actions/setup-python@v5
20+
with:
21+
python-version: "3.11"
22+
23+
- name: Install dependencies
24+
run: |
25+
python -m pip install --upgrade pip
26+
pip install -e ".[dev]"
27+
28+
- name: Run tests
29+
run: pytest -q
30+
31+
- name: Generate changelog from commits since last tag
32+
id: changelog
33+
run: |
34+
PREV_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "")
35+
if [ -z "$PREV_TAG" ]; then
36+
git log --oneline > /tmp/changelog.txt
37+
else
38+
echo "## Commits since $PREV_TAG" > /tmp/changelog.txt
39+
git log --oneline ${PREV_TAG}..HEAD >> /tmp/changelog.txt
40+
fi
41+
cat /tmp/changelog.txt
42+
43+
- name: Create GitHub Release
44+
uses: softprops/action-gh-release@v2
45+
with:
46+
body_path: /tmp/changelog.txt
47+
draft: false
48+
prerelease: false

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[project]
22
name = "stockwise"
3-
version = "0.11.0"
4-
description = "巴菲特/林奇范式 A 股 + 港股价值投资分析工具:真历史回测 + 行业 ROE 分位 + 利润质量深度分解 + 买卖价位区间"
3+
version = "0.12.0"
4+
description = "巴菲特/林奇范式 A 股 + 港股价值投资分析工具:watch run 并行化 + portfolio summary + CI 自动化"
55
license = { text = "MIT" }
66
requires-python = ">=3.10"
77
dependencies = [

0 commit comments

Comments
 (0)