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

Implement attrs-based payload encoding helpers #935

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

Conversation

sirosen
Copy link
Member

@sirosen sirosen commented Jan 5, 2024

This PR is a proposal for a new impelmentation of payload definitions for primary use in SDK v4 and for any new payload classes under v3.


This first implementation introduces a new subpackage, globus_sdk.payload which is integrated into the transport layer's request encoding logic.

globus_sdk.payload.Payload defines a base class for @attrs.defined classes, providing support for an extra parameter for what we have historically named addtional_fields.

Payload also gives us a type for usage in type hints for the transport layer and base client, and provides an asdict method which handles any specialized pre-transport encoding steps. For the base this is the handling of extra, but subclasses can extend it if necessary.


📚 Documentation preview 📚: https://globus-sdk-python--935.org.readthedocs.build/en/935/

This first implementation introduces a new subpackage,
`globus_sdk.payload` which is integrated into the transport layer's
request encoding logic.

`globus_sdk.payload.Payload` defines a base class for `@attrs.define`d
classes, providing support for an `extra` parameter for what we have
historically named `addtional_fields`.

`Payload` also gives us a type for usage in type hints for the
transport layer and base client, and provides an `asdict` method which
handles any specialized pre-transport encoding steps. For the base
this is the handling of `extra`, but subclasses can extend it if
necessary.
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.

1 participant