@@ -84,7 +84,6 @@ informal introduction to the features and their implementation.
8484 - [ Extending Restricted Classes] ( #extending-restricted-classes )
8585 - [ Certain Standard Library Calls on Restricted Objects] ( #certain-standard-library-calls-on-restricted-objects )
8686 - [ is_subclass of ABC-based Restricted Classes] ( #is_subclass-of-abc-based-restricted-classes )
87- - [ Compiled Pydantic Sometimes Using Wrong Types] ( #compiled-pydantic-sometimes-using-wrong-types )
8887 - [ Activities] ( #activities )
8988 - [ Definition] ( #definition-1 )
9089 - [ Types of Activities] ( #types-of-activities )
@@ -312,11 +311,6 @@ The default data converter supports converting multiple types including:
312311 * Anything that [ ` json.dump ` ] ( https://docs.python.org/3/library/json.html#json.dump ) supports natively
313312 * [ dataclasses] ( https://docs.python.org/3/library/dataclasses.html )
314313 * Iterables including ones JSON dump may not support by default, e.g. ` set `
315- * Any class with a ` dict() ` method and a static ` parse_obj() ` method, e.g.
316- [ Pydantic models] ( https://pydantic-docs.helpmanual.io/usage/models )
317- * The default data converter is deprecated for Pydantic models and will warn if used since not all fields work.
318- See [ this sample] ( https://github.com/temporalio/samples-python/tree/main/pydantic_converter ) for the recommended
319- approach.
320314 * [ IntEnum, StrEnum] ( https://docs.python.org/3/library/enum.html ) based enumerates
321315 * [ UUID] ( https://docs.python.org/3/library/uuid.html )
322316
@@ -325,6 +319,14 @@ This notably doesn't include any `date`, `time`, or `datetime` objects as they m
325319Users are strongly encouraged to use a single ` dataclass ` for parameter and return types so fields with defaults can be
326320easily added without breaking compatibility.
327321
322+ To use pydantic model instances (or python objects containing pydantic model instances), use
323+ ``` python
324+ from temporalio.contrib.pydantic import pydantic_data_converter
325+
326+ client = Client(data_converter = pydantic_data_converter, ... )
327+ ```
328+ Do not use pydantic's [ strict mode] ( https://docs.pydantic.dev/latest/concepts/strict_mode/ ) .
329+
328330Classes with generics may not have the generics properly resolved. The current implementation does not have generic
329331type resolution. Users should use concrete types.
330332
@@ -1133,15 +1135,6 @@ Due to [https://bugs.python.org/issue44847](https://bugs.python.org/issue44847),
11331135checked to see if they are subclasses of another via ` is_subclass ` may fail (see also
11341136[ this wrapt issue] ( https://github.com/GrahamDumpleton/wrapt/issues/130 ) ).
11351137
1136- ###### Compiled Pydantic Sometimes Using Wrong Types
1137-
1138- If the Pydantic dependency is in compiled form (the default) and you are using a Pydantic model inside a workflow
1139- sandbox that uses a ` datetime ` type, it will grab the wrong validator and use ` date ` instead. This is because our
1140- patched form of ` issubclass ` is bypassed by compiled Pydantic.
1141-
1142- To work around, either don't use ` datetime ` -based Pydantic model fields in workflows, or mark ` datetime ` library as
1143- passthrough (means you lose protection against calling the non-deterministic ` now() ` ), or use non-compiled Pydantic
1144- dependency.
11451138
11461139### Activities
11471140
0 commit comments