MAPtm's Mail Micro Service - Specificaties
De MMMS Backend is gebouwd met Python en maakt gebruik van diverse libraries voor AWS integratie, database toegang, data validatie en email verzending. Alle dependencies zijn productie-ready en worden actief onderhouden.
Python Versie
Section titled “Python Versie”Vereist: Python 3.12 of hoger
De applicatie is getest en geoptimaliseerd voor Python 3.12+, met ondersteuning voor moderne Python features zoals type hints, union types (|) en Pydantic v3^.
Productie Dependencies
Section titled “Productie Dependencies”AWS & Serverless
Section titled “AWS & Serverless”Chalice (>=1.26.0)
Section titled “Chalice (>=1.26.0)”Gebruik: Serverless framework voor AWS Lambda en API Gateway
- Biedt routing en HTTP request handling
- Automatische deployment naar AWS
- Middleware ondersteuning voor cross-cutting concerns
- Built-in CORS configuratie
- SQS event handling
Waarom deze versie:
- Versie 1.26.0+ biedt verbeterde middleware ondersteuning
- Stabiele API voor productie gebruik
- Ondersteuning voor SQS message processing
Boto3 (>=1.34.0)
Section titled “Boto3 (>=1.34.0)”Gebruik: AWS SDK voor Python
- SES integratie voor email verzending
- SQS integratie voor message queues
- Secrets Manager voor beveiligde credential opslag
- CloudWatch Logs voor logging
Waarom deze versie:
- Versie 1.34.0+ bevat de nieuwste AWS service features
- Verbeterde error handling en retry logic
- Ondersteuning voor SES v2 API
Botocore (>=1.34.0)
Section titled “Botocore (>=1.34.0)”Gebruik: Low-level AWS service client
- Basis voor Boto3 functionaliteit
- HTTP client en retry logic
- Request/response serialization
Waarom deze versie:
- Versie 1.34.0+ biedt verbeterde performance
- Compatibel met Boto3 1.34.0+
Database
Section titled “Database”psycopg2-binary (>=2.9.0)
Section titled “psycopg2-binary (>=2.9.0)”Gebruik: PostgreSQL database adapter
- Native PostgreSQL connecties
- Prepared statements voor SQL injection preventie
- Connection pooling ondersteuning
- JSONB datatype ondersteuning
Waarom deze versie:
- Binary distributie voor eenvoudige installatie zonder C compiler
- Versie 2.9.0+ biedt verbeterde performance en stabiliteit
- Lambda-compatible binary distributie
Data Validatie
Section titled “Data Validatie”Pydantic (>=2.0.0)
Section titled “Pydantic (>=2.0.0)”Gebruik: Data validatie en settings management
- Request/response model validatie
- Type checking en runtime validatie
- Automatische JSON serialization/deserialization
- Clear error messages voor validatiefouten
- Email validatie met email-validator
Waarom deze versie:
- Versie 2.0+ biedt significant betere performance
- Verbeterde type hints en IDE ondersteuning
- Modernere API met Python 3.12+ features
- Backwards incompatible met v1, maar veel sneller
email-validator
Section titled “email-validator”Gebruik: Email adres validatie
- RFC-compliant email validatie
- DNS checks voor email domein validatie
- Integratie met Pydantic voor model validatie
- Ondersteuning voor internationale email adressen
Waarom deze versie:
- Standaard versie biedt voldoende validatie functionaliteit
- Geen specifieke versie vereist voor basis functionaliteit
- Integreert naadloos met Pydantic EmailStr
HTTP Clients
Section titled “HTTP Clients”requests (>=2.31.0)
Section titled “requests (>=2.31.0)”Gebruik: Synchrone HTTP requests
- API calls naar externe services
- Eenvoudige interface voor HTTP operaties
- Session management voor persistent connections
- Retry logic en error handling
Waarom deze versie:
- Versie 2.31.0+ bevat belangrijke security fixes
- Industrie-standaard voor synchrone HTTP requests
- Uitgebreide community ondersteuning
Development Dependencies
Section titled “Development Dependencies”Testing
Section titled “Testing”pytest (>=8.0.0)
Section titled “pytest (>=8.0.0)”Gebruik: Unit en integration testing
- Test discovery en uitvoering
- Fixture ondersteuning
- Parameterized testing
- Coverage reporting
Waarom deze versie:
- Versie 8.0+ biedt verbeterde performance
- Betere error reporting en debugging
- Ondersteuning voor moderne Python features
pytest-mock (>=3.12.0)
Section titled “pytest-mock (>=3.12.0)”Gebruik: Mocking voor tests
- Mock objecten voor externe dependencies
- Patch decorators voor functie mocking
- Spying op functie calls
- Assertion helpers
Waarom deze versie:
- Versie 3.12.0+ biedt verbeterde mock functionaliteit
- Betere integratie met pytest
- Ondersteuning voor async mocking
pytest-cov (>=4.1.0)
Section titled “pytest-cov (>=4.1.0)”Gebruik: Code coverage reporting
- Coverage meting tijdens test uitvoering
- HTML en XML coverage reports
- Branch coverage ondersteuning
- Coverage thresholds
Waarom deze versie:
- Versie 4.1.0+ biedt verbeterde coverage accuracy
- Betere performance bij grote codebases
- Ondersteuning voor moderne Python features
Installatie
Section titled “Installatie”Productie
Section titled “Productie”pip install -r requirements.txtDevelopment
Section titled “Development”# Installeer productie dependenciespip install -r requirements.txt
# Dependencies zijn al in requirements.txt opgenomen# Geen extra development tools nodigDependency Management
Section titled “Dependency Management”Versie Strategie
Section titled “Versie Strategie”- Minimum versies (
>=) worden gebruikt voor flexibiliteit - Kritieke security updates worden direct toegepast
- Major version upgrades worden getest in development omgeving
- Breaking changes worden gedocumenteerd in CHANGELOG
Updates
Section titled “Updates”# Check for outdated packagespip list --outdated
# Update specific packagepip install --upgrade <package-name>
# Update all packages (met voorzichtigheid)pip install --upgrade -r requirements.txtSecurity
Section titled “Security”Alle dependencies worden regelmatig gescand op bekende vulnerabilities:
- AWS Security Bulletins voor Boto3
- GitHub Dependabot alerts
- Python Package Index (PyPI) security advisories
Compatibiliteit
Section titled “Compatibiliteit”| Dependency | Python 3.12 | Python 3.11 | Python 3.10 | Python 3.9 |
|---|---|---|---|---|
| Chalice | ✅ | ✅ | ✅ | ✅ |
| Boto3 | ✅ | ✅ | ✅ | ✅ |
| Botocore | ✅ | ✅ | ✅ | ✅ |
| psycopg2-binary | ✅ | ✅ | ✅ | ✅ |
| Pydantic | ✅ | ✅ | ✅ | ✅ |
| email-validator | ✅ | ✅ | ✅ | ✅ |
| requests | ✅ | ✅ | ✅ | ✅ |
| pytest | ✅ | ✅ | ✅ | ✅ |
| pytest-mock | ✅ | ✅ | ✅ | ✅ |
| pytest-cov | ✅ | ✅ | ✅ | ✅ |
Licenties
Section titled “Licenties”Alle gebruikte dependencies zijn open-source met permissive licenties:
- Chalice: Apache License 2.0
- Boto3: Apache License 2.0
- Botocore: Apache License 2.0
- psycopg2-binary: LGPL with exceptions
- Pydantic: MIT License
- email-validator: CC0 1.0 Universal
- requests: Apache License 2.0
- pytest: MIT License
- pytest-mock: MIT License
- pytest-cov: MIT License
AWS Services
Section titled “AWS Services”Vereiste AWS Services
Section titled “Vereiste AWS Services”- AWS Lambda: Serverless compute voor API endpoints
- API Gateway: HTTP API voor client requests
- SES: Email verzending service
- SQS: Message queues voor bulk processing
- RDS PostgreSQL: Database voor API keys en origins
- Secrets Manager: Beveiligde credential storage
- CloudWatch Logs: Logging en monitoring
AWS CLI Configuratie
Section titled “AWS CLI Configuratie”# Configureer AWS CLIaws configure
# Of gebruik environment variablesexport AWS_ACCESS_KEY_ID=your-access-keyexport AWS_SECRET_ACCESS_KEY=your-secret-keyexport AWS_DEFAULT_REGION=eu-central-1