Skip to content

Infrastructure: Expand Python formatting check in script#1340

Merged
josemontespg merged 1 commit intogoogle:mainfrom
josemontespg:format-all-python
May 8, 2026
Merged

Infrastructure: Expand Python formatting check in script#1340
josemontespg merged 1 commit intogoogle:mainfrom
josemontespg:format-all-python

Conversation

@josemontespg
Copy link
Copy Markdown
Collaborator

@josemontespg josemontespg commented May 5, 2026

Purpose

This PR updates the scripts/fix_format.sh script to be more comprehensive and future-proof.

Changes

  1. Script Update: The script now scans all Python files in the repository (including samples) instead of being limited to src and tests in the Python SDK directory. It also separates the checks for SDK and samples to better align with how CI runs them.
  2. Minor Formatting: A clean run with the updated script revealed that the repository was already mostly compliant, with only one documentation file (docs/ecosystem/renderers.md) needing minor adjustments.

Rationale

While files were found to be compliant, this update ensures that any new Python files added anywhere in the repo in the future will be covered by the formatting checks.

@github-project-automation github-project-automation Bot moved this to Todo in A2UI May 5, 2026
@josemontespg josemontespg force-pushed the format-all-python branch 2 times, most recently from 9b34e45 to f866340 Compare May 5, 2026 21:40
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 performs a comprehensive reformatting of the codebase, primarily focusing on indentation and whitespace adjustments across numerous Python files and scripts. These changes appear to be the result of applying an auto-formatter to ensure consistent style throughout the repository. There are no functional logic changes or new features introduced in this PR. I have no feedback to provide.

@josemontespg josemontespg marked this pull request as draft May 5, 2026 21:42
@josemontespg josemontespg marked this pull request as ready for review May 5, 2026 21:50
@ditman
Copy link
Copy Markdown
Collaborator

ditman commented May 5, 2026

(There's some conflicts that need to be resolved)

@josemontespg josemontespg enabled auto-merge (squash) May 5, 2026 22:16
@josemontespg josemontespg disabled auto-merge May 6, 2026 23:10
@josemontespg josemontespg enabled auto-merge (squash) May 6, 2026 23:10
Copy link
Copy Markdown
Collaborator

@ditman ditman left a comment

Choose a reason for hiding this comment

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

I don't python much, but LGTM!

QQ: in the old change, we didn't fail even with python files misconfigured. Have you verified that the repo checks fail after this change if a file is not correctly formatted?

@josemontespg
Copy link
Copy Markdown
Collaborator Author

josemontespg commented May 8, 2026

[Jose's AI agent] Hi @ditman, yes, I have verified that the repo checks will fail if a file is not correctly formatted.

  1. CI Failures: In previous runs of this PR (and PR Enforce formatting in repo #1338), both enforce-formatting (via Prettier) and Build samples (via Pyink) failed in CI when they encountered unformatted files.
  2. Local Verification: I also verified this locally by introducing a formatting error in a Python file and running ./scripts/fix_format.sh --check. It failed with exit code 1 and reported that the file would be reformatted.

So the enforcement is working as intended!

@josemontespg josemontespg requested a review from ditman May 8, 2026 19:15
@nan-yu
Copy link
Copy Markdown
Collaborator

nan-yu commented May 8, 2026

QQ: in the old change, we didn't fail even with python files misconfigured. Have you verified that the repo checks fail after this change if a file is not correctly formatted?

I also had the same question. We have the format check for python SDK in CI: https://github.com/google/A2UI/blob/main/.github/workflows/python_agent_sdk_build_and_test.yml#L51.

It was passing before. I guess the format changes in Python might be introduced by IDE settings.

@josemontespg
Copy link
Copy Markdown
Collaborator Author

Hi @nan-yu, you are correct that the check in python_agent_sdk_build_and_test.yml was passing before, as the files in agent_sdks/python were already mostly compliant.

The reason we saw many formatting changes in this PR is that we extended the enforcement to cover the rest of the Python files in the repository, primarily in the samples/ directory. Those files were not being checked by the SDK workflow, and running pyink on them revealed many files that needed reformatting to match the Google style.

@nan-yu
Copy link
Copy Markdown
Collaborator

nan-yu commented May 8, 2026

Hi @nan-yu, you are correct that the check in python_agent_sdk_build_and_test.yml was passing before, as the files in agent_sdks/python were already mostly compliant.

The reason we saw many formatting changes in this PR is that we extended the enforcement to cover the rest of the Python files in the repository, primarily in the samples/ directory. Those files were not being checked by the SDK workflow, and running pyink on them revealed many files that needed reformatting to match the Google style.

Actually, we also have python format checks for the samples/ directory: https://github.com/google/A2UI/blob/main/.github/workflows/python_samples_build.yml#L52. They were also compliant, but not compliant with the Google style in your IDE settings :)

@josemontespg josemontespg force-pushed the format-all-python branch 2 times, most recently from 74f9baf to 5a7608d Compare May 8, 2026 21:15
@josemontespg josemontespg changed the title Enforce Python formatting on all files Infrastructure: Expand Python formatting check in script May 8, 2026
@josemontespg josemontespg merged commit 69578ab into google:main May 8, 2026
13 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in A2UI May 8, 2026
@ditman
Copy link
Copy Markdown
Collaborator

ditman commented May 8, 2026

It's awesome that this landed, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants