Skip to content

Commit 0288d0f

Browse files
aseembits93KRRT7
authored andcommitted
codeflash workflow for pydantic ai
1 parent 091c499 commit 0288d0f

File tree

3 files changed

+40
-0
lines changed

3 files changed

+40
-0
lines changed

.github/workflows/codeflash.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Codeflash
2+
on:
3+
pull_request:
4+
paths:
5+
# So that this workflow only runs when code within the target module is modified
6+
- 'pydantic_ai_slim/pydantic_ai/**'
7+
workflow_dispatch:
8+
concurrency:
9+
# Any new push to the PR will cancel the previous run, so that only the latest code is optimized
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: true
12+
jobs:
13+
optimize:
14+
name: Optimize new Python code
15+
# Don't run codeflash on codeflash-ai[bot] commits, prevent duplicate optimizations
16+
if: ${{ github.actor != 'codeflash-ai[bot]' }}
17+
runs-on: ubuntu-latest
18+
env:
19+
CODEFLASH_API_KEY: ${{ secrets.CODEFLASH_API_KEY }}
20+
steps:
21+
- name: 🛎️ Checkout
22+
uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0
25+
- name: 🐍 Setup UV
26+
uses: astral-sh/setup-uv@v6
27+
with:
28+
enable-cache: true
29+
- name: 📦 Install Dependencies
30+
run: uv sync --package pydantic-ai-slim
31+
- name: ⚡️Codeflash Optimization
32+
run: uv run codeflash

pydantic_ai_slim/pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ dev = [
103103
"boto3-stubs[bedrock-runtime]",
104104
"strict-no-cover>=0.1.1",
105105
"pytest-xdist>=3.6.1",
106+
"codeflash>=0.15.4"
106107
]
107108

108109
[tool.hatch.metadata]

pyproject.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,3 +287,10 @@ check-hidden = true
287287
# Ignore "formatting" like **L**anguage
288288
ignore-regex = '\*\*[A-Z]\*\*[a-z]+\b'
289289
ignore-words-list = 'asend,aci'
290+
291+
[tool.codeflash]
292+
module-root = "pydantic_ai_slim/pydantic_ai"
293+
tests-root = "tests"
294+
test-framework = "pytest"
295+
ignore-paths = []
296+
formatter-cmds = ["ruff check --exit-zero --fix $file", "ruff format $file"]

0 commit comments

Comments
 (0)