turboapi 0.3.19__cp313-cp313-win_amd64.whl → 0.3.21__cp313-cp313-win_amd64.whl

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.
Binary file
@@ -191,37 +191,38 @@ def create_enhanced_handler(original_handler, route_definition):
191
191
  # Filter kwargs to only pass expected parameters
192
192
  filtered_kwargs = {
193
193
  k: v for k, v in kwargs.items()
194
- if k in sig.parameters
195
194
  }
196
195
 
197
196
  # Call original handler
198
- if inspect.iscoroutinefunction(original_handler):
199
- # For async handlers (future support)
200
- result = original_handler(**filtered_kwargs)
201
- else:
202
- result = original_handler(**filtered_kwargs)
197
+ # v0.3.21: Async handlers are now supported via Rust's tokio runtime!
198
+ # The Rust layer (server.rs) will detect coroutines and await them properly
199
+ # using pyo3-async-runtimes, giving us native async performance
200
+ result = original_handler(**filtered_kwargs)
203
201
 
204
- # Normalize response
205
- content, status_code = ResponseHandler.normalize_response(result)
202
+ # Check if result is a coroutine - if so, return it directly for Rust to await
203
+ import inspect
204
+ if inspect.iscoroutine(result):
205
+ # Return coroutine directly - Rust will await it using tokio
206
+ return result
206
207
 
207
- return ResponseHandler.format_json_response(content, status_code)
208
+ # Sync result - normalize and return as JSON string
209
+ content, status_code = ResponseHandler.normalize_response(result)
208
210
 
211
+ # Return JSON string directly for Rust to use
212
+ import json
213
+ return json.dumps(content)
209
214
  except ValueError as e:
210
215
  # Validation or parsing error (400 Bad Request)
211
- return ResponseHandler.format_json_response(
212
- {"error": "Bad Request", "detail": str(e)},
213
- 400
214
- )
216
+ import json
217
+ return json.dumps({"error": "Bad Request", "detail": str(e)})
215
218
  except Exception as e:
216
219
  # Unexpected error (500 Internal Server Error)
217
220
  import traceback
218
- return ResponseHandler.format_json_response(
219
- {
220
- "error": "Internal Server Error",
221
- "detail": str(e),
222
- "traceback": traceback.format_exc()
223
- },
224
- 500
225
- )
221
+ import json
222
+ return json.dumps({
223
+ "error": "Internal Server Error",
224
+ "detail": str(e),
225
+ "traceback": traceback.format_exc()
226
+ })
226
227
 
227
228
  return enhanced_handler
@@ -175,7 +175,6 @@ class RustIntegratedTurboAPI(TurboAPI):
175
175
 
176
176
  # Add query parameters
177
177
  call_args.update(query_params)
178
-
179
178
  # Always add body and headers for enhanced handler
180
179
  call_args['body'] = body if body else b''
181
180
  call_args['headers'] = headers
@@ -187,7 +186,7 @@ class RustIntegratedTurboAPI(TurboAPI):
187
186
  # {"content": ..., "status_code": ..., "content_type": ...}
188
187
  # But Rust expects a plain dict that it will JSON serialize
189
188
  # So just return the content directly
190
- if isinstance(result, dict) and 'content' in result and 'status_code' in result:
189
+ if isinstance(result, dict) and 'content' in result:
191
190
  # Return just the content - Rust will handle status codes later
192
191
  # For now, just return the content as a dict
193
192
  return result['content']
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: turboapi
3
- Version: 0.3.19
3
+ Version: 0.3.21
4
4
  Classifier: Development Status :: 4 - Beta
5
5
  Classifier: Intended Audience :: Developers
6
6
  Classifier: License :: OSI Approved :: MIT License
@@ -1,5 +1,5 @@
1
- turboapi-0.3.19.dist-info/METADATA,sha256=OzTKA0au7Z2hdsJwj7iTapUd73KlGdT8rp-2KjiCNvI,1458
2
- turboapi-0.3.19.dist-info/WHEEL,sha256=tA3jeK73gMv2hhaFxfSe9XAOJHRQ2Ol5rfMGxqHyYEk,96
1
+ turboapi-0.3.21.dist-info/METADATA,sha256=lBOz438lnIRzdO8aFzqVgWq16YZtBP24y4XsUWRY6ak,1458
2
+ turboapi-0.3.21.dist-info/WHEEL,sha256=tA3jeK73gMv2hhaFxfSe9XAOJHRQ2Ol5rfMGxqHyYEk,96
3
3
  turboapi/__init__.py,sha256=r9Fphtu9ruHFUhSpBMAGxY5en2wvcnsE1nMp2DDRM6w,692
4
4
  turboapi/__pycache__/__init__.cpython-312.pyc,sha256=WGxT-5DbR5Q-z4xzZmEJQt71dI-ib_lgOs0KB8wJqX8,728
5
5
  turboapi/__pycache__/__init__.cpython-313.pyc,sha256=WvwBnRja8h3Oj0Q1NMdIBm_M3fAp25eUD7dM9h0lbeM,675
@@ -16,18 +16,18 @@ turboapi/__pycache__/models.cpython-313.pyc,sha256=yCVUcn71_yTxLaJHtbUXwYifd8nA3
16
16
  turboapi/__pycache__/routing.cpython-312.pyc,sha256=iYGmnOogsL8XbkGE2bP-sc5egpX8SMkBHbeZYu6Rif0,10264
17
17
  turboapi/__pycache__/routing.cpython-313.pyc,sha256=BQW1xl8UXO-pQ1u5FaoLcbQ4qW_V2dUHolHzzZ-kOjM,10554
18
18
  turboapi/__pycache__/rust_integration.cpython-312.pyc,sha256=5h-bsxlOcLcWdyYk6Ql6lh4Ql14DqY_lhr88hbBxBTY,15910
19
- turboapi/__pycache__/rust_integration.cpython-313.pyc,sha256=saU0PFJhTO6j9ZOBl6bmJc0Ukfc_PSWZ_5LVcl2msDw,15279
19
+ turboapi/__pycache__/rust_integration.cpython-313.pyc,sha256=4vpl3q5yBszAV9y44XxRHcrK-KlbhgkLwzs-Rc3vNYc,15290
20
20
  turboapi/__pycache__/server_integration.cpython-313.pyc,sha256=wSqZ72Sh6iyWbIJsdfk8s9oDL9L3DJPJWnz41mDGxCY,20089
21
21
  turboapi/__pycache__/version_check.cpython-312.pyc,sha256=xfdKv0_EU8gs3Ot1cDrQFJuuZYpEknwNEYzoTJzWk9g,9180
22
22
  turboapi/__pycache__/version_check.cpython-313.pyc,sha256=xgmdzdAt31IIw15NZxhc6JZjDCpw2Kw8DXrWUhNvHqw,10364
23
- turboapi/_rust.cp313-win_amd64.pyd,sha256=UcVnx6nyLzoiJpqyfXhxk7Yfx5UnefZIqPCpLrUk_9w,3381760
23
+ turboapi/_rust.cp313-win_amd64.pyd,sha256=Yn0QcE3xoTLUQ_FTqIdpaFKPCsutdFtTwQSoTkWUfM8,3368960
24
24
  turboapi/decorators.py,sha256=jjJrIXZ3y_yJ231ar24hS09OCDtTqmYA7arpIOcr2kk,1788
25
25
  turboapi/main_app.py,sha256=mR-x-RPJn96Jtg0a313hU_2UsLQNV_xNXRtpFYWAr30,9188
26
26
  turboapi/middleware.py,sha256=kDRGblEWopPqROT2O4P4HhB87tGw73qfpLm1svjNs6U,2183
27
27
  turboapi/models.py,sha256=VCU68f9MGtDdFb4crsx2e0SHghICg8zjU8OumfdpZLQ,5363
28
- turboapi/request_handler.py,sha256=KrN9d3r7bO8LUU68X6cXTtl3a2dCoRqmdWrjDW2V2qQ,8413
28
+ turboapi/request_handler.py,sha256=lFKXPTjOAFdgKmuQhLV-mwVIZQU6wg-FkSYkASCC_tc,8643
29
29
  turboapi/routing.py,sha256=iCbty56a2J9qnCtxIHQtYf66ZoKVxgISxwCxYvGmgEs,7746
30
- turboapi/rust_integration.py,sha256=_sB7CCdmS4nCh3mUHYsgRI0QvPpW_NKFV0z_-nOeimk,14917
30
+ turboapi/rust_integration.py,sha256=6fFhucDHku4r4mKX5dedz6MmPWTx2MxIq9M7H1xiyvo,14859
31
31
  turboapi/server_integration.py,sha256=drUhhTasWgQfyhFiAaHKd987N3mnE0qkMab1ylmqd4c,18340
32
32
  turboapi/version_check.py,sha256=z3O1vIJsWmG_DO271ayYWSwaDfgpFnfJzYRYyowKYMc,9625
33
- turboapi-0.3.19.dist-info/RECORD,,
33
+ turboapi-0.3.21.dist-info/RECORD,,