vuer 0.0.13rc2__py3-none-any.whl → 0.0.14__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.

vuer/__init__.py CHANGED
@@ -0,0 +1 @@
1
+ from vuer.server import Vuer, VuerSession
Binary file
Binary file
vuer/server.py CHANGED
@@ -23,7 +23,8 @@ from vuer.events import (
23
23
  Remove,
24
24
  Add,
25
25
  ServerRPC,
26
- GrabRender, Upsert,
26
+ GrabRender,
27
+ Upsert,
27
28
  )
28
29
  from vuer.schemas import Page
29
30
  from vuer.types import EventHandler, Spawnable
@@ -44,7 +45,7 @@ class At:
44
45
  return self.fn(*args, **kwargs)
45
46
 
46
47
 
47
- class VuerProxy:
48
+ class VuerSession:
48
49
  def __init__(self, vuer: "Vuer", ws_id: int, queue_len=100):
49
50
  self.vuer = vuer
50
51
  self.CURRENT_WS_ID = ws_id
@@ -85,7 +86,9 @@ class VuerProxy:
85
86
  :param subsample: The subsample of the render.
86
87
  :param ttl: The time to live for the handler. If the handler is not called within the time it gets removed from the handler list.
87
88
  """
88
- assert self.CURRENT_WS_ID is not None, "Websocket session is missing. CURRENT_WS_ID is None."
89
+ assert (
90
+ self.CURRENT_WS_ID is not None
91
+ ), "Websocket session is missing. CURRENT_WS_ID is None."
89
92
 
90
93
  event = GrabRender(**kwargs)
91
94
 
@@ -219,10 +222,12 @@ class VuerProxy:
219
222
  def stream(self):
220
223
  yield from self.downlink_queue
221
224
 
225
+
222
226
  class Vuer(PrefixProto, Server):
223
227
  """
224
228
  A Vuer is a document that can be rendered in a browser.
225
229
  """
230
+
226
231
  name = "vuer"
227
232
  uri = "ws://localhost:8012"
228
233
  # change to vuer.dash.ml
@@ -240,7 +245,7 @@ class Vuer(PrefixProto, Server):
240
245
 
241
246
  # need to be awaited
242
247
 
243
- def _proxy(self, ws_id) -> "VuerProxy":
248
+ def _proxy(self, ws_id) -> "VuerSession":
244
249
  """This is a proxy object that allows us to use the @ notation
245
250
  to send events to the client.
246
251
 
@@ -248,7 +253,7 @@ class Vuer(PrefixProto, Server):
248
253
  :return: A proxy object.
249
254
  """
250
255
  # todo: check if shallow copy suffices
251
- proxy = VuerProxy(self, ws_id, queue_len=self.queue_len)
256
+ proxy = VuerSession(self, ws_id, queue_len=self.queue_len)
252
257
 
253
258
  return proxy
254
259
 
@@ -282,7 +287,7 @@ class Vuer(PrefixProto, Server):
282
287
  """
283
288
  # todo: need to implement msgpack encoding, interface
284
289
  bytes = request.bytes()
285
- session_id = request.rel_url.query.get('sid', None)
290
+ session_id = request.rel_url.query.get("sid", None)
286
291
  if session_id is None:
287
292
  return Response(400)
288
293
  elif session_id in self.ws:
@@ -301,7 +306,7 @@ class Vuer(PrefixProto, Server):
301
306
  return Response(status=400)
302
307
 
303
308
  # ** downlink message queue methods**
304
- async def bound_fn(self, session_proxy: VuerProxy):
309
+ async def bound_fn(self, session_proxy: VuerSession):
305
310
  """This is the default generator function in the socket connection handler"""
306
311
  print("default socket worker is up, adding clientEvents ")
307
312
  session_proxy.downlink_queue.append(INIT)
@@ -330,7 +335,6 @@ class Vuer(PrefixProto, Server):
330
335
 
331
336
  session_proxy.downlink_queue.append(client_event)
332
337
 
333
-
334
338
  def spawn_task(self, task):
335
339
  loop = asyncio.get_running_loop()
336
340
  return loop.create_task(task)
@@ -419,7 +423,7 @@ class Vuer(PrefixProto, Server):
419
423
  response = None
420
424
 
421
425
  async def response_handler(
422
- response_event: ClientEvent, _: "VuerProxy"
426
+ response_event: ClientEvent, _: "VuerSession"
423
427
  ) -> Coroutine:
424
428
  nonlocal response
425
429
 
@@ -454,8 +458,7 @@ class Vuer(PrefixProto, Server):
454
458
  except KeyError:
455
459
  pass
456
460
 
457
- async def uplink(self, proxy: VuerProxy):
458
-
461
+ async def uplink(self, proxy: VuerSession):
459
462
  ws_id = proxy.CURRENT_WS_ID
460
463
  queue = proxy.uplink_queue
461
464
 
@@ -522,7 +525,6 @@ class Vuer(PrefixProto, Server):
522
525
 
523
526
  try:
524
527
  async for msg in ws:
525
-
526
528
  payload = unpackb(msg.data, raw=False)
527
529
  clientEvent = ClientEvent(**payload)
528
530
 
@@ -553,10 +555,10 @@ class Vuer(PrefixProto, Server):
553
555
  self.ws.pop(ws_id, None)
554
556
 
555
557
  def add_handler(
556
- self,
557
- event_type: str,
558
- fn: EventHandler,
559
- once: bool = False,
558
+ self,
559
+ event_type: str,
560
+ fn: EventHandler,
561
+ once: bool = False,
560
562
  ) -> Callable[[], None]:
561
563
  """Adding event handlers to the vuer server.
562
564
 
@@ -609,12 +611,10 @@ class Vuer(PrefixProto, Server):
609
611
  kill_ports(ports=[self.port])
610
612
  time.sleep(0.01)
611
613
 
612
- # host = host[2:]
613
-
614
614
  self._socket("", self.downlink)
615
615
  # serve local files via /static endpoint
616
616
  self._static("/static", self.static_root)
617
617
  print("serving static files from", self.static_root, "at", "/static")
618
618
  self._route("/relay", self.relay, method="POST")
619
- # self._socket()
619
+
620
620
  super().run()
@@ -0,0 +1,115 @@
1
+ Metadata-Version: 2.1
2
+ Name: vuer
3
+ Version: 0.0.14
4
+ Home-page: https://github.com/geyang/vuer
5
+ Author: Ge Yang<ge.ike.yang@gmail.com>
6
+ Author-email: ge.ike.yang@gmail.com
7
+ License: MIT
8
+ Classifier: Development Status :: 3 - Alpha
9
+ Classifier: Programming Language :: Python
10
+ Requires-Python: >=3.8.6
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+ Requires-Dist: aiohttp
14
+ Requires-Dist: aiohttp-cors
15
+ Requires-Dist: killport
16
+ Requires-Dist: params-proto >=2.11.16
17
+ Requires-Dist: pillow
18
+ Requires-Dist: tqdm
19
+ Requires-Dist: msgpack
20
+ Requires-Dist: numpy
21
+ Requires-Dist: termcolor
22
+ Requires-Dist: trimesh
23
+ Requires-Dist: websockets
24
+ Provides-Extra: dev
25
+ Requires-Dist: black ==22.3.0 ; extra == 'dev'
26
+ Requires-Dist: pylint ==2.13.4 ; extra == 'dev'
27
+ Requires-Dist: pytest ==7.1.2 ; extra == 'dev'
28
+
29
+ # Welcome to `Vuer`
30
+
31
+ [![PyPI version fury.io](https://badge.fury.io/py/vuer.svg)](https://pypi.python.org/pypi/vuer/)
32
+
33
+ ![Production](https://api.netlify.com/api/v1/badges/2df7f3ba-1a26-4047-b76a-d7401f907bb5/deploy-status)
34
+
35
+ ![Staging](https://api.netlify.com/api/v1/badges/1727476e-c992-4dc1-98bf-92ef266cad78/deploy-status)
36
+
37
+ Vuer is a light-weight visualization toolkit for interacting with dynamic 3D and robotics data. It is
38
+ VR and AR ready, and can be run on mobile devices.
39
+
40
+ ## Installation
41
+
42
+ You can install `vuer` with `pip`:
43
+
44
+ ```shell
45
+ pip install vuer
46
+ ```
47
+
48
+ Here is an example that loads a URDF file and displays it in the browser. For a more comprehensive list of examples, please refer to the [examples](https://docs.vuer.ai/en/latest/examples.html) page.
49
+
50
+ ```python
51
+ from vuer import Vuer, VuerSession
52
+ from vuer.schemas import DefaultScene, Urdf
53
+
54
+ app = Vuer()
55
+
56
+
57
+ @app.spawn(start=True)
58
+ async def main(session: VuerSession):
59
+ app.set @ DefaultScene(
60
+ Urdf("assets/urdf/robotiq.urdf"),
61
+ )
62
+
63
+ while True:
64
+ await session.sleep(0.1)
65
+ ```
66
+
67
+ <iframe src="https://vuer.ai?collapseMenu=True&background=131416,fff&initCamPos=2.8,2.2,2.5&ws=ws%3A%2F%2Flocalhost%3A8012&scene=3gAJqGNoaWxkcmVukd4ABKhjaGlsZHJlbpHeAAaoY2hpbGRyZW6Qo3RhZ6RVcmRmo2tleaExo3NyY9lSaHR0cHM6Ly9yYXcuZ2l0aHVidXNlcmNvbnRlbnQuY29tL25hc2EtanBsL20yMDIwLXVyZGYtbW9kZWxzL21haW4vcm92ZXIvbTIwMjAudXJkZqtqb2ludFZhbHVlc94AAKhyb3RhdGlvbpPLQAkeuGAAAAAAAKN0YWenTW92YWJsZaNrZXmhMqhwb3NpdGlvbpMAAMs%2FwzMzQAAAAKN0YWelU2NlbmWja2V5oTOidXCTAAABpGdyaWTDqHNob3dMZXZhwqtyYXdDaGlsZHJlbpLeAASoY2hpbGRyZW6Qo3RhZ6xBbWJpZW50TGlnaHSja2V5tWRlZmF1bHRfYW1iaWVudF9saWdodKlpbnRlbnNpdHkB3gAFqGNoaWxkcmVukKN0YWewRGlyZWN0aW9uYWxMaWdodKNrZXm5ZGVmYXVsdF9kaXJlY3Rpb25hbF9saWdodKlpbnRlbnNpdHkBpmhlbHBlcsOsaHRtbENoaWxkcmVukLJiYWNrZ3JvdW5kQ2hpbGRyZW6Q" width="100%" height="400px" frameborder="0"></iframe>
68
+
69
+ Vuer is built by researchers at MIT and UCSD in fields including robotics, computer vision, and computer graphics.
70
+
71
+ - light-weight and performant
72
+ - VR and AR ready
73
+ - has a strong community support
74
+ - Hackable and extensible
75
+ - Open source, licensed under MIT
76
+
77
+ To get a quick overview of what you can do with <code style="font-size: 1.3em; background-clip: text; color: transparent; background-image: linear-gradient(to right, rgb(0,140,220), rgb(226,213,79), rgb(210,0,12));">vuer</code>, check out the following:
78
+
79
+ - take a look at the example gallery [here](https://docs.vuer.ai/en/latest/examples.html)
80
+ - or try to take a look at this demo [here](https://docs.vuer.ai/en/latest/examples.html#demo)
81
+
82
+ For a comprehensive list of visualization components, please refer to
83
+ the [API documentation on Components](https://docs.vuer.ai/en/latest/api.html).
84
+
85
+ For a comprehensive list of data types, please refer to the [API documentation on Data Types](https://docs.vuer.ai/en/latest/api.html).
86
+
87
+ Now, to run the examples, first download the example datasets.
88
+
89
+ Each subdirectory in the `assets` directory contains a `Makefile`. Run the `make` command in each subdirectory to download the datasets. For example:
90
+
91
+ ```bash
92
+ cd assets/static_3d
93
+ make
94
+ ```
95
+
96
+ Then run the examples
97
+
98
+ ```bash
99
+ cd vuer/examples/vuer
100
+ python 01_trimesh.py
101
+ ```
102
+
103
+ ## To Develop
104
+
105
+ ### Setting up the Document Site
106
+
107
+ https://www.docslikecode.com/learn/05-cd-for-docs/
108
+
109
+ ```bash
110
+ cd docs
111
+ pip install -r requirements.txt
112
+ ```
113
+
114
+
115
+
@@ -1,16 +1,16 @@
1
- vuer/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
1
+ vuer/__init__.py,sha256=HMgKfbQAW77ukrMOnE2oKNOYbSNEkBwElpkWxLofvP8,41
2
2
  vuer/base.py,sha256=mODsrpH8qePkfVjx5rXdXs7xjt2zpjcSOs_jzUpNbLI,3051
3
3
  vuer/events.py,sha256=hPCCGZxL090rz3u_ySB_vFB0d7tgOwdQVPNL487z37k,7069
4
4
  vuer/schemas.py,sha256=GRWe52b1A-AvtDurilxa2xfCrpUE1tBns6KqigYfE5o,14402
5
5
  vuer/serdes.py,sha256=_4q65iHmIW-Op5OCvNwgAy7Z4ofOcvuW3NfTbRfiuZo,2398
6
- vuer/server.py,sha256=GAoUv12eIESl4xwN66I2Bw9iNCt8ZQaNwDcibc_OpRQ,18553
6
+ vuer/server.py,sha256=i-ShDfxAr5KBXtgCTLDbbqpj1ExjaAROF_mv4P0jOSM,18521
7
7
  vuer/types.py,sha256=YpRQrBzB2uGM1Lhu8eSaBGB88IgSnY4Czl5cgthxGkM,1003
8
- vuer/__pycache__/__init__.cpython-38.pyc,sha256=552emB1vL_-Yy1EhBJ-dwKjJq-w2Q2qvImI8tmUpIsI,136
8
+ vuer/__pycache__/__init__.cpython-38.pyc,sha256=rS-9zzAjFEXnObk5q3E5Rex_uvoJ-Ccfz7Hs9DGNVgs,188
9
9
  vuer/__pycache__/base.cpython-38.pyc,sha256=cxwPAy8hWCo5t9TaTaaT1gs2MpByDbAOKCMVbqVldds,3930
10
10
  vuer/__pycache__/events.cpython-38.pyc,sha256=7NT7W5ObDyCz542mhDQkLWYzMOIP0Ihx7syjnJZT6lE,9409
11
11
  vuer/__pycache__/schemas.cpython-38.pyc,sha256=D0fWjYOBNPSbQkH_aR_-yOz4BZcgflUB6c6TjnTt2DI,19936
12
12
  vuer/__pycache__/serdes.cpython-38.pyc,sha256=oT1A94H8ayRCxNnw0L-7Q5Dt3535MOwXZMkvyQQvB9M,2032
13
- vuer/__pycache__/server.cpython-38.pyc,sha256=HuV-fzxh0siyjgj8g5xh5BLGAecNp2-6Hf7Hn_MZhEc,17276
13
+ vuer/__pycache__/server.cpython-38.pyc,sha256=aup7KkU3-iKB4LZKQRHmABOd7NQMw-iCNhl1geH4Um4,17318
14
14
  vuer/__pycache__/types.cpython-38.pyc,sha256=eM6bZ35nB-AYALbZXf9goHjLoHxllqbIwHloi0yCOeA,1868
15
15
  vuer/addons/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
16
  vuer/addons/nerf_vuer/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -21,9 +21,9 @@ vuer/addons/nerf_vuer/render_components.py,sha256=XilHnJySJWVgmdUbPFNYyc_YWV8O5A
21
21
  vuer/addons/nerf_vuer/render_nodes.py,sha256=5TKqIbMPiOtBxfF4FQI6uB0w_9FTfGiwS8xRbhPa0_g,14441
22
22
  vuer/addons/nerfuer/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
23
23
  vuer/addons/nerfuer/render_nodes.py,sha256=EJK5N3xne5n7abTaAoLPX7SRqQ_tEen9zNypvSnZTTw,4465
24
- vuer-0.0.13rc2.dist-info/LICENSE,sha256=MGF-inVBUaGe2mEjqT0g6XsHIXwoNXgNHqD7Z1MzR0k,1063
25
- vuer-0.0.13rc2.dist-info/METADATA,sha256=VsQP1rdqdgMHZxVb1BYvRXL6ScuXriglDga7Wp4USpo,1695
26
- vuer-0.0.13rc2.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
27
- vuer-0.0.13rc2.dist-info/entry_points.txt,sha256=J_NM6fbpipmD9oP7cdxd1UyBR8mVEQVx0xjlE_56yss,41
28
- vuer-0.0.13rc2.dist-info/top_level.txt,sha256=ermmVkwvGFAK4gfSgDIwOmKpxwpqNt-oo7gVQQUSHok,5
29
- vuer-0.0.13rc2.dist-info/RECORD,,
24
+ vuer-0.0.14.dist-info/LICENSE,sha256=MGF-inVBUaGe2mEjqT0g6XsHIXwoNXgNHqD7Z1MzR0k,1063
25
+ vuer-0.0.14.dist-info/METADATA,sha256=mn3k4HNequJaEJ4L3hPU3NcxJhbxy4bOH34IGtAhWRM,4122
26
+ vuer-0.0.14.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
27
+ vuer-0.0.14.dist-info/entry_points.txt,sha256=J_NM6fbpipmD9oP7cdxd1UyBR8mVEQVx0xjlE_56yss,41
28
+ vuer-0.0.14.dist-info/top_level.txt,sha256=ermmVkwvGFAK4gfSgDIwOmKpxwpqNt-oo7gVQQUSHok,5
29
+ vuer-0.0.14.dist-info/RECORD,,
@@ -1,80 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: vuer
3
- Version: 0.0.13rc2
4
- Home-page: https://github.com/geyang/vuer
5
- Author: Ge Yang<ge.ike.yang@gmail.com>
6
- Author-email: ge.ike.yang@gmail.com
7
- License: MIT
8
- Classifier: Development Status :: 3 - Alpha
9
- Classifier: Programming Language :: Python
10
- Requires-Python: >=3.8.6
11
- Description-Content-Type: text/markdown
12
- License-File: LICENSE
13
- Requires-Dist: aiohttp
14
- Requires-Dist: aiohttp-cors
15
- Requires-Dist: killport
16
- Requires-Dist: params-proto >=2.11.16
17
- Requires-Dist: pillow
18
- Requires-Dist: tqdm
19
- Requires-Dist: msgpack
20
- Requires-Dist: numpy
21
- Requires-Dist: termcolor
22
- Requires-Dist: trimesh
23
- Requires-Dist: websockets
24
- Provides-Extra: dev
25
- Requires-Dist: black ==22.3.0 ; extra == 'dev'
26
- Requires-Dist: pylint ==2.13.4 ; extra == 'dev'
27
- Requires-Dist: pytest ==7.1.2 ; extra == 'dev'
28
-
29
- # Vuer: A modern 3D Visualizer for Robotics and VR
30
-
31
- Vuer is a 3D visualization tool for robotics and VR applications.
32
-
33
- ## Installation In A Fresh Conda Environment
34
-
35
- Setup the conda environment
36
- ```bash
37
- conda create -n vuer python=3.8
38
- conda activate vuer
39
- ```
40
-
41
- Install vuer
42
- ```bash
43
- pip install vuer==0.0.9
44
-
45
- pip install numpy
46
- pip install trimesh
47
- pip install websockets
48
- pip install aiohttp-cors
49
- pip install pillow
50
- ```
51
-
52
- Now, to run the examples, first download the example datasets.
53
-
54
- Each subdirectory in the `assets` directory contains a `Makefile`. Run the `make` command in each subdirectory to download the datasets. For example:
55
-
56
- ```bash
57
- cd assets/static_3d
58
- make
59
- ```
60
-
61
- Then run the examples
62
-
63
- ```bash
64
- cd vuer/examples/vuer
65
- python 01_trimesh.py
66
- ```
67
-
68
- ## To Develop
69
-
70
- ### Setting up the Document Site
71
-
72
- https://www.docslikecode.com/learn/05-cd-for-docs/
73
-
74
- ```bash
75
- cd docs
76
- pip install -r requirements.txt
77
- ```
78
-
79
-
80
-