Skip to content

Refactor meshly library for improved encoding/decoding with nested Packable cache support#13

Merged
afshawnlotfi merged 3 commits intomainfrom
improvement/encoding
Jan 14, 2026
Merged

Refactor meshly library for improved encoding/decoding with nested Packable cache support#13
afshawnlotfi merged 3 commits intomainfrom
improvement/encoding

Conversation

@afshawnlotfi
Copy link
Member

This PR refactors the meshly library to improve the encoding/decoding architecture and adds cache support for nested Packables in both Python and TypeScript.


Encoding/Decoding Improvements

  • Python: Updated encode() to return bytes instead of arrays for consistency
  • TypeScript: Renamed API from "loading" to "decoding" to better reflect operations
  • Array utilities: Enhanced ArrayUtils for loading and decoding arrays from zip files
  • Custom field decoding: Implemented CustomFieldConfig pattern in Packable class for extensibility
  • Mesh class: Added custom field configurations for vertices and indices decoding
  • Removed obsolete utility classes related to zip file operations

Nested Packable Cache Support

  • New types: Introduced CacheLoader and CacheSaver callback types for flexible cache backends
  • Handler factories: Added ReadHandler.create_cache_loader() and WriteHandler.create_cache_saver() for easy filesystem caching
  • Content-addressable storage: Nested Packables are stored by SHA256 hash, enabling deduplication
  • Deduplication: Identical nested Packables shared across multiple parent objects are stored only once
  • TypeScript support: Added CacheLoader type and cacheLoader parameter to decode() methods

Testing

  • Updated Python tests to verify encoding returns bytes
  • Modified JAX support tests to use new array_type parameter
  • Added consistency checks for encode/decode roundtrips
  • Added tests for nested Packable caching functionality

Documentation

  • Updated Python README with "Nested Packables" and "Caching Nested Packables" sections
  • Updated TypeScript README with "Cache Support" section
  • Added CacheLoader/CacheSaver to API reference
  • Updated method signatures to reflect new cache parameters

Python Tests: 148 passing ✅
TypeScript Tests: 15 passing ✅

- Updated Python tests to verify encoding returns bytes instead of arrays.
- Modified JAX support tests to use new array_type parameter for loading meshes.
- Adjusted packable tests to ensure encode produces bytes and added consistency checks.
- Revised TypeScript README to reflect changes from loading to decoding meshes.
- Enhanced array utility functions for loading and decoding arrays from zip files.
- Removed obsolete utility classes and methods related to zip file operations.
- Implemented custom field decoding in the Packable class for better extensibility.
- Updated Mesh class to handle custom field configurations and decoding for vertices and indices.
- Introduced CacheLoader and CacheSaver types for handling cached Packables.
- Updated Packable class to support saving and loading nested Packables with caching.
- Implemented cache deduplication for identical nested Packables.
- Enhanced ArrayUtils to skip Packable instances during extraction.
- Added tests for nested Packable caching functionality.
- Updated TypeScript definitions and README to reflect new cache support features.
@afshawnlotfi afshawnlotfi merged commit 8335122 into main Jan 14, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments