Skip to content

[DRAFT] feat(auth): allow single-string scopes for google.auth.default#16787

Draft
daniel-sanche wants to merge 10 commits intomainfrom
auth_forgiving_types
Draft

[DRAFT] feat(auth): allow single-string scopes for google.auth.default#16787
daniel-sanche wants to merge 10 commits intomainfrom
auth_forgiving_types

Conversation

@daniel-sanche
Copy link
Copy Markdown
Contributor

We were having trouble importing this library into google3, because a lot of internal usages were passing single strings in as scopes, and the type checker would fail

This PR changes the type support to allow what the internal users are already doing

Also clean up some other types that were inconsistent or caused issues with google3

@daniel-sanche daniel-sanche changed the title [DRAFT] fix: allow single-string scopes for google.auth.default [DRAFT] feat: allow single-string scopes for google.auth.default Apr 24, 2026
@daniel-sanche daniel-sanche changed the title [DRAFT] feat: allow single-string scopes for google.auth.default [DRAFT] feat(auth): allow single-string scopes for google.auth.default Apr 24, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces type hints and updates function signatures to support single-string scopes in addition to sequences of strings across several modules, including _default.py, app_engine.py, and credentials.py. The review feedback correctly identifies a compatibility issue where the | union operator is used; since this library supports Python versions older than 3.10, these instances must be replaced with typing.Union to avoid runtime errors. Additionally, consistency between function signatures and docstrings regarding type union syntax was requested.

Comment thread packages/google-auth/google/auth/_default.py Outdated
Comment thread packages/google-auth/google/auth/_default.py Outdated
Comment thread packages/google-auth/google/auth/credentials.py
daniel-sanche and others added 6 commits April 23, 2026 18:23
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@daniel-sanche daniel-sanche added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Apr 24, 2026
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Apr 24, 2026
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