-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathMakefile
More file actions
145 lines (128 loc) · 4.13 KB
/
Makefile
File metadata and controls
145 lines (128 loc) · 4.13 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
.PHONY: help install install-dev test lint format clean setup-venv pre-commit
# Default target
help:
@echo "VisDrone Toolkit - Available Commands:"
@echo ""
@echo "Setup & Installation:"
@echo " make setup-venv - Create virtual environment"
@echo " make install - Install package in virtualenv"
@echo " make install-dev - Install package with dev dependencies"
@echo ""
@echo "Development:"
@echo " make test - Run tests with pytest"
@echo " make lint - Run linters (flake8, mypy)"
@echo " make format - Format code (black, isort)"
@echo " make format-check - Check code formatting without changes"
@echo ""
@echo "Pre-commit Hooks:"
@echo " make pre-commit-install - Install pre-commit hooks"
@echo " make pre-commit-run - Run pre-commit on all files"
@echo " make pre-commit-update - Update pre-commit hook versions"
@echo ""
@echo "Cleaning:"
@echo " make clean - Remove build artifacts and cache"
@echo " make clean-all - Remove everything including venv"
@echo ""
@echo "Quick Start:"
@echo " make setup-venv - Create virtual environment"
@echo " source venv/bin/activate"
@echo " make install-dev - Install with dev dependencies"
@echo " make pre-commit-install - Setup pre-commit hooks"
# Create virtual environment
setup-venv:
@echo "Creating virtual environment..."
python3 -m venv venv
@echo "✓ Virtual environment created in ./venv"
@echo ""
@echo "Activate it with:"
@echo " source venv/bin/activate # Linux/Mac"
@echo " venv\\Scripts\\activate # Windows"
# Install package
install:
pip install --upgrade pip
pip install -e .
@echo "✓ Package installed successfully"
# Install with development dependencies
install-dev:
pip install --upgrade pip
pip install -e ".[dev]"
@echo "✓ Package installed with dev dependencies"
@echo ""
@echo "Setup pre-commit hooks with:"
@echo " pre-commit install"
# Run tests
test:
pytest tests/ -v --cov=visdrone_toolkit --cov-report=term-missing
# Run linters
lint:
@echo "Running flake8..."
flake8 visdrone_toolkit scripts tests
@echo "Running mypy..."
mypy visdrone_toolkit scripts
# Format code
format:
@echo "Formatting with black..."
black visdrone_toolkit scripts tests
@echo "Sorting imports with isort..."
isort visdrone_toolkit scripts tests
@echo "✓ Code formatted"
# Check formatting without making changes
format-check:
black --check visdrone_toolkit scripts tests
isort --check-only visdrone_toolkit scripts tests
# Clean build artifacts
clean:
@echo "Cleaning build artifacts..."
rm -rf build/
rm -rf dist/
rm -rf *.egg-info
rm -rf .eggs/
find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
find . -type f -name "*.pyc" -delete
find . -type f -name "*.pyo" -delete
find . -type f -name "*~" -delete
rm -rf .pytest_cache/
rm -rf .mypy_cache/
rm -rf .coverage
rm -rf htmlcov/
@echo "✓ Cleaned"
# Clean everything including virtualenv
clean-all: clean
@echo "Removing virtual environment..."
rm -rf venv/
@echo "✓ Everything cleaned"
# Build distribution packages
build:
python -m pip install --upgrade build
python -m build
@echo "✓ Distribution packages built in dist/"
# Upload to PyPI (test)
upload-test: build
python -m pip install --upgrade twine
python -m twine upload --repository testpypi dist/*
# Upload to PyPI (production)
upload: build
python -m pip install --upgrade twine
python -m twine upload dist/*
# Pre-commit hooks
pre-commit-install:
@echo "Installing pre-commit hooks..."
pip install pre-commit
pre-commit install
pre-commit install --hook-type commit-msg
@echo "✓ Pre-commit hooks installed"
@echo ""
@echo "Hooks will now run automatically on git commit"
@echo "Run 'make pre-commit-run' to check all files now"
pre-commit-run:
@echo "Running pre-commit on all files..."
pre-commit run --all-files
pre-commit-update:
@echo "Updating pre-commit hooks to latest versions..."
pre-commit autoupdate
@echo "✓ Pre-commit hooks updated"
pre-commit-uninstall:
@echo "Uninstalling pre-commit hooks..."
pre-commit uninstall
pre-commit uninstall --hook-type commit-msg
@echo "✓ Pre-commit hooks uninstalled"