You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: python/README.md
+92Lines changed: 92 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,6 +6,9 @@ A Python library for efficient 3D mesh serialization using [meshoptimizer](https
6
6
7
7
```bash
8
8
pip install meshly
9
+
10
+
# With unit conversion support (pint)
11
+
pip install meshly[units]
9
12
```
10
13
11
14
## Features
@@ -15,6 +18,7 @@ pip install meshly
15
18
-**`Packable`**: Base class for automatic numpy/JAX array serialization to zip files
16
19
-**`Mesh`**: 3D mesh representation extending Packable with meshoptimizer encoding. Use factory methods: `from_triangles()`, `from_polygons()`, `create()`
17
20
-**`ArrayUtils`**: Utility class for extracting/reconstructing individual arrays
21
+
-**`Param`**: Unit-aware parameter field for Pydantic models (drop-in replacement for `Field`)
18
22
-**`PackableStore`**: File-based store for persistent storage with deduplication
19
23
-**`LazyModel`**: Lazy proxy that defers asset loading until field access
20
24
-**`Resource`**: Binary data reference that serializes by content checksum
@@ -28,6 +32,13 @@ pip install meshly
28
32
-**`IndexSequence`**: Optimized encoding for mesh indices (1D array)
29
33
-**`InlineArray`**: Array serialized as inline JSON list (no binary compression)
30
34
35
+
### Unit-Aware Parameters
36
+
37
+
-**`Param()`**: Drop-in replacement for `pydantic.Field()` that adds `units`, `shape`, and `example` metadata to the JSON schema
-**`Packable.to_example()`**: Class method that builds an instance from `Param()` example/default values
40
+
-**`Packable.with_units()`**: Returns a clone with numeric/array fields converted to `pint.Quantity` objects
41
+
31
42
### Key Capabilities
32
43
33
44
- Automatic encoding/decoding of numpy array attributes via `Array`, `IndexSequence`, `InlineArray` type annotations
@@ -184,6 +195,54 @@ class OptimizedMesh(Packable):
184
195
185
196
> **Note:** All dtypes are supported. Arrays with non-4-byte dtypes (e.g., `float16`, `int8`, `uint8`) are automatically padded to 4-byte alignment during encoding and unpadded during decoding (meshoptimizer requirement). For best performance, prefer 4-byte aligned dtypes like `float32`, `int32`, or `float64`.
186
197
198
+
### Unit-Aware Parameters with Param()
199
+
200
+
`Param()` is a drop-in replacement for `pydantic.Field()` that adds units, shape, and example metadata to the JSON schema. It works on any Pydantic `BaseModel` or `Packable` field, including `InlineArray`:
0 commit comments