Skip to content

Commit 67d8a61

Browse files
committed
codeflash workflow for pydantic ai
1 parent 2b7899b commit 67d8a61

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
@@ -98,6 +98,7 @@ dev = [
9898
"boto3-stubs[bedrock-runtime]",
9999
"strict-no-cover>=0.1.1",
100100
"pytest-xdist>=3.6.1",
101+
"codeflash>=0.15.4"
101102
]
102103

103104
[tool.hatch.metadata]

pyproject.toml

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

0 commit comments

Comments
 (0)