2025-12-10 17:35:43 +01:00
|
|
|
# Supported Python versions
|
|
|
|
|
PYTHON_VERSIONS = 3.10 3.11 3.12 3.13 3.14
|
|
|
|
|
DEFAULT_PYTHON = 3.10
|
|
|
|
|
|
|
|
|
|
# Install dependencies
|
|
|
|
|
.PHONY: install
|
|
|
|
|
install:
|
|
|
|
|
@uv sync
|
|
|
|
|
@find . | grep -E "(__pycache__|\\.pyc|\\.pyo|\\.pytest_cache|\\.ruff_cache|\\.mypy_cache)" | xargs rm -rf
|
|
|
|
|
|
|
|
|
|
# Install dev dependencies
|
|
|
|
|
.PHONY: install-dev
|
|
|
|
|
install-dev:
|
|
|
|
|
@uv sync --extra dev
|
|
|
|
|
@find . | grep -E "(__pycache__|\\.pyc|\\.pyo|\\.pytest_cache|\\.ruff_cache|\\.mypy_cache)" | xargs rm -rf
|
|
|
|
|
|
|
|
|
|
# Update dependencies
|
|
|
|
|
.PHONY: lock
|
|
|
|
|
lock:
|
|
|
|
|
@uv lock
|
|
|
|
|
@find . | grep -E "(__pycache__|\\.pyc|\\.pyo|\\.pytest_cache|\\.ruff_cache|\\.mypy_cache)" | xargs rm -rf
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Upgrade dependencies
|
|
|
|
|
.PHONY: upgrade
|
|
|
|
|
upgrade:
|
|
|
|
|
@uv lock --upgrade
|
|
|
|
|
@uv sync --all-extras
|
|
|
|
|
@find . | grep -E "(__pycache__|\\.pyc|\\.pyo|\\.pytest_cache|\\.ruff_cache|\\.mypy_cache)" | xargs rm -rf
|
|
|
|
|
|
|
|
|
|
# Stop
|
|
|
|
|
.PHONY: stop
|
|
|
|
|
stop:
|
|
|
|
|
@docker compose down --rmi all --remove-orphans -v
|
|
|
|
|
@docker system prune -f
|
|
|
|
|
|
|
|
|
|
# Restart
|
|
|
|
|
.PHONY: restart
|
|
|
|
|
restart: stop start-example
|
|
|
|
|
|
|
|
|
|
# Lint code
|
|
|
|
|
.PHONY: lint
|
|
|
|
|
lint:
|
2025-12-13 13:43:25 +01:00
|
|
|
@echo 'Formatting w/ Ruff...' ; echo '' ; uv run ruff format .
|
|
|
|
|
@echo '' ; echo '' ; echo 'Linting w/ Ruff...' ; echo '' ; uv run ruff check .
|
|
|
|
|
@echo '' ; echo '' ; echo 'Type checking w/ Mypy...' ; echo '' ; uv run mypy .
|
|
|
|
|
@echo '' ; echo '' ; echo 'Finding dead code w/ Vulture...' ; echo '' ; uv run vulture vulture_whitelist.py
|
2025-12-10 17:35:43 +01:00
|
|
|
|
|
|
|
|
# Fix code
|
|
|
|
|
.PHONY: fix
|
|
|
|
|
fix:
|
|
|
|
|
@echo "Fixing formatting w/ Ruff..."
|
|
|
|
|
@echo ''
|
|
|
|
|
@uv run ruff check --fix .
|
|
|
|
|
@find . | grep -E "(__pycache__|\\.pyc|\\.pyo|\\.pytest_cache|\\.ruff_cache|\\.mypy_cache)" | xargs rm -rf
|
|
|
|
|
|
|
|
|
|
# Find dead code with Vulture
|
|
|
|
|
.PHONY: vulture
|
|
|
|
|
vulture:
|
|
|
|
|
@echo "Finding dead code with Vulture..."
|
|
|
|
|
@echo ''
|
|
|
|
|
# @uv run vulture
|
|
|
|
|
# @uv run vulture --verbose
|
|
|
|
|
@uv run vulture vulture_whitelist.py
|
|
|
|
|
@find . | grep -E "(__pycache__|\.pyc|\.pyo|\.pytest_cache|\.ruff_cache|\.mypy_cache)" | xargs rm -rf
|
|
|
|
|
|
|
|
|
|
# Security scan with Bandit
|
|
|
|
|
.PHONY: bandit
|
|
|
|
|
bandit:
|
|
|
|
|
@echo "Running Bandit security scan..."
|
|
|
|
|
@echo ''
|
2025-12-13 13:43:25 +01:00
|
|
|
@uv run bandit -r roboco -ll
|
2025-12-10 17:35:43 +01:00
|
|
|
@find . | grep -E "(__pycache__|\.pyc|\.pyo|\.pytest_cache|\.ruff_cache|\.mypy_cache)" | xargs rm -rf
|
|
|
|
|
|
|
|
|
|
# Check dependencies with Safety
|
|
|
|
|
.PHONY: safety
|
|
|
|
|
safety:
|
|
|
|
|
@echo "Checking dependencies with Safety..."
|
|
|
|
|
@echo ''
|
|
|
|
|
@uv run safety scan
|
|
|
|
|
@find . | grep -E "(__pycache__|\.pyc|\.pyo|\.pytest_cache|\.ruff_cache|\.mypy_cache)" | xargs rm -rf
|
|
|
|
|
|
|
|
|
|
# Audit dependencies with pip-audit
|
|
|
|
|
.PHONY: pip-audit
|
|
|
|
|
pip-audit:
|
|
|
|
|
@echo "Auditing dependencies with pip-audit..."
|
|
|
|
|
@echo ''
|
|
|
|
|
@uv run pip-audit
|
|
|
|
|
@find . | grep -E "(__pycache__|\.pyc|\.pyo|\.pytest_cache|\.ruff_cache|\.mypy_cache)" | xargs rm -rf
|
|
|
|
|
|
|
|
|
|
# Analyze code complexity with Radon
|
|
|
|
|
.PHONY: radon
|
|
|
|
|
radon:
|
|
|
|
|
@echo "Analyzing code complexity with Radon..."
|
|
|
|
|
@echo ''
|
|
|
|
|
@echo "Cyclomatic Complexity:"
|
2025-12-13 13:43:25 +01:00
|
|
|
@uv run radon cc roboco -nc
|
2025-12-10 17:35:43 +01:00
|
|
|
@echo ''
|
|
|
|
|
@echo "Maintainability Index:"
|
2025-12-13 13:43:25 +01:00
|
|
|
@uv run radon mi roboco -nc
|
2025-12-10 17:35:43 +01:00
|
|
|
@echo ''
|
|
|
|
|
@echo "Raw Metrics:"
|
2025-12-13 13:43:25 +01:00
|
|
|
@uv run radon raw roboco
|
2025-12-10 17:35:43 +01:00
|
|
|
@find . | grep -E "(__pycache__|\.pyc|\.pyo|\.pytest_cache|\.ruff_cache|\.mypy_cache)" | xargs rm -rf
|
|
|
|
|
|
|
|
|
|
# Check complexity thresholds with Xenon
|
|
|
|
|
.PHONY: xenon
|
|
|
|
|
xenon:
|
|
|
|
|
@echo "Checking complexity thresholds with Xenon..."
|
|
|
|
|
@echo ''
|
2025-12-13 13:43:25 +01:00
|
|
|
@uv run xenon roboco --max-absolute B --max-modules A --max-average A
|
2025-12-10 17:35:43 +01:00
|
|
|
@find . | grep -E "(__pycache__|\.pyc|\.pyo|\.pytest_cache|\.ruff_cache|\.mypy_cache)" | xargs rm -rf
|
|
|
|
|
|
|
|
|
|
# Analyze dependencies with Deptry
|
|
|
|
|
.PHONY: deptry
|
|
|
|
|
deptry:
|
|
|
|
|
@echo "Analyzing dependencies with Deptry..."
|
|
|
|
|
@echo ''
|
|
|
|
|
@uv run deptry .
|
|
|
|
|
@find . | grep -E "(__pycache__|\.pyc|\.pyo|\.pytest_cache|\.ruff_cache|\.mypy_cache)" | xargs rm -rf
|
|
|
|
|
|
|
|
|
|
# Static analysis with Semgrep
|
|
|
|
|
.PHONY: semgrep
|
|
|
|
|
semgrep:
|
|
|
|
|
@echo "Running Semgrep static analysis..."
|
|
|
|
|
@echo ''
|
2025-12-13 13:43:25 +01:00
|
|
|
@uv run semgrep --config=auto roboco
|
2025-12-10 17:35:43 +01:00
|
|
|
@find . | grep -E "(__pycache__|\.pyc|\.pyo|\.pytest_cache|\.ruff_cache|\.mypy_cache)" | xargs rm -rf
|
|
|
|
|
|
|
|
|
|
# Run all security checks
|
|
|
|
|
.PHONY: security
|
|
|
|
|
security: bandit safety pip-audit
|
|
|
|
|
@echo "All security checks completed."
|
|
|
|
|
|
|
|
|
|
# Run all code quality checks
|
|
|
|
|
.PHONY: quality
|
|
|
|
|
quality: lint vulture radon xenon
|
|
|
|
|
@echo "All code quality checks completed."
|
|
|
|
|
|
|
|
|
|
# Run all analysis tools
|
|
|
|
|
.PHONY: analysis
|
|
|
|
|
analysis: deptry semgrep
|
|
|
|
|
@echo "All analysis tools completed."
|
|
|
|
|
|
|
|
|
|
# Run all checks (linting, security, quality, and analysis)
|
|
|
|
|
.PHONY: check-all
|
|
|
|
|
check-all: lint security quality analysis
|
|
|
|
|
@echo "All checks completed."
|
|
|
|
|
|
|
|
|
|
# Run tests (default Python version)
|
|
|
|
|
.PHONY: test
|
|
|
|
|
test:
|
|
|
|
|
@COMPOSE_BAKE=true PYTHON_VERSION=$(DEFAULT_PYTHON) docker compose run --rm --build roboco pytest -v --cov=.
|
|
|
|
|
@docker compose down --rmi all --remove-orphans -v
|
|
|
|
|
@docker system prune -f
|
|
|
|
|
|
|
|
|
|
# Run All Python versions
|
|
|
|
|
.PHONY: test-all
|
|
|
|
|
test-all: test-3.10 test-3.11 test-3.12 test-3.13 test-3.14
|
|
|
|
|
|
|
|
|
|
# Python 3.10
|
|
|
|
|
.PHONY: test-3.10
|
|
|
|
|
test-3.10:
|
|
|
|
|
@docker compose down -v roboco
|
|
|
|
|
@COMPOSE_BAKE=true PYTHON_VERSION=3.10 docker compose build roboco
|
|
|
|
|
@PYTHON_VERSION=3.10 docker compose run --rm roboco pytest -v --cov=.
|
|
|
|
|
@docker compose down --rmi all --remove-orphans -v
|
|
|
|
|
@docker system prune -f
|
|
|
|
|
|
|
|
|
|
# Python 3.11
|
|
|
|
|
.PHONY: test-3.11
|
|
|
|
|
test-3.11:
|
|
|
|
|
@docker compose down -v roboco
|
|
|
|
|
@COMPOSE_BAKE=true PYTHON_VERSION=3.11 docker compose build roboco
|
|
|
|
|
@PYTHON_VERSION=3.11 docker compose run --rm roboco pytest -v --cov=.
|
|
|
|
|
@docker compose down --rmi all --remove-orphans -v
|
|
|
|
|
@docker system prune -f
|
|
|
|
|
|
|
|
|
|
# Python 3.12
|
|
|
|
|
.PHONY: test-3.12
|
|
|
|
|
test-3.12:
|
|
|
|
|
@docker compose down -v roboco
|
|
|
|
|
@COMPOSE_BAKE=true PYTHON_VERSION=3.12 docker compose build roboco
|
|
|
|
|
@PYTHON_VERSION=3.12 docker compose run --rm roboco pytest -v --cov=.
|
|
|
|
|
@docker compose down --rmi all --remove-orphans -v
|
|
|
|
|
@docker system prune -f
|
|
|
|
|
|
|
|
|
|
# Python 3.13
|
|
|
|
|
.PHONY: test-3.13
|
|
|
|
|
test-3.13:
|
|
|
|
|
@docker compose down -v roboco
|
|
|
|
|
@COMPOSE_BAKE=true PYTHON_VERSION=3.13 docker compose build roboco
|
|
|
|
|
@PYTHON_VERSION=3.13 docker compose run --rm roboco pytest -v --cov=.
|
|
|
|
|
@docker compose down --rmi all --remove-orphans -v
|
|
|
|
|
@docker system prune -f
|
|
|
|
|
|
|
|
|
|
# Python 3.14
|
|
|
|
|
.PHONY: test-3.14
|
|
|
|
|
test-3.14:
|
|
|
|
|
@docker compose down -v roboco
|
|
|
|
|
@COMPOSE_BAKE=true PYTHON_VERSION=3.14 docker compose build roboco
|
|
|
|
|
@PYTHON_VERSION=3.14 docker compose run --rm roboco pytest -v --cov=.
|
|
|
|
|
@docker compose down --rmi all --remove-orphans -v
|
|
|
|
|
@docker system prune -f
|
|
|
|
|
|
|
|
|
|
# Stress Test
|
|
|
|
|
.PHONY: stress-test
|
|
|
|
|
stress-test:
|
|
|
|
|
@COMPOSE_BAKE=true docker compose up --build -d roboco-example redis
|
|
|
|
|
@echo "Waiting for services to start up..."
|
|
|
|
|
@sleep 5
|
|
|
|
|
@docker compose run --rm roboco-example uv run python examples/testing/stress_test.py --url http://roboco-example:8000 --duration 120 --concurrency 50 --ramp-up 10 --delay 0.02 --test-type standard -v
|
|
|
|
|
@docker compose down --rmi all --remove-orphans -v
|
|
|
|
|
@docker system prune -f
|
|
|
|
|
|
|
|
|
|
# High-load stress test
|
|
|
|
|
.PHONY: high-load-stress-test
|
|
|
|
|
high-load-stress-test:
|
|
|
|
|
@COMPOSE_BAKE=true docker compose up --build -d roboco-example redis
|
|
|
|
|
@echo "Waiting for services to start up..."
|
|
|
|
|
@sleep 5
|
|
|
|
|
@docker compose run --rm roboco-example uv run python examples/testing/stress_test.py --url http://roboco-example:8000 --duration 180 --concurrency 100 --ramp-up 15 --delay 0.01 --test-type high_load -v
|
|
|
|
|
@docker compose down --rmi all --remove-orphans -v
|
|
|
|
|
@docker system prune -f
|
|
|
|
|
|
|
|
|
|
# Serve docs
|
|
|
|
|
.PHONY: serve-docs
|
|
|
|
|
serve-docs:
|
|
|
|
|
@uv run mkdocs serve
|
|
|
|
|
@find . | grep -E "(__pycache__|\\.pyc|\\.pyo|\\.pytest_cache|\\.ruff_cache|\\.mypy_cache)" | xargs rm -rf
|
|
|
|
|
|
|
|
|
|
# Lint documentation
|
|
|
|
|
.PHONY: lint-docs
|
|
|
|
|
lint-docs:
|
2025-12-13 13:43:25 +01:00
|
|
|
@uv run pymarkdownlnt scan -r -e ./.venv -e ./.git -e ./.github -e ./roboco -e ./tests -e ./.claude -e ./CLAUDE.md -e ./ZZZ .
|
2025-12-10 17:35:43 +01:00
|
|
|
@find . | grep -E "(__pycache__|\\.pyc|\\.pyo|\\.pytest_cache|\\.ruff_cache|\\.mypy_cache)" | xargs rm -rf
|
|
|
|
|
|
|
|
|
|
# Fix documentation
|
|
|
|
|
.PHONY: fix-docs
|
|
|
|
|
fix-docs:
|
2025-12-13 13:43:25 +01:00
|
|
|
@uv run pymarkdownlnt fix -r -e ./.venv -e ./.git -e ./.github -e ./roboco -e ./tests -e ./.claude -e ./CLAUDE.md -e ./ZZZ .
|
2025-12-10 17:35:43 +01:00
|
|
|
@find . | grep -E "(__pycache__|\\.pyc|\\.pyo|\\.pytest_cache|\\.ruff_cache|\\.mypy_cache)" | xargs rm -rf
|
|
|
|
|
|
|
|
|
|
# Prune
|
|
|
|
|
.PHONY: prune
|
|
|
|
|
prune:
|
|
|
|
|
@docker system prune -f
|
|
|
|
|
|
|
|
|
|
# Clean Cache Files
|
|
|
|
|
.PHONY: clean
|
|
|
|
|
clean:
|
|
|
|
|
@find . | grep -E "(__pycache__|\\.pyc|\\.pyo|\\.pytest_cache|\\.ruff_cache|\\.mypy_cache)" | xargs rm -rf
|
|
|
|
|
|
|
|
|
|
# Help
|
|
|
|
|
.PHONY: help
|
|
|
|
|
help:
|
|
|
|
|
@echo "Available commands:"
|
|
|
|
|
@echo " make install - Install dependencies"
|
|
|
|
|
@echo " make install-dev - Install dev dependencies"
|
|
|
|
|
@echo " make lock - Update dependencies"
|
|
|
|
|
@echo " make start-example - Start example application with docker compose"
|
|
|
|
|
@echo " make run-example - Build and run example container directly"
|
|
|
|
|
@echo " make stop - Stop all containers and clean up resources"
|
|
|
|
|
@echo " make restart - Restart example application"
|
|
|
|
|
@echo " make lint - Run linting checks"
|
|
|
|
|
@echo " make fix - Auto-fix linting issues"
|
|
|
|
|
@echo " make vulture - Find dead code with Vulture"
|
|
|
|
|
@echo " make bandit - Run Bandit security scan"
|
|
|
|
|
@echo " make safety - Check dependencies with Safety"
|
|
|
|
|
@echo " make pip-audit - Audit dependencies with pip-audit"
|
|
|
|
|
@echo " make radon - Analyze code complexity with Radon"
|
|
|
|
|
@echo " make xenon - Check complexity thresholds with Xenon"
|
|
|
|
|
@echo " make deptry - Analyze dependencies with Deptry"
|
|
|
|
|
@echo " make semgrep - Run Semgrep static analysis"
|
|
|
|
|
@echo " make security - Run all security checks"
|
|
|
|
|
@echo " make quality - Run all code quality checks"
|
|
|
|
|
@echo " make analysis - Run all analysis tools"
|
|
|
|
|
@echo " make check-all - Run all checks (lint, security, quality, analysis)"
|
|
|
|
|
@echo " make test - Run tests with Python $(DEFAULT_PYTHON)"
|
|
|
|
|
@echo " make test-all - Run tests with all Python versions ($(PYTHON_VERSIONS))"
|
|
|
|
|
@echo " make test-<version> - Run tests with specific Python version (e.g., make test-3.10)"
|
|
|
|
|
@echo " make local-test - Run tests locally"
|
|
|
|
|
@echo " make stress-test - Run stress test"
|
|
|
|
|
@echo " make high-load-stress-test - Run high-load stress test"
|
|
|
|
|
@echo " make serve-docs - Serve documentation"
|
|
|
|
|
@echo " make lint-docs - Run markdownlint on documentation"
|
|
|
|
|
@echo " make fix-docs - Auto-fix markdownlint issues"
|
|
|
|
|
@echo " make prune - Prune docker resources"
|
|
|
|
|
@echo " make clean - Clean cache files"
|
|
|
|
|
@echo " make help - Show this help message"
|
|
|
|
|
@echo " make show-python-versions - Show supported Python versions"
|
|
|
|
|
|
|
|
|
|
# Python versions list
|
|
|
|
|
.PHONY: show-python-versions
|
|
|
|
|
show-python-versions:
|
|
|
|
|
@echo "Supported Python versions: $(PYTHON_VERSIONS)"
|
|
|
|
|
@echo "Default Python version: $(DEFAULT_PYTHON)"
|