truss 0.11.2rc1__py3-none-any.whl → 0.11.2rc2__py3-none-any.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.

Potentially problematic release.


This version of truss might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: truss
3
- Version: 0.11.2rc1
3
+ Version: 0.11.2rc2
4
4
  Summary: A seamless bridge from model development to model delivery
5
5
  Project-URL: Repository, https://github.com/basetenlabs/truss
6
6
  Project-URL: Homepage, https://truss.baseten.co
@@ -354,21 +354,21 @@ truss_chains/pydantic_numpy.py,sha256=MG8Ji_Inwo_JSfM2n7TPj8B-nbrBlDYsY3SOeBwD8f
354
354
  truss_chains/streaming.py,sha256=DGl2LEAN67YwP7Nn9MK488KmYc4KopWmcHuE6WjyO1Q,12521
355
355
  truss_chains/utils.py,sha256=LvpCG2lnN6dqPqyX3PwLH9tyjUzqQN3N4WeEFROMHak,6291
356
356
  truss_chains/deployment/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
357
- truss_chains/deployment/code_gen.py,sha256=tFZgeY6lacrMDCOH_mwduyxdf2oR9426KMLEXISl9NE,32646
357
+ truss_chains/deployment/code_gen.py,sha256=IBOYdhsWUyW_sBVhlEQAhvwxKcsGflDjgmR-1HyJJLg,32666
358
358
  truss_chains/deployment/deployment_client.py,sha256=haFiVmQek42ewlN_YflBaRDQT4ZYbmT20tvvJOkcUX0,32899
359
359
  truss_chains/reference_code/reference_chainlet.py,sha256=5feSeqGtrHDbldkfZCfX2R5YbbW0Uhc35mhaP2pXrHw,1340
360
360
  truss_chains/reference_code/reference_model.py,sha256=emH3hb23E_nbP98I37PGp1Xk1hz3g3lQ00tiLo55cSM,322
361
361
  truss_chains/remote_chainlet/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
362
362
  truss_chains/remote_chainlet/model_skeleton.py,sha256=8ZReLOO2MLcdg7bNZ61C-6j-e68i2Z-fFlyV3sz0qH8,2376
363
363
  truss_chains/remote_chainlet/stub.py,sha256=Y2gDUzMY9WRaQNHIz-o4dfLUfFyYV9dUhIRQcfgrY8g,17209
364
- truss_chains/remote_chainlet/utils.py,sha256=6kf3PpxK0eFj-lQqLvgyCUslFljZdxT_uMSHrwE69Vs,23693
364
+ truss_chains/remote_chainlet/utils.py,sha256=Zn3GZRvK8f65WUa-qa-8uPFZ2pD7ukRFxbLOvT-BL0Q,24063
365
365
  truss_train/__init__.py,sha256=7hE6j6-u6UGzCGaNp3CsCN0kAVjBus1Ekups-Bk0fi4,837
366
366
  truss_train/definitions.py,sha256=V985HhY4rdXL10DZxpFEpze9ScxzWErMht4WwaPknGU,6789
367
367
  truss_train/deployment.py,sha256=lWWANSuzBWu2M4oK4qD7n-oVR1JKdmw2Pn5BJQHg-Ck,3074
368
368
  truss_train/loader.py,sha256=0o66EjBaHc2YY4syxxHVR4ordJWs13lNXnKjKq2wq0U,1630
369
369
  truss_train/public_api.py,sha256=9N_NstiUlmBuLUwH_fNG_1x7OhGCytZLNvqKXBlStrM,1220
370
- truss-0.11.2rc1.dist-info/METADATA,sha256=JoqV8kcknGQgeP4ubbO7Au8Rm6hPRiByNjyVbsFuROM,6672
371
- truss-0.11.2rc1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
372
- truss-0.11.2rc1.dist-info/entry_points.txt,sha256=-MwKfHHQHQ6j0HqIgvxrz3CehCmczDLTD-OsRHnjjuU,130
373
- truss-0.11.2rc1.dist-info/licenses/LICENSE,sha256=FTqGzu85i-uw1Gi8E_o0oD60bH9yQ_XIGtZbA1QUYiw,1064
374
- truss-0.11.2rc1.dist-info/RECORD,,
370
+ truss-0.11.2rc2.dist-info/METADATA,sha256=l4V9tHBGTjs14pZeFWIR5VCFsS1ArDKc3er-aKHkGqM,6672
371
+ truss-0.11.2rc2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
372
+ truss-0.11.2rc2.dist-info/entry_points.txt,sha256=-MwKfHHQHQ6j0HqIgvxrz3CehCmczDLTD-OsRHnjjuU,130
373
+ truss-0.11.2rc2.dist-info/licenses/LICENSE,sha256=FTqGzu85i-uw1Gi8E_o0oD60bH9yQ_XIGtZbA1QUYiw,1064
374
+ truss-0.11.2rc2.dist-info/RECORD,,
@@ -546,7 +546,7 @@ async def websocket(self, websocket: fastapi.WebSocket) -> None:
546
546
  src=src,
547
547
  imports={
548
548
  "import fastapi",
549
- "import starlette.websockets",
549
+ "from starlette.websockets import WebSocketState",
550
550
  "from truss_chains.remote_chainlet import utils",
551
551
  },
552
552
  )
@@ -39,7 +39,7 @@ if TYPE_CHECKING:
39
39
  try:
40
40
  import prometheus_client
41
41
  except ImportError:
42
- logging.warning("Optional `prometheus_client` is not installed. ")
42
+ logging.warning("Optional `prometheus_client` is not installed.")
43
43
 
44
44
  class _NoOpMetric:
45
45
  def labels(self, *args: object, **kwargs: object) -> "_NoOpMetric":
@@ -65,6 +65,26 @@ except ImportError:
65
65
  return _NoOpMetric()
66
66
 
67
67
 
68
+ try:
69
+ from fastapi import WebSocketDisconnect
70
+ except ImportError:
71
+ # NB(nikhil): Stub implementation of WebSocketDisconnect, in case local environment doesn't have
72
+ # fastapi.
73
+ class WebSocketDisconnect(Exception): # type: ignore[no-redef]
74
+ def __init__(self, code: int, reason: Optional[str] = None):
75
+ super().__init__()
76
+ self.code = code
77
+ self.reason = reason
78
+
79
+
80
+ try:
81
+ from starlette.websockets import WebSocketState
82
+ except ImportError:
83
+ # NB(nikhil): Stub implementation of WebSocketState, in case local environment doesn't have starlette.
84
+ class WebSocketState: # type: ignore[no-redef]
85
+ CONNECTED = "connected"
86
+
87
+
68
88
  T = TypeVar("T")
69
89
 
70
90
  _LockT = TypeVar("_LockT", bound=Union[threading.Lock, asyncio.Lock])
@@ -588,17 +608,12 @@ class WebsocketWrapperFastAPI:
588
608
  await self._websocket.close(code=code, reason=reason)
589
609
 
590
610
  async def receive(self) -> Union[str, bytes]:
591
- try:
592
- import fastapi
593
- except ImportError:
594
- raise utils.make_optional_import_error("fastapi")
595
-
596
611
  message = await self._websocket.receive()
597
612
 
598
613
  if message.get("type") == "websocket.disconnect":
599
614
  # NB(nikhil): Mimics FastAPI `_raise_on_disconnect`, since otherwise the user has no
600
615
  # way of detecting that the client disconnected.
601
- raise fastapi.WebSocketDisconnect(message["code"], message.get("reason"))
616
+ raise WebSocketDisconnect(message["code"], message.get("reason"))
602
617
  elif message.get("text"):
603
618
  return typing.cast(str, message["text"])
604
619
  else:
@@ -632,11 +647,6 @@ class WebsocketWrapperFastAPI:
632
647
  return self._websocket.iter_json()
633
648
 
634
649
  async def is_connected(self) -> bool:
635
- try:
636
- from starlette.websockets import WebSocketState
637
- except ImportError:
638
- raise utils.make_optional_import_error("starlette.websockets")
639
-
640
650
  # NB(nikhil): This isn't a foolproof mechanism for detecting whether a websocket
641
651
  # connection is actually alive, ping/pong messages are best suited for that. However,
642
652
  # as a heuristic to determine if a message is safe to send, this can do a pretty good job.