vuer 0.0.44__py3-none-any.whl → 0.0.45__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 vuer might be problematic. Click here for more details.

Binary file
Binary file
Binary file
Binary file
vuer/base.py CHANGED
@@ -84,7 +84,7 @@ class Server:
84
84
 
85
85
  self.cors_context = aiohttp_cors.setup(self.app, defaults=cors_config)
86
86
 
87
- def _route(
87
+ def _add_route(
88
88
  self,
89
89
  path: str,
90
90
  handler: callable,
@@ -97,20 +97,20 @@ class Server:
97
97
  ws_handler = partial(
98
98
  websocket_handler, handler=handler, max_msg_size=self.WEBSOCKET_MAX_SIZE
99
99
  )
100
- self._route(path, ws_handler)
100
+ self._add_route(path, ws_handler)
101
101
 
102
102
  @staticmethod
103
103
  def _add_task(fn: Coroutine, name=None):
104
104
  loop = asyncio.get_running_loop()
105
105
  loop.create_task(fn, name=name)
106
106
 
107
- def _static(self, path, root):
107
+ def _add_static(self, path, root):
108
108
  _fn = partial(handle_file_request, root=root)
109
- self._route(f"{path}/{{filename:.*}}", _fn, method="GET")
109
+ self._add_route(f"{path}/{{filename:.*}}", _fn, method="GET")
110
110
 
111
111
  def _static_file(self, path, root, filename=None):
112
112
  _fn = partial(handle_file_request, root=root, filename=filename)
113
- self._route(f"{path}", _fn, method="GET")
113
+ self._add_route(f"{path}", _fn, method="GET")
114
114
 
115
115
  def run(self):
116
116
  async def init_server():
@@ -139,6 +139,6 @@ class Server:
139
139
 
140
140
  if __name__ == "__main__":
141
141
  app = Server()
142
- app._route("", websocket_handler)
143
- app._static("/static", handle_file_request, root=".")
142
+ app._add_route("", websocket_handler)
143
+ app._add_static("/static", handle_file_request, root=".")
144
144
  app.run()
vuer/server.py CHANGED
@@ -1,33 +1,33 @@
1
1
  import asyncio
2
2
  from asyncio import sleep
3
- from collections import deque, defaultdict
3
+ from collections import defaultdict, deque
4
4
  from functools import partial
5
5
  from pathlib import Path
6
- from typing import cast, Callable, Dict, Union
6
+ from typing import Callable, Dict, Union, cast
7
7
  from uuid import uuid4
8
8
 
9
9
  from aiohttp.hdrs import UPGRADE
10
- from aiohttp.web_request import Request, BaseRequest
10
+ from aiohttp.web_request import BaseRequest, Request
11
11
  from aiohttp.web_response import Response
12
12
  from aiohttp.web_ws import WebSocketResponse
13
13
  from msgpack import packb, unpackb
14
- from params_proto import Proto, PrefixProto, Flag
14
+ from params_proto import Flag, PrefixProto, Proto
15
15
  from websockets import ConnectionClosedError
16
16
 
17
17
  from vuer.base import Server, handle_file_request, websocket_handler
18
18
  from vuer.events import (
19
+ INIT,
20
+ NOOP,
21
+ Add,
19
22
  ClientEvent,
23
+ Frame,
24
+ GrabRender,
20
25
  NullEvent,
26
+ Remove,
21
27
  ServerEvent,
22
- NOOP,
23
- Frame,
28
+ ServerRPC,
24
29
  Set,
25
30
  Update,
26
- INIT,
27
- Remove,
28
- Add,
29
- ServerRPC,
30
- GrabRender,
31
31
  Upsert,
32
32
  )
33
33
  from vuer.schemas import Page
@@ -755,6 +755,25 @@ class Vuer(PrefixProto, Server):
755
755
  else:
756
756
  return await websocket_handler(request, self.downlink)
757
757
 
758
+ def add_route(self, path, fn: Callable, method="GET", content_type="text/html"):
759
+ if self.verbose:
760
+ print("========= Adding Route =========")
761
+ print(" path:", path)
762
+ print(" fn:", fn)
763
+ print(" method:", method)
764
+ print("content_type:", content_type)
765
+ print("--------------------------------")
766
+
767
+ async def handler(request: Request):
768
+ try:
769
+ output = fn()
770
+ return Response(text=output, content_type=content_type)
771
+ except Exception as e:
772
+ print("\033[91m" + str(e) + "\033[0m", flush=True)
773
+ return Response(status=500, text=str(e))
774
+
775
+ self._add_route(path, handler, method=method)
776
+
758
777
  def run(self, kill=None, *args, **kwargs):
759
778
  import os
760
779
 
@@ -762,6 +781,7 @@ class Vuer(PrefixProto, Server):
762
781
  # port = int(_)
763
782
  if kill or self.free_port:
764
783
  import time
784
+
765
785
  from killport import kill_ports
766
786
 
767
787
  kill_ports(ports=[self.port])
@@ -772,14 +792,14 @@ class Vuer(PrefixProto, Server):
772
792
  # self._static_file("", Path(__file__).parent / "client_build", filename="index.html")
773
793
 
774
794
  # use the same endpoint for websocket and file serving.
775
- self._route("", self.socket_index, method="GET")
776
- self._static("/assets", self.client_root / "assets")
777
- self._static("/hands", self.client_root / "hands")
795
+ self._add_route("", self.socket_index, method="GET")
796
+ self._add_static("/assets", self.client_root / "assets")
797
+ self._static_file("/editor", self.client_root, "editor/index.html")
778
798
 
779
799
  # serve local files via /static endpoint
780
- self._static("/static", self.static_root)
800
+ self._add_static("/static", self.static_root)
781
801
  print("Serving file://" + os.path.abspath(self.static_root), "at", "/static")
782
- self._route("/relay", self.relay, method="POST")
802
+ self._add_route("/relay", self.relay, method="POST")
783
803
 
784
804
  print("Visit: " + self.get_url())
785
805
 
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: vuer
3
- Version: 0.0.44
3
+ Version: 0.0.45
4
4
  Home-page: https://github.com/vuer-ai/vuer
5
5
  Author: Ge Yang<ge.ike.yang@gmail.com>
6
6
  Author-email: ge.ike.yang@gmail.com
@@ -10,39 +10,42 @@ Classifier: Programming Language :: Python
10
10
  Requires-Python: >=3.7
11
11
  Description-Content-Type: text/markdown
12
12
  License-File: LICENSE
13
- Requires-Dist: params-proto >=2.13.0
13
+ Requires-Dist: params-proto>=2.13.0
14
14
  Requires-Dist: pillow
15
15
  Requires-Dist: msgpack
16
- Requires-Dist: numpy >=1.21
16
+ Requires-Dist: numpy>=1.21
17
17
  Requires-Dist: websockets
18
18
  Provides-Extra: all
19
- Requires-Dist: aiohttp ==3.10.5 ; extra == 'all'
20
- Requires-Dist: aiohttp-cors ; extra == 'all'
21
- Requires-Dist: killport ; extra == 'all'
22
- Provides-Extra: dev
23
- Requires-Dist: aiohttp ==3.10.5 ; extra == 'dev'
24
- Requires-Dist: aiohttp-cors ; extra == 'dev'
25
- Requires-Dist: killport ; extra == 'dev'
26
- Requires-Dist: black ==22.3.0 ; extra == 'dev'
27
- Requires-Dist: pylint ==2.13.4 ; extra == 'dev'
28
- Requires-Dist: pytest ==7.1.2 ; extra == 'dev'
29
- Requires-Dist: sphinx ==7.1.2 ; extra == 'dev'
30
- Requires-Dist: furo ; extra == 'dev'
31
- Requires-Dist: sphinx-autobuild ; extra == 'dev'
32
- Requires-Dist: sphinx-copybutton ; extra == 'dev'
33
- Requires-Dist: myst-parser ; extra == 'dev'
34
- Requires-Dist: trimesh ; extra == 'dev'
35
- Requires-Dist: tqdm ; extra == 'dev'
19
+ Requires-Dist: aiohttp==3.10.5; extra == "all"
20
+ Requires-Dist: aiohttp-cors; extra == "all"
21
+ Requires-Dist: killport; extra == "all"
36
22
  Provides-Extra: example
37
- Requires-Dist: aiohttp ==3.10.5 ; extra == 'example'
38
- Requires-Dist: aiohttp-cors ; extra == 'example'
39
- Requires-Dist: killport ; extra == 'example'
40
- Requires-Dist: open3d <0.16.0,>=0.15.0 ; extra == 'example'
41
- Requires-Dist: trimesh ; extra == 'example'
42
- Requires-Dist: cmx ; extra == 'example'
43
- Requires-Dist: functional-notations ; extra == 'example'
44
- Requires-Dist: ml-logger ; extra == 'example'
45
- Requires-Dist: opencv-python ; extra == 'example'
23
+ Requires-Dist: aiohttp==3.10.5; extra == "example"
24
+ Requires-Dist: aiohttp-cors; extra == "example"
25
+ Requires-Dist: killport; extra == "example"
26
+ Requires-Dist: open3d<0.16.0,>=0.15.0; extra == "example"
27
+ Requires-Dist: trimesh; extra == "example"
28
+ Requires-Dist: cmx; extra == "example"
29
+ Requires-Dist: functional_notations; extra == "example"
30
+ Requires-Dist: ml_logger; extra == "example"
31
+ Requires-Dist: opencv-python; extra == "example"
32
+ Provides-Extra: dev
33
+ Requires-Dist: aiohttp==3.10.5; extra == "dev"
34
+ Requires-Dist: aiohttp-cors; extra == "dev"
35
+ Requires-Dist: killport; extra == "dev"
36
+ Requires-Dist: black==22.3.0; extra == "dev"
37
+ Requires-Dist: pylint==2.13.4; extra == "dev"
38
+ Requires-Dist: pytest==7.1.2; extra == "dev"
39
+ Requires-Dist: sphinx==7.1.2; extra == "dev"
40
+ Requires-Dist: furo; extra == "dev"
41
+ Requires-Dist: sphinx-autobuild; extra == "dev"
42
+ Requires-Dist: sphinx_copybutton; extra == "dev"
43
+ Requires-Dist: myst_parser; extra == "dev"
44
+ Requires-Dist: trimesh; extra == "dev"
45
+ Requires-Dist: tqdm; extra == "dev"
46
+ Dynamic: author
47
+ Dynamic: author-email
48
+ Dynamic: home-page
46
49
 
47
50
  <h2>Vuer: Modern High-Performance Visualization for AI & Robotics in VR
48
51
  <br/>
@@ -1,19 +1,19 @@
1
1
  vuer/__init__.py,sha256=kbjORSc64WWVHcx3eJB1wnCzhIF76eX5g-JAXYEDM4Q,519
2
- vuer/base.py,sha256=oZWLC1QJ-Oa3ekCtqu3sVLgvUF2Mp7brgtv0OF4uXSI,4226
2
+ vuer/base.py,sha256=_NR9o1n_CvjhREolq5FSouMONBGnxJwrw56isfakTUE,4254
3
3
  vuer/events.py,sha256=FFNCEXFZDIEvNV58ZWOZE4Xg-Qf60YJ6w6MLlyOAfiw,7931
4
4
  vuer/serdes.py,sha256=GcUTcNwFj2rd-H9Konnud3w1hs7_ACdKzhDuHbnOaB0,2606
5
- vuer/server.py,sha256=kjTXTOjlIyiJpun_3HJyJQ40BJRoaYP1KKMGyEEWosY,24420
5
+ vuer/server.py,sha256=Uo-KJMe3ffsGHCj4fUczbQRSRxcd4a_yZdrdFkfCiHY,25224
6
6
  vuer/types.py,sha256=Hor1MmkdyQrtsj-qE0dLH-ZeaIFDQzVwunO7ZgEqC9M,1321
7
7
  vuer/__pycache__/__init__.cpython-311.pyc,sha256=jtNzgxMRe_sQNA7bcFGYXtNQv_fTiR_yvvV1MAen0aw,786
8
8
  vuer/__pycache__/__init__.cpython-38.pyc,sha256=9UiyDbGVhzENW5OZYxPZhMK1kVGNV6sTlNFK1Soetdk,652
9
- vuer/__pycache__/base.cpython-311.pyc,sha256=WP8WCNerh55287dkUtNRRwkTgdIOFphwUI6n9RuB8Xw,8746
10
- vuer/__pycache__/base.cpython-38.pyc,sha256=-6Ys76_bhj6Eozvh56583kc5JbwMWXa31pCowRCRavY,4789
9
+ vuer/__pycache__/base.cpython-311.pyc,sha256=umIxJw-tC116BY02zkJILekYVeKYXqW8qVvXuySuMKc,8758
10
+ vuer/__pycache__/base.cpython-38.pyc,sha256=aEEOc3MPe7ky265HG26dCyAx1RyDLbHF2xMIg3r__KI,4805
11
11
  vuer/__pycache__/events.cpython-311.pyc,sha256=hjCTwuSe638Gavc5Xu1iPgcyPDxOJ6ggZY2GW6T7oA8,14745
12
12
  vuer/__pycache__/events.cpython-38.pyc,sha256=Uvjj__OHltPlyjcaCpOvEQMHFePDW2UdQnAHt9ORi1A,9952
13
13
  vuer/__pycache__/serdes.cpython-311.pyc,sha256=oC-sI0zHgAbMLHVD_biVJ6SQfYsXfVc2bGgS6gVPWsM,4631
14
14
  vuer/__pycache__/serdes.cpython-38.pyc,sha256=dq4IFqiPsgG26p7ZAd09ehhCTkzsvGTtu8NYck1qBDU,2263
15
- vuer/__pycache__/server.cpython-311.pyc,sha256=iN010SBrGMzLPa70jGnotbNQLXlfb88NNYIoXDVH8Qo,35379
16
- vuer/__pycache__/server.cpython-38.pyc,sha256=jEjRV5_-_OrzxDlagGB2EslIIamlm_GVk9_nxux_rFU,22523
15
+ vuer/__pycache__/server.cpython-311.pyc,sha256=ozzIJlImjSXzKwGt_20BUn90whkOKH4SVVr24vZ_Hek,36856
16
+ vuer/__pycache__/server.cpython-38.pyc,sha256=nyo9o6L6X0a5WVKn4yIm70Q1NS2WeLyswxQXliOjJj8,23317
17
17
  vuer/__pycache__/types.cpython-311.pyc,sha256=VpSyi31RkV1ntEPZ4-zjDN5jRZ3UK5FkHU4p40lfVgA,2798
18
18
  vuer/__pycache__/types.cpython-38.pyc,sha256=C9Z8XbkgINu8ilDHmBlzkMmgg1w0nPAzJ_mM_qFiOrA,1884
19
19
  vuer/addons/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -94,15 +94,15 @@ vuer/schemas/__pycache__/drei_components.cpython-311.pyc,sha256=5Iy4O5tm6vzVTh3H
94
94
  vuer/schemas/__pycache__/drei_components.cpython-38.pyc,sha256=YzK4Sa888xt8OhOPsx2L3iEQEU4ZGS5AwrcsQHNzN1E,7720
95
95
  vuer/schemas/__pycache__/html_components.cpython-311.pyc,sha256=hbLRG2Y39uGL0k9sYyas1ti0DoYBHG_JX7-CRWFF2Eg,14352
96
96
  vuer/schemas/__pycache__/html_components.cpython-38.pyc,sha256=XlXf72kzEbweQDcokV9Q1YJ3U6dgWocVME9NYALuhno,8743
97
- vuer/schemas/__pycache__/physics_components.cpython-311.pyc,sha256=zThiiRD318SaZv5oZGdpZGw5AKNms9vsQMZmHwSUXSY,2798
98
- vuer/schemas/__pycache__/physics_components.cpython-38.pyc,sha256=b1JqOWVzRNWC_GzrDCSFACrA9i1X9r2WHqsIhQjIxhI,2169
97
+ vuer/schemas/__pycache__/physics_components.cpython-311.pyc,sha256=0aDpnt4N-i4mWoQzftwxQCItAEsLPbNlactvAwFVWTg,2861
98
+ vuer/schemas/__pycache__/physics_components.cpython-38.pyc,sha256=uozao_e8htfxOly2mM6ogR6MoAdPWiRcCAS9zzDX8DQ,2202
99
99
  vuer/schemas/__pycache__/scene_components.cpython-311.pyc,sha256=Kzco9Rd3QauUKCl06DErechrsCsM4TOwWvn5WfH0km0,39293
100
100
  vuer/schemas/__pycache__/scene_components.cpython-38.pyc,sha256=3xE24HHVXAu7jNZfiQ4qTh25sfdcq-H0JoJPhyTIHyk,30148
101
101
  vuer/schemas/__pycache__/vuer_components.cpython-311.pyc,sha256=SKbT-DH72q4bRt50jj1y0er42uekv2pD3PDAUuaNKOk,1969
102
102
  vuer/schemas/__pycache__/vuer_components.cpython-38.pyc,sha256=-zv3JXOr9phygRVaQ8NAzheWPyvwf6fkQ29Q1IEhvr8,1819
103
- vuer-0.0.44.dist-info/LICENSE,sha256=MGF-inVBUaGe2mEjqT0g6XsHIXwoNXgNHqD7Z1MzR0k,1063
104
- vuer-0.0.44.dist-info/METADATA,sha256=NzyAYSiBN3IMaSYQvc4UX_abrmwecJBsug6ZZa8fhnM,5681
105
- vuer-0.0.44.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
106
- vuer-0.0.44.dist-info/entry_points.txt,sha256=J_NM6fbpipmD9oP7cdxd1UyBR8mVEQVx0xjlE_56yss,41
107
- vuer-0.0.44.dist-info/top_level.txt,sha256=ermmVkwvGFAK4gfSgDIwOmKpxwpqNt-oo7gVQQUSHok,5
108
- vuer-0.0.44.dist-info/RECORD,,
103
+ vuer-0.0.45.dist-info/LICENSE,sha256=MGF-inVBUaGe2mEjqT0g6XsHIXwoNXgNHqD7Z1MzR0k,1063
104
+ vuer-0.0.45.dist-info/METADATA,sha256=6zMpbLX8h3H_Pid-1Ulpjgbf9Wnt5wC7SX26ATN1ZGk,5703
105
+ vuer-0.0.45.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
106
+ vuer-0.0.45.dist-info/entry_points.txt,sha256=J_NM6fbpipmD9oP7cdxd1UyBR8mVEQVx0xjlE_56yss,41
107
+ vuer-0.0.45.dist-info/top_level.txt,sha256=ermmVkwvGFAK4gfSgDIwOmKpxwpqNt-oo7gVQQUSHok,5
108
+ vuer-0.0.45.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.41.2)
2
+ Generator: setuptools (75.8.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
File without changes