Skip to content

ci: add codeflash - #88

Merged
gazorby merged 1 commit into
mainfrom
build/add-codeflash
Aug 4, 2025
Merged

ci: add codeflash#88
gazorby merged 1 commit into
mainfrom
build/add-codeflash

Conversation

@gazorby

@gazorby gazorby commented Aug 4, 2025

Copy link
Copy Markdown
Owner

Description

Types of Changes

  • Core
  • Bugfix
  • New feature
  • Enhancement/optimization
  • Documentation

Issues Fixed or Closed by This PR

Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • I have tested the changes and verified that they work and don't break anything (as well as I can manage).

Summary by Sourcery

Integrate Codeflash into the project by adding it to development dependencies, configuring it, and setting up a GitHub Actions workflow to optimize code on pull requests.

New Features:

  • Add Codeflash to dev dependencies and configure it in pyproject.toml

Enhancements:

  • Update mise.toml to use .env instead of .env.json for environment configuration

Build:

  • Install codeflash via the UV toolchain in the CI workflow

CI:

  • Create a GitHub Actions workflow to run Codeflash on pull requests

@sourcery-ai

sourcery-ai Bot commented Aug 4, 2025

Copy link
Copy Markdown

Reviewer's Guide

Integrate Codeflash for automated code optimization by adding it as a dev dependency and configuring its settings, update the environment file path in mise.toml, and introduce a GitHub Actions workflow to run Codeflash on pull requests.

Class diagram for Codeflash configuration in pyproject.toml

classDiagram
  class CodeflashConfig {
    +String module-root = "src"
    +String tests-root = "tests"
    +String test-framework = "pytest"
    +List ignore-paths = []
    +List formatter-cmds = ["ruff check --exit-zero --fix $file", "ruff format $file"]
  }
  class PyProjectToml {
    +CodeflashConfig tool.codeflash
  }
  PyProjectToml --> CodeflashConfig
Loading

File-Level Changes

Change Details Files
Add Codeflash dev dependency and configuration
  • Added codeflash>=0.6.22 to the dev dependencies list
  • Defined a [tool.codeflash] section with module-root, tests-root, test-framework, ignore-paths, and formatter-cmds
pyproject.toml
Update environment file reference
  • Changed environment file path from .env.json to .env in mise.toml
mise.toml
Add GitHub Actions workflow for Codeflash
  • Created .github/workflows/codeflash.yaml to run Codeflash on PRs targeting src/**
  • Configured job concurrency to cancel in-progress runs and allow manual dispatch
  • Set up steps: checkout with full history, enable uv caching, install Codeflash via uv, and execute Codeflash
.github/workflows/codeflash.yaml

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

@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 @gazorby - I've reviewed your changes - here's some feedback:

  • The Codeflash workflow only triggers on src/** changes — consider also including tests and configuration file paths so optimizations aren’t missed for those files.
  • You switched the mise.toml _.file from .env.json to .env; please confirm any env‐loading logic in the codebase is updated to read from the new .env file.
  • In the [tool.codeflash] config you run both “ruff check --exit-zero --fix” and “ruff format” on $file; consider consolidating to a single fix command to avoid redundant formatting passes.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The Codeflash workflow only triggers on src/** changes — consider also including tests and configuration file paths so optimizations aren’t missed for those files.
- You switched the mise.toml `_.file` from .env.json to .env; please confirm any env‐loading logic in the codebase is updated to read from the new .env file.
- In the [tool.codeflash] config you run both “ruff check --exit-zero --fix” and “ruff format” on $file; consider consolidating to a single fix command to avoid redundant formatting passes.

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.

@gazorby
gazorby merged commit 0432375 into main Aug 4, 2025
57 checks passed
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.

1 participant