-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
72 lines (59 loc) · 2.09 KB
/
Copy pathMakefile
File metadata and controls
72 lines (59 loc) · 2.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
.PHONY: install dev test lint format serve clean build help
# Default target
help:
@echo "MedTextCN - 中文医疗文本智能分析工具包"
@echo ""
@echo "可用命令:"
@echo " make install - 安装项目及核心依赖"
@echo " make dev - 安装开发依赖"
@echo " make test - 运行测试"
@echo " make lint - 代码检查 (flake8 + mypy)"
@echo " make format - 代码格式化 (black + isort)"
@echo " make serve - 启动API服务"
@echo " make clean - 清理构建产物"
@echo " make build - 构建分发包"
# Install project and core dependencies
install:
pip install -e .
# Install development dependencies
dev:
pip install -e ".[dev]"
pip install -r requirements-dev.txt
# Run tests with coverage
test:
pytest tests/ -v --cov=medtextcn --cov-report=term-missing --cov-report=html
# Run tests without coverage (quick)
test-quick:
pytest tests/ -v
# Code linting
lint:
flake8 medtextcn/ tests/ --max-line-length=88 --extend-ignore=E203,W503
mypy medtextcn/ --ignore-missing-imports
# Code formatting
format:
black medtextcn/ tests/ --line-length=88
isort medtextcn/ tests/ --profile black --line-length=88
# Check formatting without modifying
format-check:
black medtextcn/ tests/ --line-length=88 --check
isort medtextcn/ tests/ --profile black --line-length=88 --check-only
# Start API server
serve:
uvicorn medtextcn.service.app:app --host 0.0.0.0 --port 8080 --reload
# Start API server in production mode
serve-prod:
uvicorn medtextcn.service.app:app --host 0.0.0.0 --port 8080 --workers 4
# Clean build artifacts and cache
clean:
find . -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true
find . -type d -name "*.egg-info" -exec rm -rf {} + 2>/dev/null || true
find . -type d -name ".pytest_cache" -exec rm -rf {} + 2>/dev/null || true
find . -type d -name ".mypy_cache" -exec rm -rf {} + 2>/dev/null || true
find . -type f -name "*.pyc" -delete 2>/dev/null || true
rm -rf build/ dist/ htmlcov/ .coverage
# Build distribution packages
build:
python -m build
# All checks (lint + test)
check: lint test
@echo "所有检查通过!"