Skip to content

Split converter.py into submodules#1365

Open
jmaeagle99 wants to merge 5 commits intotemporalio:mainfrom
jmaeagle99:converter-breakup
Open

Split converter.py into submodules#1365
jmaeagle99 wants to merge 5 commits intotemporalio:mainfrom
jmaeagle99:converter-breakup

Conversation

@jmaeagle99
Copy link
Contributor

What was changed

  • Broke up the monolithic temporalio/converter.py (~2,100 lines) into a proper Python package under temporalio/converter/ with the following submodules:
    • _serialization_context.pySerializationContext, WorkflowSerializationContext, ActivitySerializationContext, WithSerializationContext
    • _payload_converter.pyPayloadConverter, EncodingPayloadConverter, CompositePayloadConverter, DefaultPayloadConverter, and all concrete encoding implementations (BinaryNull, BinaryPlain, JSONProto, BinaryProto, JSONPlain, JSONTypeConverter)
    • _payload_limits.pyPayloadLimitsConfig, PayloadSizeWarning, _PayloadSizeError, _ServerPayloadErrorLimits
    • _payload_codec.pyPayloadCodec and _apply_to_failure_payloads (moved out of DataConverter to break a potential circular dependency)
    • _failure_converter.pyFailureConverter, DefaultFailureConverter, DefaultFailureConverterWithEncodedAttributes
    • _data_converter.pyDataConverter and default()
    • _search_attributes.py — all search attribute encode/decode utilities
  • __init__.py re-exports all public names and handles module-level initialization (DataConverter.default, PayloadConverter.default, FailureConverter.default), preserving full backward compatibility — no call sites outside the package required changes
  • __all__ defined in __init__.py to suppress F401 linter warnings and make the public API explicit; private names (_PayloadSizeError, etc.) are not re-exported but remain accessible via their submodules
  • Internal callers in temporalio/worker/ and temporalio/client.py updated to reference private types directly from their submodule (e.g. temporalio.converter._payload_limits._ServerPayloadErrorLimits) rather than through the package namespace
  • Both submodule loggers use getLogger("temporalio.converter") to preserve the original log namespace

Why?

Separate the concerns of each composite area and allow other changes (such as #1341) to not introduce circular dependencies.

Checklist

  1. How was this tested: Existing tests
  2. Any docs updates needed? No

@jmaeagle99 jmaeagle99 requested a review from a team as a code owner March 16, 2026 01:43
Copy link
Contributor

@tconley1428 tconley1428 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing this.

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.

2 participants