Skip to content

style: apply ruff format and import sorting - #72

Merged
uniqueg merged 1 commit into
devfrom
style/ruff-format
Nov 7, 2026
Merged

uniqueg merged 1 commit into
devfrom
style/ruff-format

Conversation

@uniqueg

@uniqueg uniqueg commented Nov 7, 2026 •

Copy link
Copy Markdown
Member

Summary

Formats all Python files with ruff 0.17.3 (Black style) and sorts their imports with ruff's isort rules. The settings are the ones #38 adds: target-version = "py313", force-sort-within-sections, known-first-party = ["pubgrade", "tests"], and the submodule external/ excluded. Only formatting and import order change. This PR comes first so that #38 can list its squash commit in .git-blame-ignore-revs.

Closes #71

Verification

  • ruff format --diff (0.17.3, same settings): no changes left. ruff check --select I passes.
  • AST comparison against dev: all statements other than imports are identical. The only exception is four test-module docstrings, which lost a trailing space. The imported names are also the same. Two of them (from foca.models.config import Config and MongoConfig, in tests/pubgrade/test_server.py and tests/pubgrade/endpoints/test_repositories.py) are now merged into one line. The try/except import in test_server.py keeps its place. external/ is untouched.
  • Tests: 470 passed, 100% coverage, as before.
  • CI: all checks passed, CI passed.

Review

Full review: the adversarial and quality reviewers checked that the diff is formatting only.

Declined review findings

None.

Open questions

None.

🤖 Generated with Claude Code

Summary by Sourcery

Enhancements:

  • Apply consistent Ruff/Black formatting and import sorting across the Python source and test files without changing application behavior.

Format all Python files with ruff 0.17.3 (Black style) and sort their
imports with ruff's isort rules, with the settings of #38
(target-version py313, force-sort-within-sections, known-first-party
pubgrade and tests, without the submodule external/). Formatting and
import order only.

Closes #71

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@sourcery-ai

sourcery-ai Bot commented Nov 7, 2026

Copy link
Copy Markdown

Reviewer's Guide

Implementation

Apply Ruff formatting and import sorting to the application modules without changing their behavior.

  • build-complete-updater/updater.py L1-5, L7 (removed lines), L44-46
  • pubgrade/errors/exceptions.py L2-192 (5 small edits)
  • pubgrade/modules/endpoints/builds.py L20-37, L547-565, L619-646 (+22 small edits)
  • pubgrade/modules/endpoints/repositories.py L47-52, L159-163, L196-200 (+10 small edits)
  • pubgrade/modules/endpoints/subscriptions.py L2-15, L61-73, L87-92 (+17 small edits)
  • pubgrade/modules/endpoints/users.py L3-6, L45-49, L103-106 (+12 small edits)
  • pubgrade/modules/server.py L26-151 (4 small edits)
  • pubgrade/timestamps.py L72

Configuration

Sort the imports in the package setup script.

  • setup.py L1-2

Tests

Apply Ruff formatting and import sorting to test modules and their shared mock data.

  • tests/mock_data.py L57-60, L88-91 (+4 small edits)
  • tests/pubgrade/endpoints/test_builds.py L15-42, L49-53, L112-120 (+39 small edits)
  • tests/pubgrade/endpoints/test_repositories.py L1-12, L21-28 (+2 small edits)
  • tests/pubgrade/endpoints/test_subscriptions.py L7-18, L38-44, L764-773 (+21 small edits)
  • tests/pubgrade/endpoints/test_users.py L8-11, L20-23 (+6 small edits)
  • tests/pubgrade/test_server.py L13-42, L332-338, L352-358 (+27 small edits)
  • tests/test_app.py L13, L56
  • tests/test_charsets.py L7 (removed lines), L9-10
  • tests/test_config.py L8, L14 (removed lines)
  • tests/test_exceptions.py L16 (removed lines), L49

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

@codecov

codecov Bot commented Nov 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (a8a8b23) to head (d2133eb).

Additional details and impacted files
@@            Coverage Diff            @@
##               dev       #72   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           16        16           
  Lines         1192      1192           
=========================================
  Hits          1192      1192           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@uniqueg
uniqueg marked this pull request as ready for review November 7, 2026 05:25
@uniqueg
uniqueg requested a review from akash2237778 as a code owner November 7, 2026 05:25

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

Linked issues

#71 style: apply ruff format and import sorting · 3 of 3 met

# Requirement Status Notes
1 Format all Python files with ruff format (Black style). ✅ Met The Python changes shown are formatting-only transformations.
2 Sort imports with ruff's isort rules and the specified settings, excluding external/. ✅ Met Imports are reordered within their sections; the linked description and PR summary state that the specified settings were used and external/ was left untouched.
3 Change only formatting and import order; keep code unchanged otherwise and tests passing as before. ✅ Met The apparent string changes are equivalent adjacent-literal concatenations, and the PR reports 470 passing tests with 100% coverage.

Sourcery assessment

Approved.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

@uniqueg
uniqueg merged commit 24a809e into dev Nov 7, 2026
48 of 55 checks passed
@uniqueg
uniqueg deleted the style/ruff-format branch November 7, 2026 05:31
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.

style: apply ruff format and import sorting

1 participant