turboapi 0.3.20__cp314-cp314-win_amd64.whl → 0.3.23__cp314-cp314-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,43 +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
- # Async handler - need to await it
200
- import asyncio
201
- try:
202
- loop = asyncio.get_event_loop()
203
- except RuntimeError:
204
- loop = asyncio.new_event_loop()
205
- asyncio.set_event_loop(loop)
206
- result = loop.run_until_complete(original_handler(**filtered_kwargs))
207
- else:
208
- 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)
209
201
 
210
- # Normalize response
211
- 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
212
207
 
213
- 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)
214
210
 
211
+ # Return JSON string directly for Rust to use
212
+ import json
213
+ return json.dumps(content)
215
214
  except ValueError as e:
216
215
  # Validation or parsing error (400 Bad Request)
217
- return ResponseHandler.format_json_response(
218
- {"error": "Bad Request", "detail": str(e)},
219
- 400
220
- )
216
+ import json
217
+ return json.dumps({"error": "Bad Request", "detail": str(e)})
221
218
  except Exception as e:
222
219
  # Unexpected error (500 Internal Server Error)
223
220
  import traceback
224
- return ResponseHandler.format_json_response(
225
- {
226
- "error": "Internal Server Error",
227
- "detail": str(e),
228
- "traceback": traceback.format_exc()
229
- },
230
- 500
231
- )
221
+ import json
222
+ return json.dumps({
223
+ "error": "Internal Server Error",
224
+ "detail": str(e),
225
+ "traceback": traceback.format_exc()
226
+ })
232
227
 
233
228
  return enhanced_handler
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: turboapi
3
- Version: 0.3.20
3
+ Version: 0.3.23
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.20.dist-info/METADATA,sha256=4GFLKun1a5yZJWHwIssORJtp8Nh9wZpbI5facR-2bUk,1458
2
- turboapi-0.3.20.dist-info/WHEEL,sha256=EiVjE0x0W7bvcwYW2YLFujJOVfmyJVkIkPLDNmxDbbI,96
1
+ turboapi-0.3.23.dist-info/METADATA,sha256=VpVhmCyvdoNHS9gk-eEOkUHBrew-Phst2zTKRamNGH4,1458
2
+ turboapi-0.3.23.dist-info/WHEEL,sha256=EiVjE0x0W7bvcwYW2YLFujJOVfmyJVkIkPLDNmxDbbI,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
@@ -20,14 +20,14 @@ turboapi/__pycache__/rust_integration.cpython-313.pyc,sha256=4vpl3q5yBszAV9y44Xx
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.cp314-win_amd64.pyd,sha256=N1Qv9Oj3Rl2077Ubggq2JZvAdp7Vo3p0Z7_2nRXX0no,3390464
23
+ turboapi/_rust.cp314-win_amd64.pyd,sha256=rZvjeHLthKAGBev1_AO1IWZwktRPub-UMD0CzVjyrYY,3444736
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=q8s-yaeSw-8VGbwvijtnPZU5bgjDYtth3wwuqOA54kI,8683
28
+ turboapi/request_handler.py,sha256=lFKXPTjOAFdgKmuQhLV-mwVIZQU6wg-FkSYkASCC_tc,8643
29
29
  turboapi/routing.py,sha256=iCbty56a2J9qnCtxIHQtYf66ZoKVxgISxwCxYvGmgEs,7746
30
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.20.dist-info/RECORD,,
33
+ turboapi-0.3.23.dist-info/RECORD,,