Skip to content

Commit 4bb7382

Browse files
liuxiaotongclaudehappy-otter
committed
release: v0.3.2 — 覆盖率 97%, CI 自动发布, CONTRIBUTING.md
- 测试覆盖率 96% → 97% (3399 tests), spec_analyzer 67% → 100% - GitHub Actions 自动发布: tag push → PyPI + GitHub Release - CI 加 pip cache 加速 - 添加 CONTRIBUTING.md 贡献指南 - 精简 pyproject.toml full 依赖组 (复用 all 组) Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
1 parent 53e9893 commit 4bb7382

File tree

9 files changed

+1412
-14
lines changed

9 files changed

+1412
-14
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ jobs:
2020
uses: actions/setup-python@v5
2121
with:
2222
python-version: ${{ matrix.python-version }}
23+
cache: "pip"
2324

2425
- name: Install dependencies
2526
run: |

.github/workflows/release.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags: ["v*"]
6+
7+
jobs:
8+
publish:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
id-token: write
12+
contents: write
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Set up Python
18+
uses: actions/setup-python@v5
19+
with:
20+
python-version: "3.12"
21+
cache: "pip"
22+
23+
- name: Install build tools
24+
run: pip install build
25+
26+
- name: Build package
27+
run: python -m build
28+
29+
- name: Publish to PyPI
30+
uses: pypa/gh-action-pypi-publish@release/v1
31+
with:
32+
password: ${{ secrets.PYPI_API_TOKEN }}
33+
34+
- name: Create GitHub Release
35+
uses: softprops/action-gh-release@v2
36+
with:
37+
generate_release_notes: true
38+
files: dist/*

CONTRIBUTING.md

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# Contributing to DataRecipe
2+
3+
## Development Setup
4+
5+
```bash
6+
# Clone and install
7+
git clone https://github.com/liuxiaotong/data-recipe.git
8+
cd data-recipe
9+
python -m venv .venv
10+
source .venv/bin/activate
11+
make dev # Install with all dependencies
12+
13+
# Install pre-commit hooks
14+
make hooks
15+
```
16+
17+
## Development Workflow
18+
19+
```bash
20+
make lint # Run ruff linter
21+
make format # Auto-format code
22+
make test # Run tests (3294+ tests)
23+
make cov # Run tests with coverage (96%+, minimum 80%)
24+
make typecheck # Run mypy type checking
25+
make ci # Run full CI pipeline locally
26+
```
27+
28+
## Testing
29+
30+
- Use `unittest.TestCase` style
31+
- Mock all external dependencies (LLM APIs, network requests, file I/O)
32+
- Place tests in `tests/test_<module>.py`
33+
- Aim for 90%+ coverage on new code
34+
35+
```bash
36+
# Run specific test file
37+
pytest tests/test_analyzer.py -v
38+
39+
# Run with coverage for a specific module
40+
pytest tests/ --cov=datarecipe.analyzer --cov-report=term-missing
41+
```
42+
43+
## Code Style
44+
45+
- **Formatter**: ruff (line-length 100)
46+
- **Target**: Python 3.10+ (`X | None` instead of `Optional[X]`)
47+
- **Imports**: sorted by ruff (`I` rule)
48+
- Pre-commit hooks enforce formatting on every commit
49+
50+
## Project Structure
51+
52+
```
53+
src/datarecipe/
54+
├── cli/ # CLI commands (7 modules)
55+
├── core/ # Deep analysis engine
56+
├── analyzers/ # Spec + LLM dataset analyzers
57+
├── generators/ # Document generators (markdown/JSON)
58+
├── extractors/ # Rubrics + prompt extraction
59+
├── parsers/ # PDF/Word/image parsing
60+
├── cost/ # Cost estimation models
61+
├── knowledge/ # Knowledge base + dataset catalog
62+
├── sources/ # Data sources (HuggingFace, GitHub, web)
63+
├── providers/ # Deployment providers
64+
├── constants.py # Shared constants
65+
└── schema.py # Data models
66+
```
67+
68+
## Commit Messages
69+
70+
Use conventional commit format in Chinese or English:
71+
72+
```
73+
feat: 新增功能描述
74+
fix: 修复问题描述
75+
test: 测试相关
76+
docs: 文档更新
77+
chore: 构建/工具链
78+
refactor: 重构
79+
```
80+
81+
## Releasing
82+
83+
Releases are automated via GitHub Actions. To release:
84+
85+
1. Update version in `pyproject.toml`, `src/datarecipe/__init__.py`, `src/datarecipe/cli/__init__.py`
86+
2. Update `CHANGELOG.md`
87+
3. Commit and tag: `git tag -a v0.X.Y -m "v0.X.Y"`
88+
4. Push: `git push origin main --tags`
89+
5. GitHub Actions will auto-publish to PyPI and create a GitHub Release

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
[![PyPI](https://img.shields.io/pypi/v/knowlyr-datarecipe?color=blue&v=1)](https://pypi.org/project/knowlyr-datarecipe/)
88
[![Python 3.10+](https://img.shields.io/badge/python-3.10%E2%80%933.13-blue.svg)](https://www.python.org/downloads/)
9-
[![Tests](https://img.shields.io/badge/tests-3294_passed-brightgreen.svg)](#开发)
10-
[![Coverage](https://img.shields.io/badge/coverage-96%25-brightgreen.svg)](#开发)
9+
[![Tests](https://img.shields.io/badge/tests-3399_passed-brightgreen.svg)](#开发)
10+
[![Coverage](https://img.shields.io/badge/coverage-97%25-brightgreen.svg)](#开发)
1111
[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)
1212
[![MCP](https://img.shields.io/badge/MCP-10_Tools-purple.svg)](#mcp-server)
1313

@@ -406,7 +406,7 @@ make format
406406
make hooks
407407
```
408408

409-
**测试覆盖**: 35+ 个测试文件,3294 个测试用例,96% 语句覆盖率。
409+
**测试覆盖**: 35+ 个测试文件,3399 个测试用例,97% 语句覆盖率。
410410

411411
**CI**: GitHub Actions,支持 Python 3.10 / 3.11 / 3.12 / 3.13,覆盖率阈值 80%。
412412

pyproject.toml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "knowlyr-datarecipe"
7-
version = "0.3.1"
7+
version = "0.3.2"
88
description = "AI dataset 'ingredients label' analyzer - reverse-engineer datasets, estimate costs, analyze quality, and generate production workflows"
99
readme = "README.md"
1010
license = {text = "MIT"}
@@ -75,13 +75,7 @@ all = [
7575
"mcp>=1.0.0",
7676
]
7777
full = [
78-
"anthropic>=0.18.0",
79-
"openai>=1.0.0",
80-
"pymupdf>=1.23.0",
81-
"sentence-transformers>=2.2.0",
82-
"datasets>=2.14.0",
83-
"datasketch>=1.6.0",
84-
"jinja2>=3.1.0",
78+
"knowlyr-datarecipe[all]",
8579
"tenacity>=8.0.0",
8680
"label-studio>=1.10.0",
8781
"scikit-learn>=1.3.0",

src/datarecipe/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""DataRecipe - AI dataset analyzer: reverse-engineer datasets, estimate costs, analyze quality, generate workflows."""
22

3-
__version__ = "0.3.1"
3+
__version__ = "0.3.2"
44

55
from datarecipe.analyzer import DatasetAnalyzer
66
from datarecipe.schema import (

src/datarecipe/cli/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
# Main CLI group
1414
@click.group()
15-
@click.version_option(version="0.3.1", prog_name="datarecipe")
15+
@click.version_option(version="0.3.2", prog_name="datarecipe")
1616
def main():
1717
"""DataRecipe - Analyze AI dataset ingredients, estimate costs, and generate workflows."""
1818
pass

tests/test_cli_commands.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def test_main_help(self):
9292
def test_main_version(self):
9393
result = self.runner.invoke(main, ["--version"])
9494
self.assertEqual(result.exit_code, 0)
95-
self.assertIn("0.3.1", result.output)
95+
self.assertIn("0.3.2", result.output)
9696

9797
def test_main_no_args_shows_usage(self):
9898
result = self.runner.invoke(main, [])

0 commit comments

Comments
 (0)