forked from xRiskLab/auto-uv
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
169 lines (132 loc) · 4.84 KB
/
Makefile
File metadata and controls
169 lines (132 loc) · 4.84 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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
# Makefile for auto-uv development
.PHONY: help install dev-install test lint format clean build publish act-test pre-commit
# Load .env file if it exists
-include .env
export
# Default target
.DEFAULT_GOAL := help
help: ## Show this help message
@echo "Available targets:"
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-20s\033[0m %s\n", $$1, $$2}'
install: ## Install the package (for testing after build)
uv pip install dist/*.whl
dev-install: ## Install package with development dependencies
@echo "Installing auto-uv with dev dependencies..."
uv pip install -e ".[dev]"
pre-commit install
@echo "✅ Development environment ready!"
test: ## Run tests
PYTHONPATH=src python tests/test_auto_uv.py
python example.py
test-pytest: ## Run tests with pytest
pytest tests/ -v
test-coverage: ## Run tests with coverage
pytest tests/ --cov=src --cov-report=term --cov-report=html
lint: ## Run linters
ruff check src/ tests/ example.py
mypy src/
bandit -r src/
format: ## Format code
black src/ tests/ example.py
isort src/ tests/ example.py
format-makefile: ## Format Makefile with mbake
AUTO_UV_DISABLE=1 uv run mbake format Makefile
format-check: ## Check formatting without fixing
black --check src/ tests/ example.py
isort --check-only src/ tests/ example.py
clean: ## Clean build artifacts
rm -rf build/
rm -rf dist/
rm -rf *.egg-info
rm -rf .pytest_cache/
rm -rf .mypy_cache/
rm -rf .ruff_cache/
rm -rf htmlcov/
rm -rf .coverage
find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
find . -type f -name "*.pyc" -delete
build: clean ## Build package
uv build
build-check: build ## Build and check distribution
@echo "✅ Build complete. Check dist/ directory"
@ls -lh dist/
publish-test: build ## Publish to Test PyPI (reads UV_PUBLISH_TOKEN from .env)
@if [ -z "$$UV_PUBLISH_TOKEN" ]; then \
echo "❌ UV_PUBLISH_TOKEN not set. Add to .env file"; \
exit 1; \
fi
@echo "📦 Publishing to Test PyPI..."
uv publish --publish-url https://test.pypi.org/legacy/
publish: build ## Publish to PyPI (reads UV_PUBLISH_TOKEN from .env)
@if [ -z "$$UV_PUBLISH_TOKEN" ]; then \
echo "❌ UV_PUBLISH_TOKEN not set. Add to .env file"; \
exit 1; \
fi
@echo "📦 Publishing to PyPI..."
uv publish
act-test: ## Test workflows with act (test job only)
act -j test --matrix os:ubuntu-latest --matrix python-version:3.11
act-lint: ## Test lint workflow with act
act -j lint
act-all: ## Test all workflows with act
act push
act-list: ## List all act jobs
act -l
pre-commit: ## Run pre-commit on all files
pre-commit run --all-files
pre-commit-update: ## Update pre-commit hooks
pre-commit autoupdate
prek-update: ## Auto-update pre-commit config to latest versions
AUTO_UV_DISABLE=1 uv run prek auto-update
prek-run: ## Run prek hooks
AUTO_UV_DISABLE=1 uv run prek run --all-files
prek-install: ## Install prek git hooks
AUTO_UV_DISABLE=1 uv run prek install
version-patch: ## Bump patch version (0.1.0 -> 0.1.1)
@echo "Bumping patch version..."
@CURRENT=$$(grep '^version = ' pyproject.toml | sed 's/version = "\(.*\)"/\1/'); \
echo "Current version: $$CURRENT"; \
read -p "Continue? [y/N] " -n 1 -r; \
echo; \
if [[ $$REPLY =~ ^[Yy]$$ ]]; then \
pip install bump2version; \
bump2version patch; \
fi
version-minor: ## Bump minor version (0.1.0 -> 0.2.0)
@echo "Bumping minor version..."
@CURRENT=$$(grep '^version = ' pyproject.toml | sed 's/version = "\(.*\)"/\1/'); \
echo "Current version: $$CURRENT"; \
read -p "Continue? [y/N] " -n 1 -r; \
echo; \
if [[ $$REPLY =~ ^[Yy]$$ ]]; then \
pip install bump2version; \
bump2version minor; \
fi
version-major: ## Bump major version (0.1.0 -> 1.0.0)
@echo "Bumping major version..."
@CURRENT=$$(grep '^version = ' pyproject.toml | sed 's/version = "\(.*\)"/\1/'); \
echo "Current version: $$CURRENT"; \
read -p "Continue? [y/N] " -n 1 -r; \
echo; \
if [[ $$REPLY =~ ^[Yy]$$ ]]; then \
pip install bump2version; \
bump2version major; \
fi
check: lint format-check test ## Run all checks (lint, format, test)
ci: clean pre-commit lint test build-check ## Run full CI pipeline locally
quick-test: format lint ## Quick format and lint (pre-commit)
@echo "✅ Quick checks passed!"
full-test: ci act-test ## Full local test including act
@echo "✅ All tests passed!"
# Development workflow shortcuts
dev: dev-install pre-commit ## Setup complete dev environment
@echo "✅ Development environment ready!"
commit: format lint test ## Format, lint, test before commit
@echo "✅ Ready to commit!"
@echo "Run: git add . && git commit -m 'Your message'"
release: clean build build-check ## Prepare release
@echo "✅ Release artifacts ready in dist/"
@echo "Next steps:"
@echo " 1. Test: pip install dist/*.whl"
@echo " 2. Push: git push origin main --tags"
@echo " 3. Publish: make publish-test OR make publish"