Cleanup the scope normalization interfaces for v4 #1289
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
sc-41886
These changes seek to get some better control over the scope interfaces in SDK v4.
Primarily, the outstanding 'odd things' are scope normalizing functions which were added for internal use-cases but declared as public, user-facing functions.
scopes_to_stris here deemed reasonable to expose, but makes a great deal of sense to attach to theScopeParserobject.It is now provided as
ScopeParser.serializeand features a new flag,reject_empty(defaults toTrue) which replaces some internal functionality smoothly.Attachment as a public method to a public object also helps to clarify for internal and external developers that the function is intentionally public (vs name leakage).
scopes_to_scope_listgets the opposite treatment.This is only used inside of
GlobusAppfor some normalization, and it supports a variety of types at runtime which we have declared unsupported in our typing-time contracts.It is replaced with an internal
GlobusApp._iter_scopeshelper, which we can change at will to suit the needs of the SDK itself.The relevant tests for these functions have been ported, as appropriate, to their new implementations.
Because direct usage of these functions is relatively niche, I have opted not to include them in the upgrading guide.
They are called out unceremoniously in the changelog as
Breaking Changes.📚 Documentation preview 📚: https://globus-sdk-python--1289.org.readthedocs.build/en/1289/