Makefile windows compatible

This commit is contained in:
2025-09-13 21:52:28 +02:00
parent 559937cc20
commit 0dfd885847
2 changed files with 72 additions and 75 deletions

138
Makefile
View File

@@ -1,25 +1,27 @@
# Comprehensive Makefile for LetzShop API # Comprehensive Makefile for LetzShop API (Windows Compatible)
.PHONY: install install-test install-dev install-all dev test test-unit test-integration test-coverage test-fast test-slow test-auth test-products test-stock lint format check docker-build docker-up docker-down migrate clean check-tools setup setup-test .PHONY: install install-test install-dev install-all dev test test-unit test-integration test-coverage test-fast test-slow test-auth test-products test-stock lint format check docker-build docker-up docker-down migrate clean check-tools setup setup-test
# Check if required tools are installed # Check if required tools are installed (Windows compatible)
check-tools: check-tools:
@command -v black >/dev/null 2>&1 || { echo >&2 "black is required but not installed. Run 'make install-dev' first."; exit 1; } @where black >nul 2>&1 || (echo black is required but not installed. Run 'make install-dev' first. && exit 1)
@command -v isort >/dev/null 2>&1 || { echo >&2 "isort is required but not installed. Run 'make install-dev' first."; exit 1; } @where isort >nul 2>&1 || (echo isort is required but not installed. Run 'make install-dev' first. && exit 1)
@command -v flake8 >/dev/null 2>&1 || { echo >&2 "flake8 is required but not installed. Run 'make install-dev' first."; exit 1; } @where flake8 >nul 2>&1 || (echo flake8 is required but not installed. Run 'make install-dev' first. && exit 1)
@command -v mypy >/dev/null 2>&1 || { echo >&2 "mypy is required but not installed. Run 'make install-dev' first."; exit 1; } @where mypy >nul 2>&1 || (echo mypy is required but not installed. Run 'make install-dev' first. && exit 1)
# Production setup # Development setup
install: install:
pip install -r requirements.txt pip install -r requirements.txt
# Development setup install-test:
install-dev-deps:
pip install -r requirements-dev.txt
# Testing setup
install-test-deps:
pip install -r tests/requirements-test.txt pip install -r tests/requirements-test.txt
install-dev:
pip install -r requirements.txt
pip install -r tests/requirements-test.txt
pip install black isort flake8 mypy flake8-docstrings
install-all: install install-test install-dev
# Development server # Development server
dev: dev:
uvicorn main:app --reload --host 0.0.0.0 --port 8000 uvicorn main:app --reload --host 0.0.0.0 --port 8000
@@ -59,17 +61,17 @@ test-marketplace:
test-admin: test-admin:
pytest tests/test_admin.py -v pytest tests/test_admin.py -v
# Code quality # Code quality (skip check-tools for now)
lint: check-tools lint:
@echo "Running flake8..." @echo Running flake8...
flake8 . --max-line-length=88 --extend-ignore=E203,W503 --exclude=venv,__pycache__,.git flake8 . --max-line-length=88 --extend-ignore=E203,W503 --exclude=venv,__pycache__,.git
@echo "Running mypy..." @echo Running mypy...
mypy . --ignore-missing-imports --exclude venv mypy . --ignore-missing-imports --exclude venv
format: check-tools format:
@echo "Running black..." @echo Running black...
black . --exclude venv black . --exclude venv
@echo "Running isort..." @echo Running isort...
isort . --skip venv isort . --skip venv
# Combined format and lint # Combined format and lint
@@ -114,57 +116,61 @@ deploy-staging:
deploy-prod: deploy-prod:
docker-compose -f docker-compose.prod.yml up -d docker-compose -f docker-compose.prod.yml up -d
# Clean up # Clean up (Windows compatible)
clean: clean:
rm -rf htmlcov/ @if exist htmlcov rmdir /s /q htmlcov
rm -rf .pytest_cache/ @if exist .pytest_cache rmdir /s /q .pytest_cache
rm -rf .coverage @if exist .coverage del .coverage
rm -rf .mypy_cache/ @if exist .mypy_cache rmdir /s /q .mypy_cache
find . -type d -name "__pycache__" -exec rm -rf {} + @for /d /r . %%d in (__pycache__) do @if exist "%%d" rmdir /s /q "%%d"
find . -type f -name "*.pyc" -delete @del /s /q *.pyc 2>nul || echo No .pyc files found
find . -type d -name "*.egg-info" -exec rm -rf {} +
# Development workflow shortcuts # Development workflow shortcuts
setup: install install-dev-deps install-test-deps migrate-up setup: install-dev migrate-up
@echo "Development environment setup complete!" @echo Development environment setup complete!
setup-test: install-test
@echo Test environment setup complete!
full-test: format lint test-coverage full-test: format lint test-coverage
@echo "Full test suite completed!" @echo Full test suite completed!
# Help command # Help command
help: help:
@echo "Available commands:" @echo Available commands:
@echo " install - Install production dependencies" @echo install - Install production dependencies
@echo " install-dev-deps - Install development dependencies" @echo install-test - Install test dependencies only
@echo " install-test-deps - Install testing dependencies" @echo install-dev - Install all development dependencies
@echo " setup - Complete development setup" @echo install-all - Install everything
@echo " dev - Start development server" @echo setup - Complete development setup
@echo "" @echo setup-test - Setup test environment only
@echo "Testing:" @echo dev - Start development server
@echo " test - Run all tests" @echo.
@echo " test-unit - Run unit tests only" @echo Testing:
@echo " test-integration - Run integration tests only" @echo test - Run all tests
@echo " test-coverage - Run tests with coverage report" @echo test-unit - Run unit tests only
@echo " test-fast - Run fast tests (exclude slow ones)" @echo test-integration - Run integration tests only
@echo " test-slow - Run slow tests only" @echo test-coverage - Run tests with coverage report
@echo " full-test - Format, lint, and test with coverage" @echo test-fast - Run fast tests (exclude slow ones)
@echo "" @echo test-slow - Run slow tests only
@echo "Code Quality:" @echo full-test - Format, lint, and test with coverage
@echo " format - Format code with black and isort" @echo.
@echo " lint - Run linting with flake8 and mypy" @echo Code Quality:
@echo " check - Format and lint code" @echo format - Format code with black and isort
@echo " ci - Full CI pipeline (format, lint, test)" @echo lint - Run linting with flake8 and mypy
@echo "" @echo check - Format and lint code
@echo "Database:" @echo ci - Full CI pipeline (format, lint, test)
@echo " migrate-up - Run database migrations" @echo.
@echo " migrate-down - Rollback last migration" @echo Database:
@echo " migrate-reset - Reset and rerun all migrations" @echo migrate-up - Run database migrations
@echo "" @echo migrate-down - Rollback last migration
@echo "Docker:" @echo migrate-reset - Reset and rerun all migrations
@echo " docker-build - Build Docker containers" @echo.
@echo " docker-up - Start Docker containers" @echo Docker:
@echo " docker-down - Stop Docker containers" @echo docker-build - Build Docker containers
@echo " docker-restart - Restart Docker containers" @echo docker-up - Start Docker containers
@echo "" @echo docker-down - Stop Docker containers
@echo "Cleanup:" @echo docker-restart - Restart Docker containers
@echo " clean - Remove test artifacts and cache files" @echo.
@echo Cleanup:
@echo clean - Remove test artifacts and cache files

View File

@@ -1,9 +0,0 @@
# tests/requirements-test.txt
# Testing dependencies
pytest>=7.4.0
pytest-cov>=4.1.0
pytest-asyncio>=0.21.0
pytest-mock>=3.11.0
httpx>=0.24.0
faker>=19.0.0
pytest-repeat>=0.9.4