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

[Docs] MessagePack IDL, Pydantic Support, and Attribute Access #6022

Merged
merged 20 commits into from
Nov 21, 2024

Conversation

@Future-Outlier Future-Outlier changed the title [Docs] MessagePack IDL, Pydantic Support and Attribute Access [Docs] MessagePack IDL, Pydantic Support, and Attribute Access Nov 18, 2024
Copy link

codecov bot commented Nov 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 37.07%. Comparing base (d1a723e) to head (4515e31).
Report is 13 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6022      +/-   ##
==========================================
+ Coverage   37.03%   37.07%   +0.04%     
==========================================
  Files        1313     1316       +3     
  Lines      131622   132191     +569     
==========================================
+ Hits        48742    49007     +265     
- Misses      78652    78922     +270     
- Partials     4228     4262      +34     
Flag Coverage Δ
unittests-datacatalog 51.58% <ø> (ø)
unittests-flyteadmin 54.10% <ø> (+0.02%) ⬆️
unittests-flytecopilot 22.23% <ø> (ø)
unittests-flytectl 62.46% <ø> (ø)
unittests-flyteidl 7.25% <ø> (ø)
unittests-flyteplugins 53.72% <ø> (+0.03%) ⬆️
unittests-flytepropeller 42.65% <ø> (-0.47%) ⬇️
unittests-flytestdlib 57.59% <ø> (+2.42%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

Signed-off-by: Future-Outlier <[email protected]>

Flytekit version >= v1.14.0 will produce msgpack bytes literal for dataclasses.

If you're using Flytekit version >= v1.14.0 and you want to produce protobuf struct literal for dataclasses, you can
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be good to mention why would a user want to produce protobuf struct literal instead of msgpack bytes

.. tags:: Basic
```

When you've multiple values that you want to send across Flyte entities, and you want them to have, you can use a `pydantic.BaseModel`.
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure I understand this line

Copy link
Member Author

Choose a reason for hiding this comment

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

changed

Signed-off-by: Future-Outlier <[email protected]>
Signed-off-by: Future-Outlier <[email protected]>
@Future-Outlier Future-Outlier marked this pull request as ready for review November 20, 2024 04:52
Signed-off-by: Future-Outlier <[email protected]>
Signed-off-by: Future-Outlier <[email protected]>
Signed-off-by: Future-Outlier <[email protected]>
@davidmirror-ops
Copy link
Contributor

@Future-Outlier left some suggestions to improve clarity. I hope it helps

Future-Outlier and others added 2 commits November 21, 2024 08:22
Co-authored-by: David Espejo <[email protected]>
Signed-off-by: Han-Ru Chen (Future-Outlier) <[email protected]>
Co-authored-by: David Espejo <[email protected]>
Signed-off-by: Han-Ru Chen (Future-Outlier) <[email protected]>
@Future-Outlier
Copy link
Member Author

@Future-Outlier left some suggestions to improve clarity. I hope it helps

thank you so much David, will finish this today

Future-Outlier and others added 5 commits November 21, 2024 11:48
Co-authored-by: David Espejo <[email protected]>
Signed-off-by: Han-Ru Chen (Future-Outlier) <[email protected]>
Co-authored-by: David Espejo <[email protected]>
Signed-off-by: Han-Ru Chen (Future-Outlier) <[email protected]>
Co-authored-by: David Espejo <[email protected]>
Signed-off-by: Han-Ru Chen (Future-Outlier) <[email protected]>
Signed-off-by: Future-Outlier <[email protected]>
Signed-off-by: Future-Outlier <[email protected]>
With the 1.14 release, `flytekit` adopted `MessagePack` as the
serialization format for dataclasses, overcoming a major limitation of serialization into a JSON string within a Protobuf `struct` datatype, like the previous versions do:

to store `int` types, Protobuf's `struct` converts them to `float`, forcing users to write boilerplate code to work around this issue.
Copy link
Contributor

Choose a reason for hiding this comment

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

no need to insert a new line

Copy link
Member Author

Choose a reason for hiding this comment

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

I think insert a new line is more readable

By default, `flytekit >= 1.14` will produce `msgpack` bytes literals when serializing dataclasses.

:::{important}

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
By default, `flytekit >= 1.14` will produce `msgpack` bytes literals when serializing dataclasses.

:::{important}

If you're serializing dataclasses using `flytekit` version >= v1.14.0, and you want to produce Protobuf `struct
literal` instead, you can set environment variable `FLYTE_USE_OLD_DC_FORMAT` to `true`.
Copy link
Contributor

Choose a reason for hiding this comment

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

no need to insert a new line, I think it breaks the code format

Comment on lines 31 to 35
Flytekit version < v1.14.0 will produce protobuf struct literal for dataclasses.

Flytekit version >= v1.14.0 will produce msgpack bytes literal for dataclasses.

If you're using Flytekit version >= v1.14.0 and you want to produce protobuf struct literal for dataclasses, you can
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Flytekit version < v1.14.0 will produce protobuf struct literal for dataclasses.
Flytekit version >= v1.14.0 will produce msgpack bytes literal for dataclasses.
If you're using Flytekit version >= v1.14.0 and you want to produce protobuf struct literal for dataclasses, you can

Flytekit version >= v1.14.0 will produce msgpack bytes literal for dataclasses.

If you're using Flytekit version >= v1.14.0 and you want to produce protobuf struct literal for dataclasses, you can
set environment variable `FLYTE_USE_OLD_DC_FORMAT` to `true`.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
set environment variable `FLYTE_USE_OLD_DC_FORMAT` to `true`.

This was already mentioned above

Also in the readthedocs build, you can see there are two important blocks nested

```

`flytekit` version >=1.14 supports natively the `JSON` format that Pydantic `BaseModel` produces, enhancing the
interoperability of Pydantic BaseModels with the Flyte type system.
Copy link
Contributor

Choose a reason for hiding this comment

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

no need to insert new line


With the 1.14 release, `flytekit` adopted `MessagePack` as the serialization format for Pydantic `BaseModel`,
overcoming a major limitation of serialization into a JSON string within a Protobuf `struct` datatype like the previous versions do:

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change

With the 1.14 release, `flytekit` adopted `MessagePack` as the serialization format for Pydantic `BaseModel`,
overcoming a major limitation of serialization into a JSON string within a Protobuf `struct` datatype like the previous versions do:

to store `int` types, Protobuf's `struct` converts them to `float`, forcing users to write boilerplate code to work around this issue.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think new line after a colon (unless a list) looks strange

@davidmirror-ops
Copy link
Contributor

@Future-Outlier thank you for your patience. A few more suggestions, plus please make sure there are no nested important blocks.

Future-Outlier and others added 5 commits November 21, 2024 21:40
Co-authored-by: David Espejo <[email protected]>
Signed-off-by: Han-Ru Chen (Future-Outlier) <[email protected]>
Co-authored-by: David Espejo <[email protected]>
Signed-off-by: Han-Ru Chen (Future-Outlier) <[email protected]>
Co-authored-by: David Espejo <[email protected]>
Signed-off-by: Han-Ru Chen (Future-Outlier) <[email protected]>
Co-authored-by: David Espejo <[email protected]>
Signed-off-by: Han-Ru Chen (Future-Outlier) <[email protected]>
Signed-off-by: Future-Outlier <[email protected]>
@Future-Outlier Future-Outlier enabled auto-merge (squash) November 21, 2024 14:09
@Future-Outlier Future-Outlier enabled auto-merge (squash) November 21, 2024 14:18
Signed-off-by: Future-Outlier <[email protected]>
Copy link
Contributor

@davidmirror-ops davidmirror-ops left a comment

Choose a reason for hiding this comment

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

Thank you

@Future-Outlier Future-Outlier merged commit e13babb into master Nov 21, 2024
52 checks passed
@Future-Outlier Future-Outlier deleted the msgpack-idl-doc branch November 21, 2024 17:13
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