- Python 3.11 or later
- Docker and Docker Compose
- uv (fast Python package installer)
- Install uv:
pip install uv- Clone the repository:
git clone git@github.com:loguntsovae/asyncflow.git
cd asyncflow- Create and activate a virtual environment:
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate- Install dependencies (with dev tools):
# Install base dependencies
uv pip install -e .
# Install development dependencies
uv pip install -e ".[dev]"- Copy environment example and adjust:
cp .env.example .env
# Edit .env with your settings- Start all services:
make up- Start specific service:
docker compose up api_gateway- View logs:
make logs
# Or for specific service:
docker compose logs -f api_gatewayRun all checks:
make qa # Runs format, lint, typecheck, and testIndividual checks:
make format # Format code with ruff
make lint # Check code with ruff
make typecheck # Run mypy type checking
make test # Run pytest suiteRun tests:
# All tests
pytest
# Specific test file
pytest src/tests/test_orders_api.py
# With coverage
pytest --cov=src- Add runtime dependency:
uv pip install package_name- Add development dependency:
uv pip install --group dev package_name- Update pyproject.toml accordingly:
[project]
dependencies = [
"package_name>=1.0.0,<2.0"
]
[dependency-groups]
dev = [
"dev-package>=1.0.0,<2.0"
]# Build all services
docker compose build
# Build specific service
docker compose build api_gateway# Build test image
docker build -t asyncflow-test -f order_service/Dockerfile .
# Run tests
docker run --rm asyncflow-test pytest- Set production configuration:
cp .env.example .env.prod
# Edit .env.prod with production settings- Deploy with Docker Compose:
docker compose -f docker-compose.yml -f docker-compose.prod.yml up -dAccess service metrics:
- API Gateway: http://localhost:9000/metrics
- Order Service: http://localhost:9001/metrics
Check service health:
- API Gateway: http://localhost:9000/health
- Order Service: http://localhost:9001/health
View structured logs:
# All services
docker compose logs -f | jq .
# Specific service
docker compose logs -f api_gateway | jq .- API Documentation: http://localhost:9000/api/v1/docs
- ReDoc Interface: http://localhost:9000/api/v1/redoc
- Use
uvfor faster dependency installation - Keep Docker images minimal with multi-stage builds
- Enable response compression for larger payloads
- Use connection pooling for database and HTTP clients
- Monitor and optimize based on metrics