Skip to content

Conversation

@b-long
Copy link
Owner

@b-long b-long commented Sep 20, 2025

Update ruff, require "PTH" (flake8-use-pathlib) and fix PTH violations. Also updated some README content.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @b-long, 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 focuses on enhancing code quality and adherence to modern Python practices by updating the ruff linter to its latest version and refactoring file system interactions to utilize the pathlib module. It also includes minor cleanups such as removing unused code and updating documentation to accurately reflect changes in the project structure, ensuring a more robust and maintainable codebase.

Highlights

  • Ruff Linter Update: The ruff linter has been updated from version v0.12.12 to v0.13.1 in the pre-commit configuration and the uv.lock file, ensuring the use of the latest linting features and fixes.
  • Pathlib Adoption for File Operations: Numerous file operations previously using open() have been refactored to leverage Path.open() from the pathlib module. This change enhances readability, maintainability, and consistency in path handling across the codebase, and the PTH rule for pathlib has been enabled in pyproject.toml.
  • Unused Variable Renaming: Several variables that were assigned but not subsequently used (e.g., manifest, size, kas_private_key) have been renamed with a leading underscore (e.g., _manifest, _size, _kas_private_key). This explicitly marks them as intentionally unused, aligning with Python's convention for ignoring variables and improving code clarity.
  • Documentation and Example Cleanup: The README.md file has been cleaned up by removing a commented-out sdk.close() line from an example. Additionally, the otdf-python-proto/README.md has been updated to reflect the correct directory for generated protobuf and Connect RPC client files, changing from generated/ to src/otdf_python_proto/.
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

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 updates ruff and applies several linting fixes, primarily related to using pathlib for file operations and marking unused variables. The changes are a good step towards modernizing the codebase and improving consistency. I've provided several suggestions to further simplify file I/O using pathlib's helper methods like read_text() and write_bytes(), which align with the direction of this PR. I also have a concern about removing sdk.close() from the README.md example, as it might encourage bad practices.

@b-long
Copy link
Owner Author

b-long commented Sep 20, 2025

/gemini review

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 updates the ruff linter and applies its automated fixes across the codebase. The changes primarily involve using pathlib for file operations, removing unused imports, and marking unused variables, which improves code consistency and quality. I have one suggestion regarding the README.md file, where an important sdk.close() call was removed from an example. Restoring this call is crucial to demonstrate correct resource management.

@b-long b-long merged commit 5e4c796 into main Sep 20, 2025
9 checks passed
@b-long b-long deleted the chore/update-ruff branch September 20, 2025 14:23
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