-
-
Notifications
You must be signed in to change notification settings - Fork 603
chore: update pre-commit hooks #4033
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
Conversation
Reviewer's GuideThis PR bumps pre-commit hook versions and updates isort settings to treat all Strawberry framework integrations as known third-party, then applies automated formatting across the codebase, modernizes several type annotations to PEP 604 unions, reorders class inheritance for style consistency, and cleans up test files (blank lines, regex strings, variable naming) to align with the new linting rules. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| # is added in the constructor or not. It is not used to change | ||
| # any behaviour at the moment. | ||
| init: Literal[True, False, None] = None, | ||
| init: Literal[True, False] | None = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be bool | None? 🤔
|
Hi, thanks for contributing to Strawberry 🍓! We noticed that this PR is missing a So as soon as this PR is merged, a release will be made 🚀. Here's an example of 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: |
Apollo Federation Subgraph Compatibility Results
Learn more: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greptile Overview
Summary
This PR fixes import sorting issues introduced in PR #4032 by updating the ruff linter configuration and applying the corrected import order across all affected files.
Key Changes:
- Updated ruff from v0.12.10 to v0.14.1 in
.pre-commit-config.yaml - Added integration packages (
fastapi,django,pydantic,litestar,aiohttp,channels,sanic,chalice,quart) toknown-third-partyinpyproject.toml - Re-sorted imports in 49 files to follow the correct order: standard library → third-party (integrations) → first-party (strawberry)
Impact:
The previous PR incorrectly treated integration packages as first-party, placing them after strawberry imports. This fix ensures proper import grouping, which is important for:
- Code readability and maintainability
- Consistent style across the codebase
- Avoiding future import-related issues
All changes are purely cosmetic (import reordering and whitespace) with no functional modifications.
Confidence Score: 5/5
- This PR is completely safe to merge - it only reorders imports and updates tooling versions
- This PR receives the highest confidence score because: (1) All changes are purely cosmetic - only import statement ordering and blank lines were modified, (2) No logical code changes were made, (3) The Python syntax validation passed for all modified files, (4) The changes fix a legitimate issue where integration packages were incorrectly sorted, (5) The ruff version update and configuration changes are straightforward and well-understood, (6) The changes align with Python PEP 8 import ordering conventions
- No files require special attention - all changes are automated import reordering
Important Files Changed
File Analysis
| Filename | Score | Overview |
|---|---|---|
| .pre-commit-config.yaml | 5/5 | Updated ruff from v0.12.10 to v0.14.1 and blacken-docs from 1.19.1 to 1.20.0 - version bumps only |
| pyproject.toml | 5/5 | Updated ruff version constraint and added integration packages to known-third-party for correct import sorting |
| strawberry/fastapi/router.py | 5/5 | Reordered imports: fastapi imports now correctly appear before strawberry imports |
| strawberry/litestar/controller.py | 5/5 | Reordered imports: litestar and msgspec now correctly grouped as third-party before strawberry |
| strawberry/aiohttp/views.py | 5/5 | Reordered imports: aiohttp now correctly appears before strawberry imports |
Sequence Diagram
sequenceDiagram
participant Dev as Developer
participant Git as Git Commit
participant PreCommit as Pre-commit Hooks
participant Ruff as Ruff v0.14.1
participant Config as pyproject.toml
Dev->>Git: git commit
Git->>PreCommit: Trigger pre-commit hooks
PreCommit->>Ruff: Run ruff-format
Ruff->>Config: Read [tool.ruff.lint.isort] config
Config-->>Ruff: known-third-party includes:<br/>fastapi, django, litestar,<br/>aiohttp, channels, sanic, etc.
Ruff->>Ruff: Sort imports:<br/>1. Standard library<br/>2. Third-party (fastapi, django, etc.)<br/>3. First-party (strawberry)
Ruff-->>PreCommit: Import order corrected
PreCommit->>Ruff: Run ruff linter
Ruff-->>PreCommit: All checks passed
PreCommit-->>Git: All hooks passed
Git-->>Dev: Commit successful
48 files reviewed, no comments
CodSpeed Performance ReportMerging #4033 will not alter performanceComparing Summary
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4033 +/- ##
=======================================
Coverage 94.37% 94.37%
=======================================
Files 533 533
Lines 34774 34774
Branches 1829 1829
=======================================
Hits 32819 32819
Misses 1659 1659
Partials 296 296 🚀 New features to boost your workflow:
|
#4032 was sorting imports wrong, so I added our integrations as "known third party"
Summary by Sourcery
Update pre-commit hooks and import sorting configuration, and apply related code and test adjustments to conform to the new linting rules.
Enhancements:
Build:
Tests: