Skip to content

Conversation

@gniumg-source
Copy link

@beccasaurus #13808
@lukesneeringer #4745
@hfwang #13807
@inklesspen #13806
@jskeet Wwg

Description

Fixes #

Note: Before submitting a pull request, please open an issue for discussion if you are not associated with Google.

Checklist

@gniumg-source gniumg-source requested review from a team as code owners February 10, 2026 13:49
@snippet-bot
Copy link

snippet-bot bot commented Feb 10, 2026

Here is the summary of possible violations 😱

Details

There are 2 possible violations for not having product prefix.

The end of the violation section. All the stuff below is FYI purposes only.


Here is the summary of changes.

You are about to add 2 region tags.

This comment is generated by snippet-bot.
If you find problems with this result, please file an issue at:
https://github.com/googleapis/repo-automation-bots/issues.
To update this comment, add snippet-bot:force-run label or use the checkbox below:

  • Refresh this comment

@product-auto-label product-auto-label bot added the samples Issues that are directly related to samples. label Feb 10, 2026
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @gniumg-source, 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 introduces a foundational document that standardizes the development and testing practices for Python samples. It aims to ensure consistency, readability, and maintainability across all Python contributions, providing clear guidelines for authors and reviewers alike.

Highlights

  • Python Sample Authoring Guide: Introduced a comprehensive guide for writing Python samples, covering goals, folder structure, Python versions, and license headers.
  • Coding Standards: Detailed guidelines on coding style, including adherence to PEP 8, Google Python Style Guide, flake8, Black formatting, and the Zen of Python.
  • Testing Best Practices: Provided extensive testing guidelines, emphasizing pytest, the Arrange-Act-Assert pattern, handling external and temporary resources, avoiding infinite loops, retrying RPCs, and filtering list methods.
  • Environment Setup and Dependencies: Outlined instructions for setting up the development environment, managing dependencies with requirements.txt, and running tests using Nox and Docker.
  • Type Hinting and Docstrings: Emphasized the use of Python type annotations (PEP 484) and descriptive docstrings for functions and arguments to improve code clarity and maintainability.
Changelog
  • Python,yml
    • Added a new comprehensive guide for authoring Python samples.
    • Included sections on sample structure, coding style, and testing methodologies.
    • Provided details on environment setup, dependency management, and debugging techniques.
Activity
  • The pull request description includes mentions of several users (@beccasaurus, @lukesneeringer, @hfwang, @inklesspen, @jskeet) for awareness or review.
  • The author has completed several checklist items, including following sample guidelines, updating the README, ensuring tests and lint pass, and updating CODEOWNERS and blunderbuss configurations.
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 adds a new authoring guide for Python samples. The guide is comprehensive and covers many important aspects of sample development. I've found a few issues in the code examples and commands that could be corrected to improve clarity and prevent errors for users. Also, the filename Python,yml seems unusual for a Markdown file; the comma is likely a typo and the extension should probably be .md.

Comment on lines +202 to +204
audio_config = texttospeech.AudioConfig(
audio_encoding=texttospeech.AudioEncoding.MP3
)
Copy link
Contributor

Choose a reason for hiding this comment

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

high

The variable texttospeech is used here, but it's not defined. Based on the import on line 198, it should be texttospeech_v1.

audio_config = texttospeech_v1.AudioConfig(
        audio_encoding=texttospeech_v1.AudioEncoding.MP3
)



def create_folder(bucket_name: str, folder_name: str) -> None:
print(f"Created folder: {response.name}")
Copy link
Contributor

Choose a reason for hiding this comment

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

high

The response variable is used here without being defined, which will cause a NameError. The example function should include the logic that produces the response object.

[gsutil](https://cloud.google.com/storage/docs/gsutil). For example:

```console
gsutil cp ./samples/snippets/resources/* gs://{$CLOUD_STORAGE_BUCKET}/
Copy link
Contributor

Choose a reason for hiding this comment

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

high

The shell variable syntax is incorrect. It should be ${CLOUD_STORAGE_BUCKET} instead of {$CLOUD_STORAGE_BUCKET}.

gsutil cp ./samples/snippets/resources/* gs://${CLOUD_STORAGE_BUCKET}/


```py
def adder(a: int, b: int) -> int:
return a+b
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

According to PEP 8, there should be a space around operators. The example should be return a + b.

    return a + b

from google.api_core.retry import Retry

@Retry()
def test_quickstart_v2() -> None:
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The example test_quickstart_v2 uses os, uuid4, and re, but the necessary imports are not shown. To make the example more complete and easier to use, please consider adding import os, from uuid import uuid4, and import re at the beginning of the snippet.

Comment on lines +729 to +736
# We add timestamp for making the query faster.
now = datetime.datetime.now(datetime.timezone.utc)
filter_date = now - datetime.timedelta(minutes=1)
filters = (
f"timestamp>=\"{filter_date.isoformat('T')}\" "
"resource.type=cloud_run_revision "
"AND severity=NOTICE "
)
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The indentation in this code block is incorrect and inconsistent. Also, the project variable used on line 728 is not defined. Please correct the indentation and clarify where project should come from.

# We add timestamp for making the query faster.
now = datetime.datetime.now(datetime.timezone.utc)
filter_date = now - datetime.timedelta(minutes=1)
filters = (
    f"timestamp>=\"{filter_date.isoformat('T')}\" "
    "resource.type=cloud_run_revision "
    "AND severity=NOTICE "
)

nox -s py-3.7 -- snippets_test.py
```

To run a specific test from a specific following:
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

There's a typo here. 'following' should probably be 'file'.

To run a specific test from a specific file:

@jskeet
Copy link
Member

jskeet commented Feb 10, 2026

Closing as spam, will block the user if there's any more.

@jskeet jskeet closed this Feb 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

samples Issues that are directly related to samples.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants