Skip to content

Commit d101445

Browse files
committed
Add minimal Makefile with uv and pre-commit setup
- Add Makefile with uv sync --dev for dependency management - Add pre-commit hooks that run uv format on every commit - Add pre-commit dependency to dev group
1 parent 54a78d5 commit d101445

File tree

4 files changed

+200
-0
lines changed

4 files changed

+200
-0
lines changed

.pre-commit-config.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
repos:
2+
- repo: local
3+
hooks:
4+
- id: uv-format
5+
name: Format with uv format
6+
entry: uv
7+
args: [run, --with, ruff, ruff, format, --diff]
8+
language: system
9+
types: [python]
10+
pass_filenames: false
11+
always_run: true
12+
- id: uv-check
13+
name: Lint with ruff
14+
entry: uv
15+
args: [run, ruff, check, --fix]
16+
language: system
17+
types: [python]
18+
pass_filenames: false
19+
always_run: true

Makefile

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
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)"
13+
@uv sync --dev
14+
@echo "$(GREEN)Dependencies installed successfully.$(RESET)"
15+
16+
# Setup pre-commit hooks
17+
setup-hooks:
18+
@echo "$(YELLOW)Setting up pre-commit hooks...$(RESET)"
19+
@uv run pre-commit install
20+
@echo "$(GREEN)Pre-commit hooks installed successfully.$(RESET)"
21+
22+
# Format code using uv format
23+
format:
24+
@echo "$(YELLOW)Formatting code with uv format...$(RESET)"
25+
@uv run --with ruff ruff format .
26+
@echo "$(GREEN)Code formatted successfully.$(RESET)"
27+
28+
# Lint code
29+
lint:
30+
@echo "$(YELLOW)Linting code with ruff...$(RESET)"
31+
@uv run ruff check .
32+
@echo "$(GREEN)Linting completed.$(RESET)"
33+
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
42+
clean:
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)"
48+
49+
# Help
50+
help:
51+
@echo "$(BLUE)OpenHands V1 Makefile$(RESET)"
52+
@echo "Available targets:"
53+
@echo " $(GREEN)install$(RESET) - Install Python dependencies with uv"
54+
@echo " $(GREEN)setup-hooks$(RESET) - Setup pre-commit hooks"
55+
@echo " $(GREEN)format$(RESET) - Format code with uv format"
56+
@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)"
59+
@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

pyproject.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,9 @@ dependencies = [
99
"litellm>=1.75.9",
1010
"pydantic>=2.11.7",
1111
]
12+
13+
[dependency-groups]
14+
dev = [
15+
"pre-commit>=4.3.0",
16+
"ruff>=0.12.10",
17+
]

uv.lock

Lines changed: 113 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)