Skip to content

Adopt the Google Python Style Guide and ruff for Python formatting #304

Closed

Description

@digitalresistor

Summary

Format all Python code in the repository according to the Google Python Style Guide, so every file matches Google's corporate coding standards, and replace yapf with ruff as the formatter and linter.

Motivation

Stellar Engine is a Google project, so its code should follow the standards that Google publishes for Python rather than a repository-specific variant.

  • The Google Python Style Guide specifies 4-space indentation and 80-character lines.
  • The tools/lint.sh script configures yapf with indent_width: 2, which diverges from the published guide.
  • The .gemini/styleguide.md review guide refers to a .style.yapf file that does not exist in the repository, and it sets a 79-character limit instead of the guide's 80 characters.
  • New Python projects in the repository, such as the planned cli/ operator tool, need one clear standard to follow from their first commit.

ruff replaces yapf and pyflakes with a single tool.

  • ruff formats and lints the whole repository in well under a second.
  • ruff has broad adoption across the Python community, so contributors are likely to know it already.
  • One ruff.toml file at the repository root holds the formatter settings, the pyflakes-equivalent F rules, and Google-style import sorting.
  • Self-contained projects such as cli/ can extend the root configuration and enable stricter rule sets, including Google docstring checks.

Proposed change

  • Add a root ruff.toml file with indent-width = 4, line-length = 80, and Google-style import sorting.
  • Switch the tools/lint.sh script, the tools/requirements.txt file, and the CI python-tests job from yapf and pyflakes to ruff.
  • Update the Python rules in the .gemini/styleguide.md review guide to match.
  • Reformat the existing Python files in one mechanical commit, and list that commit in a .git-blame-ignore-revs file so git blame skips it.

Pull request #302 implements this proposal for discussion. Switching back to 2-space indentation later takes a one-line indent-width change and a rerun of ruff format.

Activity

  1. added
    Enhancement
    Priority - Low
    Level of Effort - Low
    Scope - Fast
    Scope - Blueprint
    on Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    EnhancementLevel of Effort - LowPriority - LowScope - BlueprintScope - Fast

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions