๐ฆ UV & Python Makefile Example
UV = uv
HF_HOME = /sgoinfre/sarfreit/hf_cache
FUNCTIONS = data/input/functions_definition.json
INPUT = data/input/function_calling_tests.json
OUTPUT = data/output/function_calling_results.json
export HF_HOME
all: install run
# INSTALL ALL REQUIREMENTS
install:
@if command -v uv >/dev/null 2>&1; then \
echo "โ
uv is already installed ($$(uv --version))"; \
elif [ -f "$$HOME/.local/bin/uv" ]; then \
echo "โ
uv found in $$HOME/.local/bin"; \
else \
echo "๐ฆ uv not found. Installing..."; \
curl -LsSf https://astral.sh/uv/install.sh | sh; \
fi
@echo "๐ฆ Syncing dependencies..."
@PATH="$$HOME/.local/bin:$$PATH" uv sync
@echo "โ
Dependencies ready"
# RUN THE PROGRAM
run:
@$(UV) run python -m src \
--functions_definition $(FUNCTIONS) \
--input $(INPUT) \
--output $(OUTPUT)
run-verbose:
@$(UV) run python -m src \
--functions_definition $(FUNCTIONS) \
--input $(INPUT) \
--output $(OUTPUT) \
--verbose
# DEBUG AND HELP
debug:
@$(UV) run python -m pdb -m src \
--functions_definition $(FUNCTIONS) \
--input $(INPUT) \
--output $(OUTPUT)
help:
@echo ""
@echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
@echo "โ Call Me Maybe โ Make Commands โ"
@echo "โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ"
@echo ""
@echo " ๐ฆ make install Install project dependencies"
@echo " โถ๏ธ make run Run with default settings"
@echo " ๐ make run-verbose Run with detailed generation trace"
@echo " ๐ make debug Run with Python's pdb debugger"
@echo ""
@echo " โ
make lint Run flake8 and mypy checks"
@echo " ๐ง make lint-strict Run stricter mypy checks"
@echo ""
@echo " ๐งน make clean Remove cache files"
@echo " ๐ฃ make fclean Remove cache + Output files + virtual environment"
@echo " ๐ make re Full clean and reinstall"
@echo ""
@echo " โน๏ธ Program-specific options running with run python -m src ... (--model, --verbose, etc.):"
@echo ""
@$(UV) run python -m src --help
# CHECK FOR NORM ERRORS
lint:
@echo "๐ Running flake8 and mypy..."
@$(UV) run flake8 .
@$(UV) run mypy . \
--warn-return-any \
--warn-unused-ignores \
--ignore-missing-imports \
--disallow-untyped-defs \
--check-untyped-defs
@echo "โ
Lint completed"
lint-strict:
@echo "๐ง Running strict checks..."
@$(UV) run flake8 .
@$(UV) run mypy . --strict
@echo "โ
Strict lint completed"
# CLEANERS
# CLEANERS
clean:
@echo "\n๐งน Cleaning cache files..."
@find . -type d -name "__pycache__" -exec rm -rf {} +
@find . -type f -name "*.pyc" -delete
@echo "\n๐งน Cleaning generated output..."
@rm -f data/output/*.json
@echo "\nโ
Partial clean complete\n"
fclean: clean
@echo "\n๐ฃ Removing virtual environment..."
@rm -rf .venv
@echo "\nโ
Full clean complete\n"
re: fclean install
.PHONY: all install run debug lint lint-strict clean fclean re