|
|
.PHONY: help install dev clean test format lint status run notebook docker-build docker-run requirements update |
|
|
|
|
|
IMAGE_NAME := classify-text-with-bert-hate-speech |
|
|
IMAGE_TAG := local |
|
|
|
|
|
# Default target - show help |
|
|
.DEFAULT_GOAL := help |
|
|
|
|
|
.ONESHELL: |
|
|
|
|
|
help: |
|
|
@echo "Project - Available Commands:" |
|
|
@echo "" |
|
|
@echo " make install - Install production dependencies with uv" |
|
|
@echo " make dev - Install development dependencies with uv" |
|
|
@echo " make requirements- Generate requirements.txt from uv.lock" |
|
|
@echo " make update - Update all dependencies to latest versions" |
|
|
@echo " make run - Run the application (app.py)" |
|
|
@echo " make notebook - Launch jupyter notebook/lab" |
|
|
@echo " make test - Run tests (requires pytest)" |
|
|
@echo " make format - Format code (ruff or black if available)" |
|
|
@echo " make lint - Run linter (ruff if available)" |
|
|
@echo " make clean - Remove venv and build/test artifacts" |
|
|
@echo " make status - Show python version and installed packages summary" |
|
|
@echo " make docker-build- Build a local docker image" |
|
|
@echo " make docker-run - Run the docker image locally" |
|
|
@echo "" |
|
|
|
|
|
install: |
|
|
@echo "π¦ Installing production dependencies with uv..." |
|
|
uv sync |
|
|
@echo "β
Production dependencies installed successfully!" |
|
|
|
|
|
dev: |
|
|
@echo "π¦ Installing development dependencies with uv..." |
|
|
uv sync |
|
|
@echo "β
Development dependencies installed successfully!" |
|
|
|
|
|
requirements: update |
|
|
@echo "π Generating requirements.txt from uv.lock..." |
|
|
uv pip compile pyproject.toml -o requirements.txt |
|
|
@echo "β
requirements.txt generated successfully!" |
|
|
|
|
|
update: dev |
|
|
@echo "π Updating all dependencies to latest versions..." |
|
|
uv lock |
|
|
@echo "β
Dependencies updated! Run 'make install' or 'make dev' to apply changes." |
|
|
@echo "π‘ Tip: Run 'make requirements' to regenerate requirements.txt" |
|
|
|
|
|
run: |
|
|
@echo "Running app.py..." |
|
|
uv run python app.py |
|
|
|
|
|
notebook: |
|
|
@echo "Launching Jupyter Notebook (or lab if available)..." |
|
|
uv run jupyter lab || uv run jupyter notebook |
|
|
|
|
|
test: |
|
|
@echo "Running tests with pytest..." |
|
|
uv run pytest -q tests || true |
|
|
|
|
|
format: |
|
|
@echo "Formatting code with ruff..." |
|
|
uv run ruff format . || true |
|
|
-uv run ruff check |
|
|
|
|
|
lint: |
|
|
@echo "Running linter with ruff..." |
|
|
uv run ruff check . |
|
|
|
|
|
status: |
|
|
@uv run python |
|
|
@echo "Installed packages:" |
|
|
@uv pip list |
|
|
|
|
|
clean: |
|
|
@echo "π§Ή Cleaning up build and Python artifacts..." |
|
|
-rm -rf .venv build/ dist/ *.egg-info .eggs |
|
|
-find . -type d -name "__pycache__" -exec rm -rf {} + |
|
|
-find . -type f -name "*.py[co]" -delete |
|
|
-find . -type f -name ".coverage" -delete |
|
|
-find . -type d -name ".pytest_cache" -exec rm -rf {} + |
|
|
-find . -type d -name ".ruff_cache" -exec rm -rf {} + |
|
|
-find . -type d -name ".mypy_cache" -exec rm -rf {} + |
|
|
-find . -type d -name "htmlcov" -exec rm -rf {} + |
|
|
-find . -type f -name ".DS_Store" -delete |
|
|
@echo "β
Cleanup completed!" |
|
|
|
|
|
docker-build: |
|
|
@echo "Building docker image ${IMAGE_NAME}:${IMAGE_TAG} (requires Docker)" |
|
|
@docker build -t ${IMAGE_NAME}:${IMAGE_TAG} . || true |
|
|
|
|
|
docker-run: |
|
|
@echo "Running docker image ${IMAGE_NAME}:${IMAGE_TAG} (port 7860 forwarded)" |
|
|
@docker run |