Skip to content

chore(deps): update ruff to 0.12.0 #3926

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 15, 2025
Merged

chore(deps): update ruff to 0.12.0 #3926

merged 2 commits into from
Jul 15, 2025

Conversation

bellini666
Copy link
Member

@bellini666 bellini666 commented Jun 25, 2025

This was conflicting and failing, so I decided to update it manually

Summary by Sourcery

Update ruff linter to version 0.12.3 and adjust code and configuration to satisfy new lint rules.

Enhancements:

  • Add new ignore codes (UP045, PLC0415) and exclude Python 3.12 tests in ruff configuration
  • Adjust ruff ignore lists to accommodate updated formatter recommendations

Build:

  • Bump ruff dependency to ^0.12.3 in pyproject.toml
  • Update pre-commit hook to use ruff rev v0.12.3

Tests:

  • Add noqa directives (PT030, PLW1641) and correct indentation in tests to comply with updated lint rules

Chores:

  • Remove redundant noqa PLC0414 annotations from CLI import statements

Copy link
Contributor

sourcery-ai bot commented Jun 25, 2025

Reviewer's Guide

This PR manually updates Ruff from v0.11.x to v0.12.x by bumping both the pre-commit hook and Poetry dev dependency, extends the lint configuration, and aligns code with the new Ruff rules.

Class diagram for updated import structure in strawberry.cli.init

classDiagram
    class app
    class codegen
    class export_schema
    class locate_definition
    class schema_codegen
    class server
    class upgrade
    class run
    app <.. run : used by
    codegen <.. run : used by
    export_schema <.. run : used by
    locate_definition <.. run : used by
    schema_codegen <.. run : used by
    server <.. run : used by
    upgrade <.. run : used by
Loading

File-Level Changes

Change Details Files
Bump Ruff version in pre-commit configuration
  • Updated rev from v0.11.13 to v0.12.3
.pre-commit-config.yaml
Update Poetry dev dependency for Ruff
  • Changed dev dependency version constraint to ^0.12.3
pyproject.toml
Extend Ruff lint configuration
  • Added ignore codes UP045 and PLC0415
  • Configured exclude pattern for tests/python_312
pyproject.toml
Adjust code to comply with Ruff 0.12 lint rules
  • Removed redundant noqa comments on CLI imports
  • Added # noqa for PT030 and PLW1641 in tests
  • Fixed test indentation for asserts
strawberry/cli/__init__.py
tests/types/test_argument_types.py
tests/federation/test_schema.py
tests/tools/test_merge_types.py
tests/types/test_annotation.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @bellini666 - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

Updates Ruff linter from v0.11.13 to v0.12.0 across development dependencies and pre-commit hooks to improve syntax error detection and f-string formatting compatibility with Python 3.13.4.

  • Updated Ruff version to ^0.12.0 in pyproject.toml dev dependencies
  • Modified .pre-commit-config.yaml to use Ruff v0.12.0 for pre-commit hooks
  • Changes impact both linting and formatting configurations in the codebase
  • Update accommodates new f-string formatting rules for Python 3.13.4 compatibility

2 files reviewed, no comments
Edit PR Review Bot Settings | Greptile

Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

cubic reviewed 2 files and found no issues. Review PR in cubic.dev.

@botberry
Copy link
Member

botberry commented Jun 25, 2025

Hi, thanks for contributing to Strawberry 🍓!

We noticed that this PR is missing a RELEASE.md file. We use that to automatically do releases here on GitHub and, most importantly, to PyPI!

So as soon as this PR is merged, a release will be made 🚀.

Here's an example of RELEASE.md:

Release type: patch

Description of the changes, ideally with some examples, if adding a new feature.

Release type can be one of patch, minor or major. We use semver, so make sure to pick the appropriate type. If in doubt feel free to ask :)

Here's the tweet text:

🆕 Release (next) is out! Thanks to @_bellini666 for the PR 👏

Get it here 👉 https://strawberry.rocks/release/(next)

@botberry
Copy link
Member

botberry commented Jun 25, 2025

Apollo Federation Subgraph Compatibility Results

Federation 1 Support Federation 2 Support
_service🟢
@key (single)🟢
@key (multi)🟢
@key (composite)🟢
repeatable @key🟢
@requires🟢
@provides🟢
federated tracing🔲
@link🟢
@shareable🟢
@tag🟢
@override🟢
@inaccessible🟢
@composeDirective🟢
@interfaceObject🟢

Learn more:

Copy link

codecov bot commented Jun 25, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.76%. Comparing base (dc43880) to head (bd16f96).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3926   +/-   ##
=======================================
  Coverage   94.76%   94.76%           
=======================================
  Files         520      520           
  Lines       33951    33951           
  Branches     1759     1759           
=======================================
  Hits        32172    32172           
  Misses       1497     1497           
  Partials      282      282           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link

codspeed-hq bot commented Jun 25, 2025

CodSpeed Performance Report

Merging #3926 will not alter performance

Comparing update-ruff (bd16f96) with main (dc43880)

Summary

✅ 26 untouched benchmarks

Copy link
Member

@DoctorJohn DoctorJohn left a comment

Choose a reason for hiding this comment

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

LGTM 🍓 tho it looks like the failing test need an _T to T update as well

@bellini666
Copy link
Member Author

Just updated this, will check what is breaking now

@bellini666 bellini666 force-pushed the update-ruff branch 2 times, most recently from 5781d2a to 8eaf26a Compare July 1, 2025 16:27
@bellini666 bellini666 marked this pull request as draft July 1, 2025 16:37
@bellini666 bellini666 marked this pull request as ready for review July 15, 2025 10:51
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @bellini666 - I've reviewed your changes - here's some feedback:

  • The PR title and summary mention updating Ruff to 0.12.0 but the changes actually bump to 0.12.3; please align the version references accordingly.
  • Please double-check that the new ignore codes (UP045, PLC0415) and the exclusion of tests/python_312 don’t unintentionally suppress important lint warnings in supported environments.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The PR title and summary mention updating Ruff to 0.12.0 but the changes actually bump to 0.12.3; please align the version references accordingly.
- Please double-check that the new ignore codes (UP045, PLC0415) and the exclusion of tests/python_312 don’t unintentionally suppress important lint warnings in supported environments.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Greptile Summary

This PR extends the previously reviewed Ruff 0.12.0 update with comprehensive changes across the codebase to ensure compatibility and improve code quality. Key changes include:

  1. Enhanced type safety improvements:

    • Added explicit type validation for GraphQL operation parameters
    • Improved handling of lazy types in NameConverter and ConnectionExtension
    • Added type assertions for GraphQL response data
  2. Documentation improvements:

    • Added clear documentation for InputMutationExtension
    • Enhanced Django integration docs with async context guidance
    • Restructured extension documentation for better clarity
  3. Test suite enhancements:

    • Added comprehensive tests for lazy loading in Relay connections
    • Improved validation tests for GraphQL operations
    • Added performance benchmarks for large list handling

PR Description Notes:

  • The reference to PR #3924 indicates this is a manual resolution of a previously failing update

Confidence score: 4 /5

  1. This PR is generally safe to merge as it primarily consists of defensive improvements and documentation updates
  2. The score of 4 reflects strong testing and documentation but warrants attention due to the scope of changes
  3. Key files needing attention:
    • docs/general/why.md (appears to be accidentally deleted)
    • strawberry/http/async_base_view.py and sync_base_view.py (significant validation changes)
    • strawberry/types/arguments.py (performance optimization changes)

33 files reviewed, no comments
Edit PR Review Bot Settings | Greptile

@bellini666 bellini666 merged commit 79214e6 into main Jul 15, 2025
111 of 112 checks passed
@bellini666 bellini666 deleted the update-ruff branch July 15, 2025 11:04
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.

4 participants