Skip to content

feat: add Amazon SES backend with SigV4 byte-stable signing#22

Merged
cofin merged 9 commits into
mainfrom
feat/amazon-ses
May 3, 2026
Merged

feat: add Amazon SES backend with SigV4 byte-stable signing#22
cofin merged 9 commits into
mainfrom
feat/amazon-ses

Conversation

@cofin

@cofin cofin commented May 3, 2026

Copy link
Copy Markdown
Member

Summary

Adds a native Amazon SES backend (API v2) to litestar-email, alongside a small refactor that splits the backend/transport __init__.py files into pure re-export façades.

  • New SESBackend + SESConfig (region, aws_access_key_id, aws_secret_access_key, aws_session_token, timeout, http_transport).
  • botocore is an optional dep — install via pip install litestar-email[ses]. No core deps added.
  • AWS Signature Version 4 signing via botocore.auth.SigV4Auth. Body bytes are pre-serialized once and used verbatim for both signing and transmission, so httpx's compact-separator JSON re-serialization can't invalidate x-amz-content-sha256.
  • HTTPTransport.post gained an additive content: bytes | None parameter (httpx + aiohttp impls plumbed through). Backward-compatible.
  • Maps SES error codes to typed exceptions: 429 → EmailRateLimitError(retry_after), 403 → EmailAuthenticationError, other 4xx → EmailDeliveryError.
  • Attachments (which require SES Raw content) and empty-body messages are rejected loudly rather than silently dropped.
  • Refactor: register_backendemail_backend (clearer for custom backend authors). Backend factory moved to backends/factory.py, transport factory to transports/factory.py. __init__.py files are now pure re-exports — RUF067 satisfied without suppression. SESBackend/SESConfig lifted to top-level litestar_email re-exports.
  • Docs updated: docs/usage/backends.rst, docs/usage/quickstart.rst, docs/reference/api.rst, README.md.

cofin added 9 commits May 3, 2026 15:36
- Deleted the following command files as they are no longer needed:
  - bootstrap.md
  - explore.md
  - fix-issue.md
  - implement.md
  - prd.md
  - review.md
  - test.md

- Removed the MCP strategy file as it is outdated.
- Deleted the README for the Litestar skill to streamline documentation.
- Updated .gitignore to include new patterns for Beads and Dolt files.
Stop tracking CLAUDE.md in version control and add CLAUDE.md and
GEMINI.md to .gitignore so per-agent context files stay local.
Regenerate uv.lock and bump pre-commit hooks via make upgrade:
conventional-pre-commit v4.3.0 -> v4.4.0, ruff-pre-commit
v0.14.10 -> v0.15.12, codespell v2.4.1 -> v2.4.2.
- Introduced SESBackend for sending emails via Amazon SES API v2.
- Added SES configuration options including region and AWS credentials.
- Updated documentation to include SES installation and usage instructions.
- Enhanced transport classes to support raw byte content for signed requests.
- Implemented tests for SES backend functionality, including error handling for rate limits and authentication issues.
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 86.52174% with 31 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.10%. Comparing base (ff41233) to head (0d2b7fc).

Files with missing lines Patch % Lines
src/litestar_email/backends/ses.py 84.54% 12 Missing and 5 partials ⚠️
src/litestar_email/backends/factory.py 87.50% 6 Missing and 3 partials ⚠️
src/litestar_email/transports/aiohttp.py 40.00% 1 Missing and 2 partials ⚠️
src/litestar_email/transports/httpx.py 71.42% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #22      +/-   ##
==========================================
- Coverage   88.57%   88.10%   -0.47%     
==========================================
  Files          21       24       +3     
  Lines         928     1068     +140     
  Branches      143      168      +25     
==========================================
+ Hits          822      941     +119     
- Misses         71       85      +14     
- Partials       35       42       +7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@cofin cofin merged commit 534d000 into main May 3, 2026
12 checks passed
@cofin cofin deleted the feat/amazon-ses branch May 3, 2026 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants