-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
150 lines (115 loc) · 3.39 KB
/
Makefile
File metadata and controls
150 lines (115 loc) · 3.39 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
.PHONY: help install install-dev test test-cov lint format type-check clean build upload docs version bump-patch bump-minor bump-major publish publish-test security check
# 颜色输出
BLUE := \033[0;34m
GREEN := \033[0;32m
YELLOW := \033[0;33m
NC := \033[0m # No Color
# Default target
.DEFAULT_GOAL := help
help:
@echo "$(BLUE)QData Expression - 开发工具$(NC)"
@echo ""
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " $(GREEN)%-20s$(NC) %s\n", $$1, $$2}'
@echo ""
@echo "传统命令 (向后兼容):"
@echo " install, install-dev, test, test-cov, lint, format, type-check"
@echo " clean, build, upload, docs"
# Installation
install:
pip install -e .
install-dev:
pip install -e ".[dev]"
# Testing
test:
pytest
test-cov:
pytest --cov=qdata_expr --cov-report=term-missing --cov-report=html
test-verbose:
pytest -v
test-benchmark:
pytest tests/test_evaluator.py::TestPerformance -v
# Code quality
lint:
ruff check src tests
bandit -r src
format:
black src tests
isort src tests
type-check:
mypy src/qdata_expr
# Cleaning
clean:
rm -rf build/
rm -rf dist/
rm -rf *.egg-info/
rm -rf htmlcov/
rm -rf .coverage
rm -rf .coverage.*
rm -rf coverage.xml
rm -rf .pytest_cache/
rm -rf .mypy_cache/
rm -rf __pycache__/
find . -name "*.pyc" -delete
find . -name "*.pyo" -delete
find . -name "__pycache__" -type d -exec rm -rf {} +
# Building
build: clean
python -m build
upload-test:
python -m twine upload --repository testpypi dist/*
upload:
python -m twine upload dist/*
# Documentation
docs:
cd docs && make html
docs-serve:
cd docs && make html && python -m http.server 8000 -d _build/html
# Development
dev-setup: install-dev
pre-commit install
run-examples:
python examples/basic_usage.py
python examples/template_examples.py
python examples/custom_functions.py
python examples/security_examples.py
benchmark:
python examples/performance_benchmark.py
# Security check
security: ## 运行安全检查
@echo "$(BLUE)运行安全检查...$(NC)"
bandit -r src -ll
safety check
security-check: security # 向后兼容
# All-in-one quality check
check: lint type-check security ## 运行所有检查
quality: format lint type-check test # 向后兼容
# Version management
version: ## 显示当前版本号
@python scripts/bump_version.py show
bump-patch: ## 递增 patch 版本号 (0.1.0 → 0.1.1)
@python scripts/bump_version.py bump patch
bump-minor: ## 递增 minor 版本号 (0.1.0 → 0.2.0)
@python scripts/bump_version.py bump minor
bump-major: ## 递增 major 版本号 (0.1.0 → 1.0.0)
@python scripts/bump_version.py bump major
# Publishing
publish-test: build ## 发布到 Test PyPI
@echo "$(BLUE)发布到 Test PyPI...$(NC)"
python -m twine upload --repository testpypi dist/*
publish: build ## 发布到 PyPI (需要确认)
@echo "$(YELLOW)准备发布到 PyPI...$(NC)"
@echo "$(YELLOW)请确认版本号和 CHANGELOG 已更新!$(NC)"
@read -p "确认发布? [y/N] " -n 1 -r; \
echo; \
if [[ $$REPLY =~ ^[Yy]$$ ]]; then \
python -m twine upload dist/*; \
echo "$(GREEN)✓ 发布成功!$(NC)"; \
else \
echo "$(YELLOW)✗ 取消发布$(NC)"; \
fi
upload-test: publish-test # 向后兼容
upload: publish # 向后兼容
# Release preparation
release: clean quality build ## 准备发布(测试+构建)
@echo "$(GREEN)Ready for release! Check dist/ for built packages.$(NC)"
.DEFAULT_GOAL := help