Skip to content

chore: librarian update image pull request: 20260213T151402Z#668

Merged
parthea merged 2 commits intomainfrom
librarian-20260213T151402Z
Feb 13, 2026
Merged

chore: librarian update image pull request: 20260213T151402Z#668
parthea merged 2 commits intomainfrom
librarian-20260213T151402Z

Conversation

@parthea
Copy link
Contributor

@parthea parthea commented Feb 13, 2026

feat: update image to us-central1-docker.pkg.dev/cloud-sdk-librarian-prod/images-prod/python-librarian-generator@sha256:a38add811f7f139d6a385b22d283ad09ef305b8cf50382ef62f0ce690787f021

Fixes b/483054726

…prod/images-prod/python-librarian-generator@sha256:a38add811f7f139d6a385b22d283ad09ef305b8cf50382ef62f0ce690787f021
@parthea parthea requested review from a team as code owners February 13, 2026 15:14
@product-auto-label product-auto-label bot added size: m Pull request size is medium. api: datastore Issues related to the googleapis/python-datastore API. labels Feb 13, 2026
@gemini-code-assist
Copy link

Summary of Changes

Hello @parthea, 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 primarily updates the librarian image to a newer version, which triggered several related code changes. These include standardizing Python import statements for google.api_core and google.protobuf modules, refactoring service account initialization methods in async clients for clarity, and updating the JSON serialization mechanism for Protobuf messages in the REST transport. Additionally, type hinting imports were added to unit tests. These changes collectively aim to maintain code consistency, improve readability, and ensure compatibility with updated dependencies or code generation practices.

Highlights

  • Librarian Image Update: The librarian image reference in .librarian/state.yaml has been updated to a newer SHA256 hash, ensuring the use of the latest generator version.
  • Python Import Standardization: Python import statements across numerous client and type definition files have been standardized, transitioning from from X import Y to import X.Y as Y for specific google.api_core and google.protobuf modules. This change improves consistency and clarity.
  • Service Account Method Refactoring: The from_service_account_info and from_service_account_file methods in asynchronous client classes were refactored to use temporary variables for accessing __func__, enhancing readability and maintainability.
  • Protobuf JSON Serialization Update: The JSON serialization logic within the REST transport layer was modified to utilize type(request).to_json(request) instead of json_format.MessageToJson, reflecting an update in how Protobuf messages are converted to JSON.
  • Type Hinting Imports in Tests: Imports for Sequence and Mapping from collections.abc were introduced in unit test files, likely to support more precise type hinting or compatibility with newer Python versions.
Changelog
  • .librarian/state.yaml
    • Updated the image field to a new SHA256 hash for the python-librarian-generator.
  • google/cloud/datastore_admin_v1/services/datastore_admin/async_client.py
    • Modified import statements for operation, operation_async, and empty_pb2 to use import X as Y syntax.
    • Refactored from_service_account_info and from_service_account_file methods to use intermediate variables for __func__ access.
  • google/cloud/datastore_admin_v1/services/datastore_admin/client.py
    • Modified import statements for operation, operation_async, and empty_pb2 to use import X as Y syntax.
  • google/cloud/datastore_admin_v1/services/datastore_admin/transports/rest.py
    • Changed JSON serialization from json_format.MessageToJson(request) to type(request).to_json(request) in multiple __call__ methods.
  • google/cloud/datastore_admin_v1/types/datastore_admin.py
    • Modified import statement for timestamp_pb2 to use import X as Y syntax.
  • google/cloud/datastore_v1/services/datastore/async_client.py
    • Modified import statement for timestamp_pb2 to use import X as Y syntax.
    • Refactored from_service_account_info and from_service_account_file methods to use intermediate variables for __func__ access.
  • google/cloud/datastore_v1/services/datastore/client.py
    • Modified import statement for timestamp_pb2 to use import X as Y syntax.
  • google/cloud/datastore_v1/types/aggregation_result.py
    • Modified import statement for timestamp_pb2 to use import X as Y syntax.
  • google/cloud/datastore_v1/types/datastore.py
    • Modified import statement for timestamp_pb2 to use import X as Y syntax.
  • google/cloud/datastore_v1/types/entity.py
    • Modified import statements for struct_pb2, timestamp_pb2, and latlng_pb2 to use import X as Y syntax.
  • google/cloud/datastore_v1/types/query.py
    • Modified import statements for timestamp_pb2 and wrappers_pb2 to use import X as Y syntax.
  • google/cloud/datastore_v1/types/query_profile.py
    • Modified import statements for duration_pb2 and struct_pb2 to use import X as Y syntax.
  • tests/unit/gapic/datastore_admin_v1/test_datastore_admin.py
    • Added imports for Sequence and Mapping from collections.abc.
    • Modified import statements for operation_async and empty_pb2 to use import X as Y syntax.
  • tests/unit/gapic/datastore_v1/test_datastore.py
    • Added imports for Sequence and Mapping from collections.abc.
    • Modified import statements for struct_pb2, timestamp_pb2, wrappers_pb2, and latlng_pb2 to use import X as Y syntax.
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

@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 updates the librarian generator image and applies the resulting code changes. The changes primarily consist of updating import styles to be more explicit (e.g., import x.y as y instead of from x import y), improving code readability by breaking up long lines, and switching to a more modern to_json method for serialization. These are all positive changes. I've identified a few areas for improvement related to error handling where bare except blocks are used, which could mask issues.

method = transcoded_request["method"]
try:
request_payload = json_format.MessageToJson(request)
request_payload = type(request).to_json(request)

Choose a reason for hiding this comment

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

medium

Using a bare except: on line 800 is discouraged as it catches all exceptions, including system-exiting ones like KeyboardInterrupt and SystemExit. This can hide bugs and make debugging difficult. It's better to catch a more specific exception, like except Exception:, or even more specific exceptions that to_json might raise.

method = transcoded_request["method"]
try:
request_payload = json_format.MessageToJson(request)
request_payload = type(request).to_json(request)

Choose a reason for hiding this comment

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

medium

Using a bare except: on line 947 is discouraged as it catches all exceptions, including system-exiting ones like KeyboardInterrupt and SystemExit. This can hide bugs and make debugging difficult. It's better to catch a more specific exception, like except Exception:, or even more specific exceptions that to_json might raise.

method = transcoded_request["method"]
try:
request_payload = json_format.MessageToJson(request)
request_payload = type(request).to_json(request)

Choose a reason for hiding this comment

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

medium

Using a bare except: on line 1098 is discouraged as it catches all exceptions, including system-exiting ones like KeyboardInterrupt and SystemExit. This can hide bugs and make debugging difficult. It's better to catch a more specific exception, like except Exception:, or even more specific exceptions that to_json might raise.

method = transcoded_request["method"]
try:
request_payload = json_format.MessageToJson(request)
request_payload = type(request).to_json(request)

Choose a reason for hiding this comment

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

medium

Using a bare except: on line 1399 is discouraged as it catches all exceptions, including system-exiting ones like KeyboardInterrupt and SystemExit. This can hide bugs and make debugging difficult. It's better to catch a more specific exception, like except Exception:, or even more specific exceptions that to_json might raise.

@parthea parthea merged commit d718104 into main Feb 13, 2026
31 checks passed
@parthea parthea deleted the librarian-20260213T151402Z branch February 13, 2026 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: datastore Issues related to the googleapis/python-datastore API. size: m Pull request size is medium.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants