fastsqs 0.3.0__tar.gz → 0.3.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. fastsqs-0.3.2/PKG-INFO +210 -0
  2. fastsqs-0.3.2/README.md +164 -0
  3. fastsqs-0.3.2/fastsqs/middleware/idempotency.py +579 -0
  4. fastsqs-0.3.2/fastsqs.egg-info/PKG-INFO +210 -0
  5. {fastsqs-0.3.0 → fastsqs-0.3.2}/fastsqs.egg-info/requires.txt +2 -0
  6. {fastsqs-0.3.0 → fastsqs-0.3.2}/setup.py +3 -3
  7. fastsqs-0.3.0/PKG-INFO +0 -338
  8. fastsqs-0.3.0/README.md +0 -294
  9. fastsqs-0.3.0/fastsqs/middleware/idempotency.py +0 -180
  10. fastsqs-0.3.0/fastsqs.egg-info/PKG-INFO +0 -338
  11. {fastsqs-0.3.0 → fastsqs-0.3.2}/LICENSE +0 -0
  12. {fastsqs-0.3.0 → fastsqs-0.3.2}/MANIFEST.in +0 -0
  13. {fastsqs-0.3.0 → fastsqs-0.3.2}/fastsqs/__init__.py +0 -0
  14. {fastsqs-0.3.0 → fastsqs-0.3.2}/fastsqs/app.py +0 -0
  15. {fastsqs-0.3.0 → fastsqs-0.3.2}/fastsqs/events.py +0 -0
  16. {fastsqs-0.3.0 → fastsqs-0.3.2}/fastsqs/exceptions.py +0 -0
  17. {fastsqs-0.3.0 → fastsqs-0.3.2}/fastsqs/middleware/__init__.py +0 -0
  18. {fastsqs-0.3.0 → fastsqs-0.3.2}/fastsqs/middleware/base.py +0 -0
  19. {fastsqs-0.3.0 → fastsqs-0.3.2}/fastsqs/middleware/error_handling.py +0 -0
  20. {fastsqs-0.3.0 → fastsqs-0.3.2}/fastsqs/middleware/logging.py +0 -0
  21. {fastsqs-0.3.0 → fastsqs-0.3.2}/fastsqs/middleware/parallelization.py +0 -0
  22. {fastsqs-0.3.0 → fastsqs-0.3.2}/fastsqs/middleware/timing.py +0 -0
  23. {fastsqs-0.3.0 → fastsqs-0.3.2}/fastsqs/middleware/visibility.py +0 -0
  24. {fastsqs-0.3.0 → fastsqs-0.3.2}/fastsqs/presets.py +0 -0
  25. {fastsqs-0.3.0 → fastsqs-0.3.2}/fastsqs/routing/__init__.py +0 -0
  26. {fastsqs-0.3.0 → fastsqs-0.3.2}/fastsqs/routing/entry.py +0 -0
  27. {fastsqs-0.3.0 → fastsqs-0.3.2}/fastsqs/routing/router.py +0 -0
  28. {fastsqs-0.3.0 → fastsqs-0.3.2}/fastsqs/types.py +0 -0
  29. {fastsqs-0.3.0 → fastsqs-0.3.2}/fastsqs/utils.py +0 -0
  30. {fastsqs-0.3.0 → fastsqs-0.3.2}/fastsqs.egg-info/SOURCES.txt +0 -0
  31. {fastsqs-0.3.0 → fastsqs-0.3.2}/fastsqs.egg-info/dependency_links.txt +0 -0
  32. {fastsqs-0.3.0 → fastsqs-0.3.2}/fastsqs.egg-info/top_level.txt +0 -0
  33. {fastsqs-0.3.0 → fastsqs-0.3.2}/pyproject.toml +0 -0
  34. {fastsqs-0.3.0 → fastsqs-0.3.2}/setup.cfg +0 -0
fastsqs-0.3.2/PKG-INFO ADDED
@@ -0,0 +1,210 @@
1
+ Metadata-Version: 2.4
2
+ Name: fastsqs
3
+ Version: 0.3.2
4
+ Summary: FastAPI-like, modern async SQS message processing for Python with advanced features
5
+ Home-page: https://github.com/lafayettegabe/fastsqs
6
+ Author: Gabriel LaFayette
7
+ Author-email: gabriel.lafayette@proton.me
8
+ License: MIT
9
+ Keywords: sqs aws lambda serverless async fastapi pydantic message-processing
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3.8
12
+ Classifier: Programming Language :: Python :: 3.9
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: License :: OSI Approved :: MIT License
17
+ Classifier: Operating System :: OS Independent
18
+ Classifier: Development Status :: 4 - Beta
19
+ Classifier: Intended Audience :: Developers
20
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
21
+ Classifier: Topic :: System :: Distributed Computing
22
+ Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
23
+ Requires-Python: >=3.8
24
+ Description-Content-Type: text/markdown
25
+ License-File: LICENSE
26
+ Requires-Dist: pydantic>=2.0.0
27
+ Provides-Extra: dynamodb
28
+ Requires-Dist: boto3>=1.26.0; extra == "dynamodb"
29
+ Requires-Dist: aioboto3>=12.0.0; extra == "dynamodb"
30
+ Provides-Extra: all
31
+ Requires-Dist: boto3>=1.26.0; extra == "all"
32
+ Requires-Dist: aioboto3>=12.0.0; extra == "all"
33
+ Dynamic: author
34
+ Dynamic: author-email
35
+ Dynamic: classifier
36
+ Dynamic: description
37
+ Dynamic: description-content-type
38
+ Dynamic: home-page
39
+ Dynamic: keywords
40
+ Dynamic: license
41
+ Dynamic: license-file
42
+ Dynamic: provides-extra
43
+ Dynamic: requires-dist
44
+ Dynamic: requires-python
45
+ Dynamic: summary
46
+
47
+ # FastSQS
48
+
49
+ **FastAPI-like, production-ready async SQS message processing for Python.**
50
+
51
+ [![PyPI version](https://img.shields.io/pypi/v/fastsqs.svg)](https://pypi.org/project/fastsqs/)
52
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
53
+
54
+ ---
55
+
56
+ ## Version 0.3.0 - Production Ready Features
57
+
58
+ > ⚠️ **Pre-1.0 Release Warning**: This library is under active development. Breaking changes may occur until version 1.0.0. Pin your version in production.
59
+
60
+ ### 🚀 New Enterprise Features
61
+
62
+ - **Idempotency**: Prevent duplicate message processing with memory or DynamoDB storage
63
+ - **Advanced Error Handling**: Exponential backoff, circuit breaker, and DLQ management
64
+ - **Visibility Timeout Management**: Automatic monitoring and extension for long-running processes
65
+ - **Parallelization**: Concurrent processing with semaphore-based limiting and thread pools
66
+
67
+ ## Recent Updates
68
+
69
+ ### Version 0.3.2
70
+ - **Auto DynamoDB Table Creation**: DynamoDB idempotency store now automatically creates tables with proper schema and TTL configuration
71
+ - **Enhanced Table Management**: Improved error handling and race condition protection for table operations
72
+
73
+ ### Version 0.3.1
74
+ - **Idempotency Improvements**: Enhanced DynamoDB store reliability and error handling
75
+ - **Bug Fixes**: Various stability improvements and edge case handling
76
+
77
+ ## Key Features
78
+
79
+ - 🚀 **FastAPI-like API:** Familiar decorator-based routing with automatic type inference
80
+ - 🔒 **Pydantic Validation:** Automatic message validation and serialization using SQSEvent models
81
+ - 🔄 **Auto Async/Sync:** Write handlers as sync or async functions - framework handles both automatically
82
+ - �️ **Middleware Support:** Built-in and custom middleware for logging, timing, and more
83
+ - 🦾 **Partial Batch Failure:** Native support for AWS Lambda batch failure responses
84
+ - 🔀 **FIFO & Standard Queues:** Full support for both SQS queue types with proper ordering
85
+ - 🎯 **Flexible Matching:** Automatic field name normalization (camelCase ↔ snake_case)
86
+ - 🏗️ **Nested Routing:** QueueRouter support for complex routing scenarios
87
+ - 🐍 **Type Safety:** Full type hints and editor support throughout
88
+
89
+ ---
90
+
91
+ ## Requirements
92
+
93
+ - Python 3.8+
94
+ - [Pydantic](https://docs.pydantic.dev/) (installed automatically)
95
+
96
+ ---
97
+
98
+ ## Installation
99
+
100
+ ```bash
101
+ pip install fastsqs
102
+ ```
103
+
104
+ ---
105
+
106
+ ## Quick Start
107
+
108
+ ### Basic FastAPI-like Example
109
+
110
+ ```python
111
+ from fastsqs import FastSQS, SQSEvent
112
+
113
+ class UserCreated(SQSEvent):
114
+ user_id: str
115
+ email: str
116
+ name: str
117
+
118
+ class OrderProcessed(SQSEvent):
119
+ order_id: str
120
+ amount: float
121
+
122
+ # Create FastSQS app
123
+ app = FastSQS(debug=True)
124
+
125
+ # Route messages using SQSEvent models
126
+ @app.route(UserCreated)
127
+ async def handle_user_created(msg: UserCreated):
128
+ print(f"User created: {msg.name} ({msg.email})")
129
+
130
+ @app.route(OrderProcessed)
131
+ def handle_order_processed(msg: OrderProcessed):
132
+ print(f"Order {msg.order_id}: ${msg.amount}")
133
+
134
+ # Default handler for unmatched messages
135
+ @app.default()
136
+ def handle_unknown(payload, ctx):
137
+ print(f"Unknown message: {payload}")
138
+
139
+ # AWS Lambda handler
140
+ def lambda_handler(event, context):
141
+ return app.handler(event, context)
142
+ ```
143
+
144
+ ### Example SQS Message Payloads
145
+
146
+ ```json
147
+ {
148
+ "type": "user_created",
149
+ "user_id": "123",
150
+ "email": "user@example.com",
151
+ "name": "John Doe"
152
+ }
153
+ ```
154
+
155
+ ```json
156
+ {
157
+ "type": "order_processed",
158
+ "order_id": "ord-456",
159
+ "amount": 99.99
160
+ }
161
+ ```
162
+
163
+ ---
164
+
165
+ ## Advanced Features
166
+
167
+ ```python
168
+ # FIFO Queue Support
169
+ app = FastSQS(queue_type=QueueType.FIFO)
170
+
171
+ # Middleware
172
+ from fastsqs.middleware import TimingMiddleware, LoggingMiddleware
173
+ app.add_middleware(TimingMiddleware())
174
+ app.add_middleware(LoggingMiddleware())
175
+
176
+ # Field Matching - automatically handles camelCase ↔ snake_case
177
+ class UserEvent(SQSEvent):
178
+ user_id: str # Matches: user_id, userId, USER_ID
179
+ first_name: str # Matches: first_name, firstName
180
+ ```
181
+
182
+ ---
183
+
184
+ ## How it Works
185
+
186
+ 1. **Message Parsing:** JSON validated and normalized
187
+ 2. **Route Matching:** Type-based routing to handlers
188
+ 3. **Handler Execution:** Sync/async functions supported
189
+ 4. **Error Handling:** Failed messages → SQS retry/DLQ
190
+
191
+ ---
192
+
193
+ ## Error Handling & Performance
194
+
195
+ - **Predictable Errors:** All failures result in batch item failures for SQS retry
196
+ - **Parallel Processing:** Concurrent message handling (respects FIFO ordering)
197
+ - **Type Safety:** Full Pydantic validation with IDE support
198
+ - **Memory Efficient:** Minimal overhead per message
199
+
200
+ ---
201
+
202
+ ## Documentation & Contributing
203
+
204
+ - **Examples:** See `examples/` directory for complete working examples
205
+ - **Contributing:** Issues and PRs welcome!
206
+ - **License:** MIT
207
+
208
+ ---
209
+
210
+ **Ready to build type-safe, FastAPI-like SQS processors? Try FastSQS today!**
@@ -0,0 +1,164 @@
1
+ # FastSQS
2
+
3
+ **FastAPI-like, production-ready async SQS message processing for Python.**
4
+
5
+ [![PyPI version](https://img.shields.io/pypi/v/fastsqs.svg)](https://pypi.org/project/fastsqs/)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
7
+
8
+ ---
9
+
10
+ ## Version 0.3.0 - Production Ready Features
11
+
12
+ > ⚠️ **Pre-1.0 Release Warning**: This library is under active development. Breaking changes may occur until version 1.0.0. Pin your version in production.
13
+
14
+ ### 🚀 New Enterprise Features
15
+
16
+ - **Idempotency**: Prevent duplicate message processing with memory or DynamoDB storage
17
+ - **Advanced Error Handling**: Exponential backoff, circuit breaker, and DLQ management
18
+ - **Visibility Timeout Management**: Automatic monitoring and extension for long-running processes
19
+ - **Parallelization**: Concurrent processing with semaphore-based limiting and thread pools
20
+
21
+ ## Recent Updates
22
+
23
+ ### Version 0.3.2
24
+ - **Auto DynamoDB Table Creation**: DynamoDB idempotency store now automatically creates tables with proper schema and TTL configuration
25
+ - **Enhanced Table Management**: Improved error handling and race condition protection for table operations
26
+
27
+ ### Version 0.3.1
28
+ - **Idempotency Improvements**: Enhanced DynamoDB store reliability and error handling
29
+ - **Bug Fixes**: Various stability improvements and edge case handling
30
+
31
+ ## Key Features
32
+
33
+ - 🚀 **FastAPI-like API:** Familiar decorator-based routing with automatic type inference
34
+ - 🔒 **Pydantic Validation:** Automatic message validation and serialization using SQSEvent models
35
+ - 🔄 **Auto Async/Sync:** Write handlers as sync or async functions - framework handles both automatically
36
+ - �️ **Middleware Support:** Built-in and custom middleware for logging, timing, and more
37
+ - 🦾 **Partial Batch Failure:** Native support for AWS Lambda batch failure responses
38
+ - 🔀 **FIFO & Standard Queues:** Full support for both SQS queue types with proper ordering
39
+ - 🎯 **Flexible Matching:** Automatic field name normalization (camelCase ↔ snake_case)
40
+ - 🏗️ **Nested Routing:** QueueRouter support for complex routing scenarios
41
+ - 🐍 **Type Safety:** Full type hints and editor support throughout
42
+
43
+ ---
44
+
45
+ ## Requirements
46
+
47
+ - Python 3.8+
48
+ - [Pydantic](https://docs.pydantic.dev/) (installed automatically)
49
+
50
+ ---
51
+
52
+ ## Installation
53
+
54
+ ```bash
55
+ pip install fastsqs
56
+ ```
57
+
58
+ ---
59
+
60
+ ## Quick Start
61
+
62
+ ### Basic FastAPI-like Example
63
+
64
+ ```python
65
+ from fastsqs import FastSQS, SQSEvent
66
+
67
+ class UserCreated(SQSEvent):
68
+ user_id: str
69
+ email: str
70
+ name: str
71
+
72
+ class OrderProcessed(SQSEvent):
73
+ order_id: str
74
+ amount: float
75
+
76
+ # Create FastSQS app
77
+ app = FastSQS(debug=True)
78
+
79
+ # Route messages using SQSEvent models
80
+ @app.route(UserCreated)
81
+ async def handle_user_created(msg: UserCreated):
82
+ print(f"User created: {msg.name} ({msg.email})")
83
+
84
+ @app.route(OrderProcessed)
85
+ def handle_order_processed(msg: OrderProcessed):
86
+ print(f"Order {msg.order_id}: ${msg.amount}")
87
+
88
+ # Default handler for unmatched messages
89
+ @app.default()
90
+ def handle_unknown(payload, ctx):
91
+ print(f"Unknown message: {payload}")
92
+
93
+ # AWS Lambda handler
94
+ def lambda_handler(event, context):
95
+ return app.handler(event, context)
96
+ ```
97
+
98
+ ### Example SQS Message Payloads
99
+
100
+ ```json
101
+ {
102
+ "type": "user_created",
103
+ "user_id": "123",
104
+ "email": "user@example.com",
105
+ "name": "John Doe"
106
+ }
107
+ ```
108
+
109
+ ```json
110
+ {
111
+ "type": "order_processed",
112
+ "order_id": "ord-456",
113
+ "amount": 99.99
114
+ }
115
+ ```
116
+
117
+ ---
118
+
119
+ ## Advanced Features
120
+
121
+ ```python
122
+ # FIFO Queue Support
123
+ app = FastSQS(queue_type=QueueType.FIFO)
124
+
125
+ # Middleware
126
+ from fastsqs.middleware import TimingMiddleware, LoggingMiddleware
127
+ app.add_middleware(TimingMiddleware())
128
+ app.add_middleware(LoggingMiddleware())
129
+
130
+ # Field Matching - automatically handles camelCase ↔ snake_case
131
+ class UserEvent(SQSEvent):
132
+ user_id: str # Matches: user_id, userId, USER_ID
133
+ first_name: str # Matches: first_name, firstName
134
+ ```
135
+
136
+ ---
137
+
138
+ ## How it Works
139
+
140
+ 1. **Message Parsing:** JSON validated and normalized
141
+ 2. **Route Matching:** Type-based routing to handlers
142
+ 3. **Handler Execution:** Sync/async functions supported
143
+ 4. **Error Handling:** Failed messages → SQS retry/DLQ
144
+
145
+ ---
146
+
147
+ ## Error Handling & Performance
148
+
149
+ - **Predictable Errors:** All failures result in batch item failures for SQS retry
150
+ - **Parallel Processing:** Concurrent message handling (respects FIFO ordering)
151
+ - **Type Safety:** Full Pydantic validation with IDE support
152
+ - **Memory Efficient:** Minimal overhead per message
153
+
154
+ ---
155
+
156
+ ## Documentation & Contributing
157
+
158
+ - **Examples:** See `examples/` directory for complete working examples
159
+ - **Contributing:** Issues and PRs welcome!
160
+ - **License:** MIT
161
+
162
+ ---
163
+
164
+ **Ready to build type-safe, FastAPI-like SQS processors? Try FastSQS today!**