1- SHELL =/usr/bin/env bash
2- # Minimal Makefile for OpenHands V1
3-
4- # ANSI color codes
5- GREEN =$(shell tput -Txterm setaf 2)
6- YELLOW =$(shell tput -Txterm setaf 3)
7- BLUE =$(shell tput -Txterm setaf 6)
8- RESET =$(shell tput -Txterm sgr0)
9-
10- # Install all dependencies
11- install :
12- @echo " $( YELLOW) Installing dependencies with uv...$( RESET) "
1+ # OpenHands V1 Makefile
2+ # Minimal Makefile for OpenHands V1 using uv
3+
4+ # Colors for output
5+ GREEN := \033[32m
6+ YELLOW := \033[33m
7+ RED := \033[31m
8+ CYAN := \033[36m
9+ RESET := \033[0m
10+
11+ # Required uv version
12+ REQUIRED_UV_VERSION := 0.8.13
13+
14+ .PHONY : build format lint clean help check-uv-version
15+
16+ # Default target
17+ .DEFAULT_GOAL := help
18+
19+ # Check uv version
20+ check-uv-version :
21+ @echo " $( YELLOW) Checking uv version...$( RESET) "
22+ @UV_VERSION=$$(uv --version | cut -d' ' -f2 ) ; \
23+ REQUIRED_VERSION=$(REQUIRED_UV_VERSION ) ; \
24+ if [ " $$ (printf '%s\n' " $$ REQUIRED_VERSION" " $$ UV_VERSION" | sort -V | head -n1)" != " $$ REQUIRED_VERSION" ]; then \
25+ echo " $( RED) Error: uv version $$ UV_VERSION is less than required $$ REQUIRED_VERSION$( RESET) " ; \
26+ echo " $( YELLOW) Please update uv with: uv self update$( RESET) " ; \
27+ exit 1; \
28+ fi ; \
29+ echo " $( GREEN) uv version $$ UV_VERSION meets requirements$( RESET) "
30+
31+ # Main build target - setup everything
32+ build : check-uv-version
33+ @echo " $( CYAN) Setting up OpenHands V1 development environment...$( RESET) "
34+ @echo " $( YELLOW) Installing dependencies with uv sync --dev...$( RESET) "
1335 @uv sync --dev
1436 @echo " $( GREEN) Dependencies installed successfully.$( RESET) "
15-
16- # Setup pre-commit hooks
17- setup-hooks :
1837 @echo " $( YELLOW) Setting up pre-commit hooks...$( RESET) "
1938 @uv run pre-commit install
2039 @echo " $( GREEN) Pre-commit hooks installed successfully.$( RESET) "
40+ @echo " $( GREEN) Build complete! Development environment is ready.$( RESET) "
2141
2242# Format code using uv format
2343format :
2444 @echo " $( YELLOW) Formatting code with uv format...$( RESET) "
25- @uv run --with ruff ruff format .
45+ @uv format
2646 @echo " $( GREEN) Code formatted successfully.$( RESET) "
2747
2848# Lint code
2949lint :
3050 @echo " $( YELLOW) Linting code with ruff...$( RESET) "
31- @uv run ruff check .
51+ @uv run ruff check --fix
3252 @echo " $( GREEN) Linting completed.$( RESET) "
3353
34- # Run linting and formatting
35- check : lint format
36-
37- # Full setup: install deps and setup hooks
38- setup : install setup-hooks
39- @echo " $( GREEN) Setup completed successfully.$( RESET) "
40-
41- # Clean up cache and build artifacts
54+ # Clean up cache files
4255clean :
43- @echo " $( YELLOW) Cleaning up...$( RESET) "
44- @rm -rf .ruff_cache __pycache__ .pytest_cache
45- @find . -name " *.pyc" -delete
46- @find . -name " *.pyo " -delete
47- @echo " $( GREEN) Cleanup completed .$( RESET) "
56+ @echo " $( YELLOW) Cleaning up cache files ...$( RESET) "
57+ @find . -type d -name " __pycache__ " -exec rm -rf {} + 2> /dev/null || true
58+ @find . -type f - name " *.pyc" -delete 2> /dev/null || true
59+ @rm -rf .pytest_cache .ruff_cache .mypy_cache 2> /dev/null || true
60+ @echo " $( GREEN) Cache files cleaned .$( RESET) "
4861
49- # Help
62+ # Show help
5063help :
51- @echo " $( BLUE ) OpenHands V1 Makefile$( RESET) "
64+ @echo " $( CYAN ) OpenHands V1 Makefile$( RESET) "
5265 @echo " Available targets:"
53- @echo " $( GREEN) install$( RESET) - Install Python dependencies with uv"
54- @echo " $( GREEN) setup-hooks$( RESET) - Setup pre-commit hooks"
66+ @echo " $( GREEN) build$( RESET) - Setup development environment (install deps + hooks)"
5567 @echo " $( GREEN) format$( RESET) - Format code with uv format"
5668 @echo " $( GREEN) lint$( RESET) - Lint code with ruff"
57- @echo " $( GREEN) check$( RESET) - Run lint and format"
58- @echo " $( GREEN) setup$( RESET) - Full setup (install + hooks)"
5969 @echo " $( GREEN) clean$( RESET) - Clean up cache files"
60- @echo " $( GREEN) help$( RESET) - Show this help message"
61-
62- .PHONY : install setup-hooks format lint check setup clean help
70+ @echo " $( GREEN) help$( RESET) - Show this help message"
0 commit comments