Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EDU-3995: Update Python docs: Pydantic support #3364

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

dandavison
Copy link
Contributor

This PR updates the Python docs to cover the new Pydantic support.

This section was previously taken verbatim from the Python README (modulo Vale-isms) and this PR does the same.

@dandavison dandavison requested a review from a team as a code owner February 19, 2025 15:54
@brianmacdonald-temporal brianmacdonald-temporal changed the title Update Python docs: Pydantic support EDU-3995: Update Python docs: Pydantic support Feb 19, 2025
Copy link
Contributor

@jsundai jsundai left a comment

Choose a reason for hiding this comment

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

Did a quick review! Pretty easy changes to make.

Data Converters convert raw Temporal payloads to/from actual Python types.
A custom Data Converter of type `temporalio.converter.DataConverter` can be set via the `data_converter` client parameter.
Data converters convert raw Temporal payloads to/from actual Python types.
A custom Data Converter of type `temporalio.converter.DataConverter` can be set via the `data_converter` parameter of the `Client` constructor.
Copy link
Contributor

Choose a reason for hiding this comment

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

via -> 'through' or 'with'. We try to avoid latin terms.

A custom Data Converter of type `temporalio.converter.DataConverter` can be set via the `data_converter` client parameter.
Data converters convert raw Temporal payloads to/from actual Python types.
A custom Data Converter of type `temporalio.converter.DataConverter` can be set via the `data_converter` parameter of the `Client` constructor.
Data converters are a combination of payload converters, payload codecs, and failure converters.
Copy link
Contributor

Choose a reason for hiding this comment

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

Any words in the glossary, we generally try to capitalize. Data Converter, Payload Codecs, and Failure Converters.

A custom Data Converter of type `temporalio.converter.DataConverter` can be set via the `data_converter` parameter of the `Client` constructor.
Data converters are a combination of payload converters, payload codecs, and failure converters.
Payload converters convert Python values to/from serialized bytes.
Payload codecs convert bytes to bytes (e.g. for compression or encryption).
Copy link
Contributor

Choose a reason for hiding this comment

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

e.g -> For example. We avoid latin terms so it's clearer for more internationalization of the docs and it's a bit more translation friendly.


Although Workflows, Updates, Signals, and Queries can all be defined with multiple input parameters, users are strongly
encouraged to use a single `dataclass` or Pydantic model parameter, so that fields with defaults can be easily added
without breaking compatibility. Similar advice applies to return values.
Copy link
Contributor

Choose a reason for hiding this comment

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

We generally have every sentence on one line as a style so it's easier to comment on specific lines of text.


This Data Converter supports conversion of all types supported by Pydantic to and from JSON.

In addition to Pydantic models, these include all `json.dump`-able types, various non-`json.dump`-able standard library
Copy link
Contributor

Choose a reason for hiding this comment

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

Could this sentence be made more clearer or broken up so it's more direct?

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