Skip to content

chore dev: use ruff in pre-commit and remove unused files#471

Merged
rchardx merged 2 commits intomainfrom
fw/ruff
Oct 22, 2025
Merged

chore dev: use ruff in pre-commit and remove unused files#471
rchardx merged 2 commits intomainfrom
fw/ruff

Conversation

@garrett4wade
Copy link
Collaborator

Description

Update code formatting to use ruff. Ruff provides broader functionality than isort, black, and autoflake combined, consolidating our formatting toolchain.

Related Issue

N/A

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Code refactoring (no functional changes)
  • Performance improvement
  • Test coverage improvement

Checklist

  • I have read the Contributing Guide
  • I have run formatting tools (pre-commit or manual)
  • I have run relevant unit tests and they pass
  • I have added tests for new functionality
  • I have updated documentation if needed
  • My branch is up to date with main
  • This PR introduces breaking changes (if yes, fill out details below)
  • If this PR changes documentation, I have built and previewed it locally with jb build docs
  • No critical issues raised by AI reviewers (/gemini review)

Breaking Change Details (if applicable):

While ruff should not conflict with CI formatting checks, it introduces formatting rules that may significantly alter existing formatted code. To avoid a large-scale code change in this PR, we are not running pre-commit run --all-files at this time. Instead, we plan to gradually update the codebase as files are modified in future changes.

Additional Context

N/A

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @garrett4wade, 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 significantly refactors the project's code formatting and linting setup by migrating from a multi-tool approach (autoflake, isort, black) to a unified solution using Ruff. The change aims to simplify the development workflow, reduce configuration overhead, and improve performance by leveraging Ruff's comprehensive capabilities. Additionally, several legacy configuration files have been removed, contributing to a cleaner and more maintainable project structure. The adoption of Ruff will be gradual to manage potential large-scale formatting changes.

Highlights

  • Consolidated Formatting and Linting: The project now uses 'ruff' for all Python code formatting and linting, replacing 'autoflake', 'isort', and 'black'. This streamlines the development toolchain.
  • Pre-commit Hooks Update: The '.pre-commit-config.yaml' has been updated to remove the old formatting hooks and introduce 'ruff' for both linting and formatting, specifically targeting 'areal/' and 'examples/' directories.
  • Configuration Cleanup: Several outdated or redundant configuration files, including 'MANIFEST.in', 'Makefile', 'pytest.ini', and 'setup.py', have been removed to simplify the project structure.
  • Dependency Management: The 'pyproject.toml' and 'requirements.txt' files have been updated to remove 'black' and 'isort' dependencies and add 'ruff==0.14.1'.
  • Documentation Adjustment: The 'CONTRIBUTING.md' file has been modified to remove the instruction to run 'pre-commit run --all-files', aligning with the strategy of gradually applying 'ruff' formatting.
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 is a great initiative to consolidate the Python linting and formatting toolchain by adopting ruff. The removal of unused configuration files like Makefile and setup.py also helps to clean up the repository. My review has identified a few critical issues related to an invalid ruff version being specified across multiple configuration files, which will break the build and pre-commit hooks. I've also found a misconfiguration in the pre-commit setup that would prevent ruff from running on any files. Additionally, I've suggested a way to preserve the pytest configuration that was removed. Addressing these points will ensure a smooth transition to the new tooling.

Copy link
Collaborator

@rchardx rchardx left a comment

Choose a reason for hiding this comment

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

LGTM!

@rchardx rchardx merged commit 189d93f into main Oct 22, 2025
0 of 4 checks passed
@rchardx rchardx deleted the fw/ruff branch October 22, 2025 06:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants