Skip to content

Replace ScopeCollectionType alias with explicit expansion of types - #1259

Merged
MaxTueckeGlobus merged 4 commits into
4.x-devfrom
sc-41884-replace-scope-collection-type
Jul 16, 2025
Merged

Replace ScopeCollectionType alias with explicit expansion of types#1259
MaxTueckeGlobus merged 4 commits into
4.x-devfrom
sc-41884-replace-scope-collection-type

Conversation

@MaxTueckeGlobus

@MaxTueckeGlobus MaxTueckeGlobus commented Jul 15, 2025

Copy link
Copy Markdown
Contributor

sc-41884

Changes

  • Removed ScopeCollectionType type alias.
  • Replaced all usage sites of ScopeCollectionType with explicit str | Scope | t.Iterable[str | Scope] type annotations.
  • Removed support for the former recursive scope definition in globus_sdk.scopes.scopes_to_str and globus_sdk.scopes.scopes_to_scope_list. Since all codepaths that previously supported recursive scope definitions rely on these helpers for scope normalization, this change removes recursive scope support across the entire SDK.
  • Added tests to tests/unit/scopes/test_scope_normalization.py verifying scopes_to_str and scopes_to_scope_list now raise TypeError for nested iterables.
  • Updated unit tests appropriately.

Note: I opted not to remove tests/non-pytest/mypy-ignore-tests/scope_collection_type.py as it still validates there is consistent requested_scopes typing across the SDK. Happy to remove it though if reviewers feel it's redundant.


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

@sirosen sirosen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think keeping the typing test is good.

I see that we're using dict[str, str | Scope | t.Iterable[str | Scope]] in some locations, and we should examine those as well, after this PR. I think they'll require runtime changes to accept arbitrary mappings and store in dicts, so we'll have to decide whether or not those are correct.

:param iter_scope_strings: If True, scope strings with multiple root scopes are
:param obj: A scope string, scope object, or an iterable of scope strings
and scope objects.
:param split_root_scopes: If True, scope strings with multiple root scopes are

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

By the way, kudos for spotting and fixing this!

Comment thread changelog.d/20250715_141115_max.tuecke_sc_41884_replace_scope_collection_type.rst Outdated
@MaxTueckeGlobus
MaxTueckeGlobus merged commit 55bc971 into 4.x-dev Jul 16, 2025
7 checks passed
@MaxTueckeGlobus
MaxTueckeGlobus deleted the sc-41884-replace-scope-collection-type branch July 16, 2025 15:47
@sirosen sirosen mentioned this pull request Oct 8, 2025
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