@vercel/python 4.1.1 → 4.3.0

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.
package/dist/index.js CHANGED
@@ -2852,6 +2852,12 @@ async function installRequirementsFile({
2852
2852
  var import_build_utils2 = require("@vercel/build-utils");
2853
2853
  var import_which = __toESM(require_lib());
2854
2854
  var allOptions = [
2855
+ {
2856
+ version: "3.12",
2857
+ pipPath: "pip3.12",
2858
+ pythonPath: "python3.12",
2859
+ runtime: "python3.12"
2860
+ },
2855
2861
  {
2856
2862
  version: "3.11",
2857
2863
  pipPath: "pip3.11",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/python",
3
- "version": "4.1.1",
3
+ "version": "4.3.0",
4
4
  "main": "./dist/index.js",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://vercel.com/docs/runtimes#official-runtimes/python",
@@ -19,7 +19,7 @@
19
19
  "@types/jest": "27.4.1",
20
20
  "@types/node": "14.18.33",
21
21
  "@types/which": "3.0.0",
22
- "@vercel/build-utils": "7.5.1",
22
+ "@vercel/build-utils": "8.2.1",
23
23
  "execa": "^1.0.0",
24
24
  "fs-extra": "11.1.1",
25
25
  "jest-junit": "16.0.0",
package/vc_init.py CHANGED
@@ -13,6 +13,7 @@ sys.modules["__VC_HANDLER_MODULE_NAME"] = __vc_module
13
13
  __vc_spec.loader.exec_module(__vc_module)
14
14
  __vc_variables = dir(__vc_module)
15
15
 
16
+ _use_legacy_asyncio = sys.version_info < (3, 10)
16
17
 
17
18
  def format_headers(headers, decode=False):
18
19
  keyToList = {}
@@ -198,16 +199,25 @@ elif 'app' in __vc_variables:
198
199
  ASGI instance using the connection scope.
199
200
  Runs until the response is completely read from the application.
200
201
  """
201
- loop = asyncio.new_event_loop()
202
- self.app_queue = asyncio.Queue(loop=loop)
202
+ if _use_legacy_asyncio:
203
+ loop = asyncio.new_event_loop()
204
+ self.app_queue = asyncio.Queue(loop=loop)
205
+ else:
206
+ self.app_queue = asyncio.Queue()
203
207
  self.put_message({'type': 'http.request', 'body': body, 'more_body': False})
204
208
 
205
209
  asgi_instance = app(self.scope, self.receive, self.send)
206
210
 
207
- asgi_task = loop.create_task(asgi_instance)
208
- loop.run_until_complete(asgi_task)
211
+ if _use_legacy_asyncio:
212
+ asgi_task = loop.create_task(asgi_instance)
213
+ loop.run_until_complete(asgi_task)
214
+ else:
215
+ asyncio.run(self.run_asgi_instance(asgi_instance))
209
216
  return self.response
210
217
 
218
+ async def run_asgi_instance(self, asgi_instance):
219
+ await asgi_instance
220
+
211
221
  def put_message(self, message):
212
222
  self.app_queue.put_nowait(message)
213
223