Extension types support via msgspec.Encoder/Decoder hooks #19

Merged
goodboy merged 20 commits from ext_type_plds into py313_support 2025-03-27 21:34:12 +00:00

Primary new-feature summary

Namely, extension-types as msgspec.Struct fields such that you can now (more) easily define and configure dec/enc_hook() funcs to be used by our tractor.msg.MsgCodec/Dec internals:

  • c302b74008 Finally get type-extended msgspec fields workinn

    • By using our new PldRx design we can,
      • pass through the pld-spec & a dec_hook() to our MsgDec which is used to configure the underlying .dec: msgspec.msgpack.Decoder
      • pass through a enc_hook() to mk_codec() and use it to conf the equiv MsgCodec.enc such that sent msg-plds are converted prior to transport.
  • 29c3895 Namely moving enc/dec_type_union() from the test mod to a new tractor.msg._exts for use everywhere.

  • 08e15f441 Raise RTE from limit_plds() on no curr_ctx


  • e57ac63f56 Avoid attr-err when MsgTypeError._ipc_msg==None on sender side.

  • fde6d84 Fix msg-draining on parent_never_opened_stream!

    • this one is For-Serious good we caught it; thx @guilledk!
  • b0ab77a Slight PldRx rework to simplify, like

    • 01b5955 Add Context._outcome_msg use new PldRx API
    • 51f7280 Add MsgStream._stop_msg use new PldRx API
  • 4d9f6e73 Support ctx: UnionType annots for @tractor.context eps

  • ef7a585 Deliver a MaybeBoxedError from .expect_ctxc()


  • b6e49029 reworked test suite test_ext_types_msgspec.py,
    • rename and massively simplify to a new test_ext_types_over_ipc which avoids all the wacky “parent dictates what sender should be able to send beforehand”, instead
    • keeping it simple and just always try to send the same small set of types over the wire with expect-logic to handle each case.
  • 37b8d77 Extend ctx semantics suite for streaming edge cases!
Primary new-feature summary --------------------------- Namely, extension-types as `msgspec.Struct` fields such that you can now (more) easily define and configure `dec/enc_hook()` funcs to be used by our `tractor.msg.MsgCodec/Dec` internals: - c302b74008 Finally get type-extended `msgspec` fields workinn - By using our new `PldRx` design we can, - pass through the pld-spec & a `dec_hook()` to our `MsgDec` which is used to configure the underlying `.dec: msgspec.msgpack.Decoder` - pass through a `enc_hook()` to `mk_codec()` and use it to conf the equiv `MsgCodec.enc` such that sent msg-plds are converted prior to transport. - 29c3895 Namely moving `enc/dec_type_union()` from the test mod to a new `tractor.msg._exts` for use everywhere. - 08e15f441 Raise RTE from `limit_plds()` on no `curr_ctx` --- Various (and some very serious) fixes to the `tractor.msg` related underbelly, --------------------------- - e57ac63f56 Avoid attr-err when `MsgTypeError._ipc_msg==None` on sender side. - fde6d84 Fix msg-draining on `parent_never_opened_stream`! - this one is **For-Serious** good we caught it; thx @guilledk! - b0ab77a Slight `PldRx` rework to simplify, like - 01b5955 Add `Context._outcome_msg` use new `PldRx` API - 51f7280 Add `MsgStream._stop_msg` use new `PldRx` API - 4d9f6e73 Support `ctx: UnionType` annots for `@tractor.context` eps - ef7a585 Deliver a `MaybeBoxedError` from `.expect_ctxc()` --- Testing related fixes & improvements, --------------------------- - b6e49029 reworked test suite `test_ext_types_msgspec.py`, - rename and massively simplify to a new `test_ext_types_over_ipc` which avoids all the wacky "parent dictates what sender should be able to send beforehand", instead - keeping it simple and just always try to send the same small set of types over the wire with expect-logic to handle each case. - 37b8d77 Extend ctx semantics suite for streaming edge cases!
goodboy force-pushed ext_type_plds from b85f301c05 to 8d12ece8d6 2025-03-25 20:01:05 +00:00 Compare
goodboy requested review from guille 2025-03-27 18:09:40 +00:00
goodboy requested review from jc211 2025-03-27 18:09:40 +00:00
goodboy force-pushed ext_type_plds from 8d12ece8d6 to 6b8bd950fb 2025-03-27 18:40:15 +00:00 Compare
goodboy force-pushed ext_type_plds from 6b8bd950fb to eb12029372 2025-03-27 19:51:44 +00:00 Compare
Poster
Owner

Fyi prior to this landing the main branch should have the following failures (see screenshot) since obvi this patchset reworks that suite entirely.

Fyi prior to this landing the `main` branch should have the following failures (see screenshot) since obvi this patchset reworks that suite entirely.
guille approved these changes 2025-03-27 21:09:20 +00:00
goodboy merged commit 849fae2515 into py313_support 2025-03-27 21:34:12 +00:00
Poster
Owner

Lol woops meant for this to be switched to main..

Lol woops meant for this to be switched to `main`..
Poster
Owner

Just did the git merge --no-ff manually and added the same commit msg that gitea would’ve

Bp

Just did the `git merge --no-ff` manually and added the same commit msg that `gitea` would've Bp
Sign in to join this conversation.
No reviewers
No Label
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: goodboy/tractor#19
There is no content yet.