Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@cgtobi
Copy link
Collaborator

@cgtobi cgtobi commented Jul 8, 2025

Summary by Sourcery

Replace Black with Ruff for code formatting and linting across CI and pre-commit hooks, update Python versions in workflows, and apply corresponding code reformatting adjustments.

Enhancements:

  • Swap out Black for Ruff by using astral-sh/ruff-action in GitHub workflows for format and lint steps
  • Update pre-commit config to use ruff-pre-commit hooks for formatting and linting instead of Black
  • Switch typechecker job to use astral-sh/setup-uv for managing Python versions in CI
  • Bump Python versions in CI and publish workflows to 3.12.x and add 3.13.x to the test matrix

CI:

  • Standardize formatting and lint jobs on ruff-action and remove direct pip installs of Black and Ruff
  • Adjust test job to install and run Tox via uv with updated Python environments

Deployment:

  • Update publish-to-pypi and publish-to-test-pypi workflows to use Python 3.12.11

Chores:

  • Apply multi-line string and minor formatting changes in source files to comply with Ruff rules

@cgtobi cgtobi requested a review from jabesq as a code owner July 8, 2025 10:19
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Jul 8, 2025

Reviewer's Guide

This PR replaces Black with Ruff as the code formatter and linter across CI and pre-commit, bumps Python versions in workflows, introduces the UV wrapper for tox in the typechecker job, and applies multiline formatting adjustments in source files to satisfy Ruff.

Flow diagram for pre-commit hooks with Ruff replacing Black

flowchart TD
    PreCommit[pre-commit]
    RuffCheck[ruff-check]
    RuffFormat[ruff-format]
    PreCommitHooks[pre-commit-hooks]

    PreCommit --> RuffCheck
    PreCommit --> RuffFormat
    PreCommit --> PreCommitHooks
Loading

File-Level Changes

Change Details Files
CI workflows migrated from Black to Ruff and updated Python/matrix settings
  • Replaced Black format/check steps with astral-sh/ruff-action@v3 using format and check args
  • Removed pip install black and related setup-python steps
  • Updated linter job to use Ruff action for linting
  • Bumped Python versions in matrix entries to 3.12.11 (and 3.13.5 in typechecker)
  • Swapped setup-python with astral-sh/setup-uv and prefixed tox commands with uv
.github/workflows/pythonpackage.yml
.github/workflows/publish-to-pypi.yml
.github/workflows/publish-to-test-pypi.yml
Pre-commit configuration switched from Black to Ruff
  • Updated Ruff pre-commit hook rev to v0.12.2
  • Removed PSF Black repo entry
  • Added ruff-check hook (with --fix) and ruff-format hook
.pre-commit-config.yaml
Source formatting adjusted to comply with Ruff’s style rules
  • Refactored long f-string constants into multiline string concatenations
  • Consolidated JSON assignment for end_time into a single line with parentheses
src/pyatmo/modules/module.py
src/pyatmo/room.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 @cgtobi - I've reviewed your changes - here's some feedback:

  • Ensure the pythonpackage and linter jobs still include a code checkout or confirm that ruff-action implicitly checks out the repo and sets up Python, otherwise those steps will fail.
  • Double-check that the new pre-commit hook IDs (ruff-check and ruff-format) actually exist in the ruff-pre-commit repo to avoid misconfigured hooks.
  • The expanded f-string blocks for ENERGY_FILTERS could be simplified by constructing a list of values and using ','.join(...) to reduce repetition and improve maintainability.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Ensure the `pythonpackage` and `linter` jobs still include a code checkout or confirm that `ruff-action` implicitly checks out the repo and sets up Python, otherwise those steps will fail.
- Double-check that the new pre-commit hook IDs (`ruff-check` and `ruff-format`) actually exist in the ruff-pre-commit repo to avoid misconfigured hooks.
- The expanded f-string blocks for ENERGY_FILTERS could be simplified by constructing a list of values and using `','.join(...)` to reduce repetition and improve maintainability.

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.

jabesq
jabesq previously approved these changes Jul 8, 2025
@cgtobi cgtobi requested a review from jabesq July 8, 2025 19:14
@jabesq jabesq merged commit 32d5799 into development Jul 9, 2025
14 checks passed
@jabesq jabesq deleted the use_uv_tooling branch July 9, 2025 07:49
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.

3 participants