first
This commit is contained in:
66
makefile
Normal file
66
makefile
Normal file
@@ -0,0 +1,66 @@
|
||||
.PHONY: help install dev run test lint format migrate init-db clean docker-up docker-down
|
||||
|
||||
help:
|
||||
@echo "Available commands:"
|
||||
@echo " make install - Install dependencies"
|
||||
@echo " make dev - Run development server"
|
||||
@echo " make run - Run production server"
|
||||
@echo " make test - Run tests"
|
||||
@echo " make lint - Run linters"
|
||||
@echo " make format - Format code"
|
||||
@echo " make init-db - Initialize database"
|
||||
@echo " make migrate - Run migrations"
|
||||
@echo " make docker-up - Start Docker containers"
|
||||
@echo " make docker-down - Stop Docker containers"
|
||||
@echo " make clean - Clean cache files"
|
||||
|
||||
install:
|
||||
pip install -r requirements.txt
|
||||
pip install -r requirements-dev.txt
|
||||
|
||||
dev:
|
||||
uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload
|
||||
|
||||
run:
|
||||
uvicorn app.main:app --host 0.0.0.0 --port 8000 --workers 4
|
||||
|
||||
test:
|
||||
pytest tests/ -v --cov=app --cov-report=term-missing
|
||||
|
||||
test-watch:
|
||||
ptw -- --testmon
|
||||
|
||||
lint:
|
||||
flake8 app/ tests/ --max-line-length=120
|
||||
mypy app/ --ignore-missing-imports
|
||||
black app/ tests/ --check
|
||||
|
||||
format:
|
||||
black app/ tests/ --line-length=120
|
||||
isort app/ tests/ --profile black
|
||||
|
||||
init-db:
|
||||
python scripts/init_db.py
|
||||
|
||||
migrate:
|
||||
alembic upgrade head
|
||||
|
||||
migration:
|
||||
alembic revision --autogenerate -m "$(name)"
|
||||
|
||||
docker-up:
|
||||
docker-compose -f docker-compose.yml up -d
|
||||
|
||||
docker-down:
|
||||
docker-compose -f docker-compose.yml down
|
||||
|
||||
docker-logs:
|
||||
docker-compose -f docker-compose.yml logs -f app
|
||||
|
||||
clean:
|
||||
find . -type d -name "__pycache__" -exec rm -rf {} +
|
||||
find . -type d -name "*.pyc" -delete
|
||||
find . -type d -name ".pytest_cache" -exec rm -rf {} +
|
||||
find . -type d -name ".mypy_cache" -exec rm -rf {} +
|
||||
find . -type d -name ".coverage" -delete
|
||||
rm -rf .pytest_cache .mypy_cache .coverage htmlcov
|
||||
Reference in New Issue
Block a user