From 05792adf2abce2f6264e63a46a138b84e709b8a2 Mon Sep 17 00:00:00 2001 From: brentyi Date: Mon, 4 Nov 2024 01:54:51 -0800 Subject: [PATCH] 0.2.12 --- pyproject.toml | 2 +- src/viser/__init__.py | 1 + src/viser/infra/_infra.py | 27 ++++++++++++++++----------- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 8c2423e9..3acbaedf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "viser" -version = "0.2.11" +version = "0.2.12" description = "3D visualization + Python" readme = "README.md" license = { text="MIT" } diff --git a/src/viser/__init__.py b/src/viser/__init__.py index 014d7c76..f4f73f05 100644 --- a/src/viser/__init__.py +++ b/src/viser/__init__.py @@ -45,6 +45,7 @@ from ._scene_handles import SceneNodePointerEvent as SceneNodePointerEvent from ._scene_handles import ScenePointerEvent as ScenePointerEvent from ._scene_handles import SplineCatmullRomHandle as SplineCatmullRomHandle +from ._scene_handles import LineSegmentsHandle as LineSegmentsHandle from ._scene_handles import SplineCubicBezierHandle as SplineCubicBezierHandle from ._scene_handles import SpotLightHandle as SpotLightHandle from ._scene_handles import TransformControlsHandle as TransformControlsHandle diff --git a/src/viser/infra/_infra.py b/src/viser/infra/_infra.py index 77dddb54..a3f369c3 100644 --- a/src/viser/infra/_infra.py +++ b/src/viser/infra/_infra.py @@ -315,17 +315,6 @@ async def ws_handler( connection: websockets.asyncio.server.ServerConnection, ) -> None: """Handler for websocket connections.""" - - # - # Suppress errors for: https://github.com/python-websockets/websockets/issues/1513 - # TODO: remove this when websockets behavior changes upstream. - class NoHttpErrors(logging.Filter): - def filter(self, record): - return not record.getMessage() == "opening handshake failed" - - connection.logger.logger.addFilter(NoHttpErrors()) # type: ignore - # - async with count_lock: nonlocal connection_count client_id = ClientId(connection_count) @@ -414,10 +403,26 @@ def handle_incoming(message: Message) -> None: file_cache: dict[Path, bytes] = {} file_cache_gzipped: dict[Path, bytes] = {} + filter_added = False + def viser_http_server( connection: ServerConnection, request: Request, ) -> Response | None: + # + # Suppress errors for: https://github.com/python-websockets/websockets/issues/1513 + # TODO: remove this when websockets behavior changes upstream. + nonlocal filter_added + if not filter_added: + + class NoHttpErrors(logging.Filter): + def filter(self, record): + return not record.getMessage() == "opening handshake failed" + + connection.logger.logger.addFilter(NoHttpErrors()) # type: ignore + filter_added = True + # + # Ignore websocket packets. if request.headers.get("Upgrade") == "websocket": return None