vuer 0.0.23__py3-none-any.whl → 0.0.25__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
@@ -1 +1,13 @@
1
- from vuer.server import Vuer, VuerSession
1
+ # Conditional import for the pyScript.
2
+ try:
3
+ from vuer.server import Vuer, VuerSession
4
+ except ImportError:
5
+ print("""
6
+ By default, vuer does not include the aiohttp and aiohttp-cors packages
7
+ to enable installation in PyScript environments. For most usecase, you
8
+ should install with the [all] option to include all dependencies.
9
+
10
+ pip install 'vuer[all]'
11
+
12
+ Use `'` if using zsh since `[` is a special character.
13
+ """)
Binary file
Binary file
vuer/base.py CHANGED
@@ -1,11 +1,12 @@
1
1
  import asyncio
2
2
  import traceback
3
+ import aiohttp_cors
4
+
3
5
  from collections.abc import Coroutine
4
6
  from concurrent.futures import CancelledError
5
7
  from functools import partial
6
8
  from pathlib import Path
7
9
 
8
- import aiohttp_cors
9
10
  from aiohttp import web
10
11
  from params_proto import Proto
11
12
 
@@ -25,8 +26,8 @@ async def websocket_handler(request, handler, **ws_kwargs):
25
26
  except ConnectionResetError:
26
27
  print("Connection reset")
27
28
 
28
- except CancelledError as exp:
29
- print(f"WebSocket Canceled")
29
+ except CancelledError:
30
+ print("WebSocket Canceled")
30
31
 
31
32
  except Exception as exp:
32
33
  print(f"Error:\n{exp}\n{traceback.print_exc()}")
@@ -51,7 +52,7 @@ class Server:
51
52
  cors = Proto(help="Enable CORS", default="*")
52
53
  port = Proto(env="PORT", default=8012)
53
54
 
54
- WEBSOCKET_MAX_SIZE = 2**28
55
+ WEBSOCKET_MAX_SIZE = 2 ** 28
55
56
 
56
57
  def __post_init__(self):
57
58
  self.app = web.Application()
@@ -67,10 +68,10 @@ class Server:
67
68
  self.cors_context = aiohttp_cors.setup(self.app, defaults=cors_config)
68
69
 
69
70
  def _route(
70
- self,
71
- path: str,
72
- handler: callable,
73
- method: str = "GET",
71
+ self,
72
+ path: str,
73
+ handler: callable,
74
+ method: str = "GET",
74
75
  ):
75
76
  route = self.app.router.add_resource(path).add_route(method, handler)
76
77
  self.cors_context.add(route)
@@ -9,14 +9,18 @@ class Scene(BlockElement):
9
9
  tag = "Scene"
10
10
 
11
11
  def __init__(
12
- self,
13
- *children,
14
- rawChildren=None,
15
- htmlChildren=None,
16
- bgChildren=None,
17
- # default to y-up to be consistent with three.js. Blender uses z-up though.
18
- up=[0, 1, 0],
19
- **kwargs,
12
+ self,
13
+ *children,
14
+ rawChildren=None,
15
+ htmlChildren=None,
16
+ bgChildren=None,
17
+ # default to y-up to be consistent with three.js. Blender uses z-up though.
18
+ up=[0, 1, 0],
19
+ # background=None,
20
+ # bgLight=None,
21
+ # bgDark=None,
22
+ # grid=True,
23
+ **kwargs,
20
24
  ):
21
25
  super().__init__(*children, up=up, **kwargs)
22
26
  self.rawChildren = rawChildren or []
@@ -114,6 +118,7 @@ class TriMesh(SceneElement):
114
118
  # note: Uint16 is too few. Quickly overflows
115
119
  faces: NDArray[np.uint32] = None
116
120
  colors: NDArray[np.uint8] = None
121
+ uv: NDArray[np.float16] = None
117
122
 
118
123
  def __post_init__(self, **kwargs):
119
124
  self.vertices = self.vertices.astype(np.float16).flatten().tobytes()
@@ -121,18 +126,19 @@ class TriMesh(SceneElement):
121
126
  # uinit16 is too few at 65536. Have to use uint32.
122
127
  self.faces = self.faces.astype(np.uint32).flatten().tobytes()
123
128
 
124
- if self.colors is None:
125
- return
129
+ if self.colors is not None:
130
+ if self.colors.shape[-1] == 4:
131
+ self.colors = self.colors[:, :3]
126
132
 
127
- if self.colors.shape[-1] == 4:
128
- self.colors = self.colors[:, :3]
133
+ # send only integers: https://stackoverflow.com/questions/34669537
134
+ if self.colors.dtype != np.uint8:
135
+ self.colors *= 255
136
+ self.colors = self.colors.astype(np.uint8)
129
137
 
130
- # send only integers: https://stackoverflow.com/questions/34669537
131
- if self.colors.dtype != np.uint8:
132
- self.colors *= 255
133
- self.colors = self.colors.astype(np.uint8)
138
+ self.colors = self.colors.flatten().tobytes()
134
139
 
135
- self.colors = self.colors.flatten().tobytes()
140
+ if self.uv is not None:
141
+ self.uv = self.uv.astype(np.float16).flatten().tobytes()
136
142
 
137
143
 
138
144
  class PointCloud(SceneElement):
@@ -270,16 +276,22 @@ class Fog(SceneElement):
270
276
  Fog is a scene element that adds fog to the scene. This
271
277
  can be used to approximate depth.
272
278
 
273
- Arguments:
274
- args: color, near, far
279
+ Args:
280
+ color: The color of the fog.
281
+ near: The distance to the near plane.
282
+ far: The distance to the far plane.
275
283
 
276
284
  Example Usage:
277
- Fog(args=[0xcccccc, 10, 15])
278
285
 
286
+ Fog(color="green", near=3, far=7)
279
287
  """
280
288
 
281
289
  tag = "fog"
282
290
 
291
+ def __init__(self, *, children=None, color=None, near=None, far=None, **kwargs):
292
+ assert children is None, "Fog does not support children."
293
+ super().__init__(attach="fog", key="fog", color=color, near=near, far=far, **kwargs)
294
+
283
295
 
284
296
  class Wireframe(SceneElement):
285
297
  tag = "Wireframe"
@@ -508,17 +520,17 @@ class DefaultScene(Scene):
508
520
  """
509
521
 
510
522
  def __init__(
511
- self,
512
- *children: SceneElement,
513
- rawChildren: List[SceneElement] = None,
514
- htmlChildren: List[Element] = None,
515
- bgChildren: List[SceneElement] = [],
516
- show_helper=True,
517
- startStep=0,
518
- endStep=None,
519
- # default to z-up
520
- up=[0, 0, 1],
521
- **kwargs,
523
+ self,
524
+ *children: SceneElement,
525
+ rawChildren: List[SceneElement] = None,
526
+ htmlChildren: List[Element] = None,
527
+ bgChildren: List[SceneElement] = [],
528
+ show_helper=True,
529
+ startStep=0,
530
+ endStep=None,
531
+ # default to z-up
532
+ up=[0, 0, 1],
533
+ **kwargs,
522
534
  ):
523
535
  rawChildren = [
524
536
  AmbientLight(intensity=1.0, key="default_ambient_light"),
@@ -1,39 +1,46 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: vuer
3
- Version: 0.0.23
3
+ Version: 0.0.25
4
4
  Home-page: https://github.com/geyang/vuer
5
5
  Author: Ge Yang<ge.ike.yang@gmail.com>
6
6
  Author-email: ge.ike.yang@gmail.com
7
7
  License: MIT
8
8
  Classifier: Development Status :: 3 - Alpha
9
9
  Classifier: Programming Language :: Python
10
- Requires-Python: >=3.8.6
10
+ Requires-Python: >=3.7
11
11
  Description-Content-Type: text/markdown
12
12
  License-File: LICENSE
13
- Requires-Dist: aiohttp
14
- Requires-Dist: aiohttp-cors
15
13
  Requires-Dist: killport
16
14
  Requires-Dist: params-proto >=2.11.16
17
15
  Requires-Dist: pillow
18
- Requires-Dist: tqdm
19
16
  Requires-Dist: msgpack
20
17
  Requires-Dist: numpy
21
- Requires-Dist: termcolor
22
- Requires-Dist: trimesh
23
18
  Requires-Dist: websockets
19
+ Provides-Extra: all
20
+ Requires-Dist: aiohttp ; extra == 'all'
21
+ Requires-Dist: aiohttp-cors ; extra == 'all'
24
22
  Provides-Extra: dev
23
+ Requires-Dist: aiohttp ; extra == 'dev'
24
+ Requires-Dist: aiohttp-cors ; extra == 'dev'
25
25
  Requires-Dist: black ==22.3.0 ; extra == 'dev'
26
26
  Requires-Dist: pylint ==2.13.4 ; extra == 'dev'
27
27
  Requires-Dist: pytest ==7.1.2 ; extra == 'dev'
28
-
29
- <h2>Vuer: Modern High-Performance Visualization for AI & Robotics in VR
28
+ Requires-Dist: sphinx ==7.1.2 ; extra == 'dev'
29
+ Requires-Dist: furo ; extra == 'dev'
30
+ Requires-Dist: sphinx-copybutton ; extra == 'dev'
31
+ Requires-Dist: myst-parser ; extra == 'dev'
32
+ Requires-Dist: termcolor ; extra == 'dev'
33
+ Requires-Dist: trimesh ; extra == 'dev'
34
+ Requires-Dist: tqdm ; extra == 'dev'
35
+
36
+ <h2>Vuer: Modern High-Performance Visualization for AI & Robotics in VR
30
37
  <br/>
31
38
  <img src="https://api.netlify.com/api/v1/badges/2df7f3ba-1a26-4047-b76a-d7401f907bb5/deploy-status" alt="Production">
32
39
  <a href="https://pypi.org/project/vuer/">
33
- <img src="https://img.shields.io/pypi/v/vuer.svg" alt="pypi">
40
+ <img src="https://img.shields.io/pypi/v/vuer.svg" alt="pypi">
34
41
  </a>
35
42
  <a href="https://docs.vuer.ai">
36
- <img src="https://readthedocs.org/projects/vuer-py/badge/?version=latest">
43
+ <img src="https://readthedocs.org/projects/vuer-py/badge/?version=latest">
37
44
  </a>
38
45
  </h2>
39
46
  <p>
@@ -43,9 +50,10 @@ visit &ensp;<a href="https://docs.vuer.ai">https://docs.vuer.ai</a>&ensp; for do
43
50
  </p>
44
51
 
45
52
  Vuer is a light-weight visualization toolkit for interacting with dynamic 3D and robotics data. It is
46
- VR and AR ready, and can be run on mobile devices.
53
+ VR and AR ready, and can be run on mobile devices.
47
54
 
48
55
  Our features include:
56
+
49
57
  - light-weight and performant
50
58
  - VR and AR ready
51
59
  - Hackable and extensible
@@ -53,14 +61,14 @@ Our features include:
53
61
 
54
62
  ## Installation
55
63
 
56
-
57
64
  You can install `vuer` with `pip`:
58
65
 
59
66
  ```shell
60
- pip install vuer
67
+ pip install -U 'vuer[all]'
61
68
  ```
62
69
 
63
- 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.
70
+ 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
71
+ the [examples](https://docs.vuer.ai/en/latest/examples.html) page.
64
72
 
65
73
  ```python
66
74
  from vuer import Vuer, VuerSession
@@ -91,9 +99,10 @@ the [API documentation on Components](https://docs.vuer.ai/en/latest/api.html).
91
99
 
92
100
  For a comprehensive list of data types, please refer to the [API documentation on Data Types](https://docs.vuer.ai/en/latest/api.html).
93
101
 
94
- Now, to run the examples, first download the example datasets.
102
+ Now, to run the examples, first download the example datasets.
95
103
 
96
- Each subdirectory in the `assets` directory contains a `Makefile`. Run the `make` command in each subdirectory to download the datasets. For example:
104
+ Each subdirectory in the `assets` directory contains a `Makefile`. Run the `make` command in each subdirectory to download the datasets. For
105
+ example:
97
106
 
98
107
  ```bash
99
108
  cd assets/static_3d
@@ -110,11 +119,12 @@ python 01_trimesh.py
110
119
  ## Contributing to Documentation and Features
111
120
 
112
121
  Documentation is a crucial part of the `vuer` ecosystem. To contribute to documentation and usage examples, simply:
122
+
113
123
  ```bash
114
- cd docs
115
- pip install -r requirements.txt
124
+ pip install -e '.[dev]'
125
+ make docs
116
126
  ```
117
-
127
+ This should fire up an http server at the port `8888`, and you can view the documentation at `http://localhost:8888`.
118
128
 
119
129
  ## About Us
120
130
 
@@ -1,16 +1,16 @@
1
- vuer/__init__.py,sha256=HMgKfbQAW77ukrMOnE2oKNOYbSNEkBwElpkWxLofvP8,41
2
- vuer/base.py,sha256=R-PtD39ouihiEGmSfJL26chlU0XkFJP-JmBNYzDdEvM,3068
1
+ vuer/__init__.py,sha256=cP-Ua-bx3mq-3hsnFHAbiGwTnm25hm4wcXp1KhMKCJg,455
2
+ vuer/base.py,sha256=T6zLf21Taknzc8766Af54_iCu1UNdU1cSJDcuDVcqiY,3079
3
3
  vuer/events.py,sha256=8AAzkfbm5jHkeMh17Z57n8YTxF4mheWC3Qbya4XkQSc,7291
4
4
  vuer/schemas.py,sha256=aZOocE02gO43SLLfeYSxxac0x38TmyTcfs_iFh5hsJ4,18152
5
5
  vuer/serdes.py,sha256=gD2iA9Yypu1QjocneOT3Nc0y6q_mdHn9zW1ko5j3I7c,2600
6
6
  vuer/server.py,sha256=prJVBaNdWEfz2aIdUDZHY70i34zuQLO63P3F6hSenCk,20889
7
7
  vuer/types.py,sha256=N2KLa0fl6z8Jm6cJwZoD8Vqrins_AayG5BCGk1p3Eek,1279
8
- vuer/__pycache__/__init__.cpython-38.pyc,sha256=rS-9zzAjFEXnObk5q3E5Rex_uvoJ-Ccfz7Hs9DGNVgs,188
8
+ vuer/__pycache__/__init__.cpython-38.pyc,sha256=AGYwJRSMg5cOJ06a6e5KJl20TiGnZjvVjdqlwLMmjLc,188
9
9
  vuer/__pycache__/base.cpython-38.pyc,sha256=Z5EFlRX9RqZsQUszvqPtAhLv_5QG5wlUXW7JbFd_XDc,3824
10
10
  vuer/__pycache__/events.cpython-38.pyc,sha256=zx3bXeJixqOyCFe2nA7qpq6jiCJ49kRaXO-xONGUyeQ,9616
11
11
  vuer/__pycache__/schemas.cpython-38.pyc,sha256=hvY9Aak8zE-zKcWiwuNe6DghOw9qH_zSe_FtkBOAPPk,23234
12
12
  vuer/__pycache__/serdes.cpython-38.pyc,sha256=KMxTjPEWuSGn2bqBAl5OLIDSCSoqfPDGfk3fvNnRDYA,2253
13
- vuer/__pycache__/server.cpython-38.pyc,sha256=efkA35akgB8qZzk-BWgiqrIJigp0AjvLQ6yC-mLX0aA,19641
13
+ vuer/__pycache__/server.cpython-38.pyc,sha256=9VZF8i5IfMkHXR0GrigX1-fJqukfG4TOYkQT6MdnNNA,19641
14
14
  vuer/__pycache__/types.cpython-38.pyc,sha256=IhlXtkT-XWM0V1420FDuoqIYnpvRvekYVkGqEK7fAV8,1819
15
15
  vuer/addons/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
16
  vuer/addons/nerf_vuer/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -24,14 +24,14 @@ vuer/addons/nerfuer/render_nodes.py,sha256=EJK5N3xne5n7abTaAoLPX7SRqQ_tEen9zNypv
24
24
  vuer/schemas/__init__.py,sha256=ZI6UyeLZXqJbHmp6LiE3Q3mHvt1zeV-SJmmcqq-wBZE,94
25
25
  vuer/schemas/drei_components.py,sha256=U9svEOnNprhZaobLagaFnqEtZxo5hiriSqjDnvQutoA,6989
26
26
  vuer/schemas/html_components.py,sha256=NCqmSPic-ExPrXqNPXbKjtTXMB8sGBywIpE6cXpiy08,5926
27
- vuer/schemas/scene_components.py,sha256=R91MBkxCqVGe_ciG0B3UGE4_q3GHauZ1QXIbGMvHMGE,15863
27
+ vuer/schemas/scene_components.py,sha256=3u8q2AwgpkkAVifsNXXagmHIvJvWqDwlHCS-QbOwZRM,16540
28
28
  vuer/schemas/__pycache__/__init__.cpython-38.pyc,sha256=NRnVrpIDBKne93xOUY1-WpavCG7vwYiqU3VDTEEwuUE,221
29
29
  vuer/schemas/__pycache__/drei_components.cpython-38.pyc,sha256=g_ufcKxf-XKfZLdUV-HqKnjIrgxGWFv51aHLWQgH-ws,7712
30
30
  vuer/schemas/__pycache__/html_components.cpython-38.pyc,sha256=q0DMFwNkYbnaH1A8w3BowMiQAlmGpFWOOKsjLVE6CIk,8215
31
- vuer/schemas/__pycache__/scene_components.cpython-38.pyc,sha256=8v2PNB2aUVr-5C8AwBEQ8zpp2744P4KY26398XmaM1o,19161
32
- vuer-0.0.23.dist-info/LICENSE,sha256=MGF-inVBUaGe2mEjqT0g6XsHIXwoNXgNHqD7Z1MzR0k,1063
33
- vuer-0.0.23.dist-info/METADATA,sha256=R6TijGkm9A7M8SfEcYmwc5Cc7TVWByKXXRq6CJtaC8I,4277
34
- vuer-0.0.23.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
35
- vuer-0.0.23.dist-info/entry_points.txt,sha256=J_NM6fbpipmD9oP7cdxd1UyBR8mVEQVx0xjlE_56yss,41
36
- vuer-0.0.23.dist-info/top_level.txt,sha256=ermmVkwvGFAK4gfSgDIwOmKpxwpqNt-oo7gVQQUSHok,5
37
- vuer-0.0.23.dist-info/RECORD,,
31
+ vuer/schemas/__pycache__/scene_components.cpython-38.pyc,sha256=2jBvnUfJeoy24SMQdYvHzxXL-BwY0cXBCt9LDMk-Nw8,19670
32
+ vuer-0.0.25.dist-info/LICENSE,sha256=MGF-inVBUaGe2mEjqT0g6XsHIXwoNXgNHqD7Z1MzR0k,1063
33
+ vuer-0.0.25.dist-info/METADATA,sha256=bhipMPQyCeX2VbazZyVsFWh_GAG_PsAqQSv88ut2rAo,4754
34
+ vuer-0.0.25.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
35
+ vuer-0.0.25.dist-info/entry_points.txt,sha256=J_NM6fbpipmD9oP7cdxd1UyBR8mVEQVx0xjlE_56yss,41
36
+ vuer-0.0.25.dist-info/top_level.txt,sha256=ermmVkwvGFAK4gfSgDIwOmKpxwpqNt-oo7gVQQUSHok,5
37
+ vuer-0.0.25.dist-info/RECORD,,
File without changes
File without changes