Skip to content

Conversation

@ohmayr
Copy link
Contributor

@ohmayr ohmayr commented Feb 7, 2026

  • ignore_missing_imports = True: Third-Party Protos: Many of our generated libraries depend on common protos (like google.iam.v1). These upstream packages often do not include a py.typed marker file (defined in PEP 561). Without this flag, MyPy refuses to use those imports, even if the package is correctly installed in the Nox environment.

  • switch the deprecated blacken with the new format session to ensure that mypy runs successfully after we format our code with ruff.

  • wrap sa_info_func and sa_file_func to ensure that # type: ignore correctly silences the mypy type warnings.

@ohmayr ohmayr requested a review from a team as a code owner February 7, 2026 01:00
@product-auto-label product-auto-label bot added the size: s Pull request size is small. label Feb 7, 2026
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @ohmayr, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on enhancing code style and mypy compliance within the generated asynchronous client code. It introduces a multi-line formatting adjustment for the __func__ attribute assignment, which resolves a specific mypy type checking concern. This change is purely cosmetic and ensures that the codebase maintains high standards for static analysis and readability across various client implementations.

Highlights

  • Code Formatting: Reformatted the assignment of sa_info_func to span multiple lines for improved readability and adherence to style guidelines.
  • Mypy Compatibility: Addressed a mypy type checking issue related to the __func__ attribute by adjusting the line wrapping, ensuring better static analysis without functional changes.
  • Generated Code Consistency: Applied this formatting change consistently across the Jinja2 template for async clients and multiple generated golden async_client.py files.
Changelog
  • gapic/templates/%namespace/%name_%version/%sub/services/%service/async_client.py.j2
    • Reformatted the sa_info_func assignment to span multiple lines to resolve a mypy issue.
  • tests/integration/goldens/asset/google/cloud/asset_v1/services/asset_service/async_client.py
    • Reformatted the sa_info_func assignment to span multiple lines.
  • tests/integration/goldens/credentials/google/iam/credentials_v1/services/iam_credentials/async_client.py
    • Reformatted the sa_info_func assignment to span multiple lines.
  • tests/integration/goldens/eventarc/google/cloud/eventarc_v1/services/eventarc/async_client.py
    • Reformatted the sa_info_func assignment to span multiple lines.
  • tests/integration/goldens/logging/google/cloud/logging_v2/services/config_service_v2/async_client.py
    • Reformatted the sa_info_func assignment to span multiple lines.
  • tests/integration/goldens/logging/google/cloud/logging_v2/services/logging_service_v2/async_client.py
    • Reformatted the sa_info_func assignment to span multiple lines.
  • tests/integration/goldens/logging/google/cloud/logging_v2/services/metrics_service_v2/async_client.py
    • Reformatted the sa_info_func assignment to span multiple lines.
  • tests/integration/goldens/logging_internal/google/cloud/logging_v2/services/config_service_v2/async_client.py
    • Reformatted the sa_info_func assignment to span multiple lines.
  • tests/integration/goldens/logging_internal/google/cloud/logging_v2/services/logging_service_v2/async_client.py
    • Reformatted the sa_info_func assignment to span multiple lines.
  • tests/integration/goldens/logging_internal/google/cloud/logging_v2/services/metrics_service_v2/async_client.py
    • Reformatted the sa_info_func assignment to span multiple lines.
  • tests/integration/goldens/redis/google/cloud/redis_v1/services/cloud_redis/async_client.py
    • Reformatted the sa_info_func assignment to span multiple lines.
  • tests/integration/goldens/redis_selective/google/cloud/redis_v1/services/cloud_redis/async_client.py
    • Reformatted the sa_info_func assignment to span multiple lines.
Activity
  • No specific review comments or activity have been recorded for this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
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 reformats a line to fix a mypy issue. The change is correctly applied to the template and propagated to the generated golden files. I've added one comment about an inconsistency where the same fix should be applied to another method for completeness.

@product-auto-label product-auto-label bot added size: m Pull request size is medium. and removed size: s Pull request size is small. labels Feb 7, 2026
@parthea
Copy link
Contributor

parthea commented Feb 9, 2026

//tests/integration:redis_selective FAILED in 0.0s

@ohmayr PTAL

@parthea parthea assigned ohmayr and unassigned chalmerlowe Feb 9, 2026
Copy link
Contributor

@parthea parthea left a comment

Choose a reason for hiding this comment

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

Please update the mypy test here to ensure that mypy is run after code formatting. We will need to switch to using ruff as well

nox -f tests/integration/goldens/asset/noxfile.py -s mypy-${{ env.LATEST_STABLE_PYTHON }} blacken lint
nox -f tests/integration/goldens/credentials/noxfile.py -s mypy-${{ env.LATEST_STABLE_PYTHON }} blacken lint
nox -f tests/integration/goldens/eventarc/noxfile.py -s mypy-${{ env.LATEST_STABLE_PYTHON }} blacken lint
nox -f tests/integration/goldens/logging/noxfile.py -s mypy-${{ env.LATEST_STABLE_PYTHON }} blacken lint
nox -f tests/integration/goldens/redis/noxfile.py -s mypy-${{ env.LATEST_STABLE_PYTHON }} blacken lint

          nox -f tests/integration/goldens/asset/noxfile.py -s mypy-${{ env.LATEST_STABLE_PYTHON }} blacken lint
          nox -f tests/integration/goldens/credentials/noxfile.py -s mypy-${{ env.LATEST_STABLE_PYTHON }} blacken lint
          nox -f tests/integration/goldens/eventarc/noxfile.py -s mypy-${{ env.LATEST_STABLE_PYTHON }} blacken lint
          nox -f tests/integration/goldens/logging/noxfile.py -s mypy-${{ env.LATEST_STABLE_PYTHON }} blacken lint
          nox -f tests/integration/goldens/redis/noxfile.py -s mypy-${{ env.LATEST_STABLE_PYTHON }} blacken lint

@ohmayr ohmayr closed this Feb 9, 2026
@ohmayr ohmayr reopened this Feb 9, 2026
@ohmayr ohmayr closed this Feb 9, 2026
@ohmayr ohmayr reopened this Feb 9, 2026
Copy link
Contributor

@daniel-sanche daniel-sanche left a comment

Choose a reason for hiding this comment

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

LGTM

@ohmayr ohmayr merged commit 212337f into main Feb 9, 2026
147 of 276 checks passed
@ohmayr ohmayr deleted the fix-mypy-type-issue branch February 9, 2026 20:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size: m Pull request size is medium.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants