tractor
tractor copied to clipboard
Toying with a message type for "object references"
As a future requirement and probably large convenience for many users looking to "pass around remote python objects" (in a message native way) in actors (https://github.com/goodboy/tractor/issues/191, https://github.com/goodboy/tractor/issues/5) i've started toying with some ideas for making a built-in message-serialization compatible type that we can offer as part of our public sugar apis.
The main set of tools include
msgpacktype extensions (since that's our only official codec atm):- https://jcristharif.com/msgspec/extending.html
- alternatively we could go full struct style https://jcristharif.com/msgspec/api.html#struct
- https://github.com/msgpack/msgpack-python#packingunpacking-of-custom-data-type
- https://jcristharif.com/msgspec/extending.html
- the new
pkgutils.resolve_name()resolver in py 3.9
I have a draft implementation for a str derivative which gets us a nice compact api for conversion between str and object references and could likely be integrated with our enable_modules:list[str] "module capability per actor" system to get us moving in the cap-based-sec direction.
I'll put up a matching PR shortly 😎
Also added a couple todo lists in the module for any aspiring messageers to have a go at 😉