From ab796d739617f1c99009276174e125b1ddbaab56 Mon Sep 17 00:00:00 2001 From: Bradley Reynolds Date: Mon, 6 Jan 2025 20:25:47 -0600 Subject: [PATCH] Test out Codeflash (#93) * Test out Codeflash Signed-off-by: GitHub * Ignore new lint Signed-off-by: GitHub --------- Signed-off-by: GitHub --- .github/workflows/codeflash-optimize.yaml | 32 +++++++++++++++++++++++ pyproject.toml | 9 +++++++ 2 files changed, 41 insertions(+) create mode 100644 .github/workflows/codeflash-optimize.yaml diff --git a/.github/workflows/codeflash-optimize.yaml b/.github/workflows/codeflash-optimize.yaml new file mode 100644 index 0000000..e0579bc --- /dev/null +++ b/.github/workflows/codeflash-optimize.yaml @@ -0,0 +1,32 @@ +name: Codeflash + +on: + pull_request: + workflow_dispatch: + +jobs: + optimize: + name: Optimize new code in this PR + if: ${{ github.actor != 'codeflash-ai[bot]' }} + runs-on: ubuntu-latest + env: + CODEFLASH_API_KEY: ${{ secrets.CODEFLASH_API_KEY }} + CODEFLASH_PR_NUMBER: ${{ github.event.number }} + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + token: ${{ secrets.GITHUB_TOKEN }} + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.12' + - name: Install Project Dependencies + run: | + python -m pip install --upgrade pip + pip install . + pip install codeflash + - name: Run Codeflash to optimize code + id: optimize_code + run: | + codeflash diff --git a/pyproject.toml b/pyproject.toml index 7af55a2..52c6ab4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -49,6 +49,7 @@ select = ["ALL"] ignore = [ "CPY001", # (Missing copyright notice at top of file) "S311", # (Standard pseudo-random generators are not suitable for cryptographic purposes) - Really? + "DOC201", # (`return` is not documented in docstring) - TODO ] [tool.ruff.lint.extend-per-file-ignores] @@ -66,3 +67,11 @@ known-first-party = ["imsosorry.uwuification"] [tool.ruff.lint.pydocstyle] convention = "numpy" + +[tool.codeflash] +# All paths are relative to this pyproject.toml's directory. +module-root = "src" +tests-root = "tests" +test-framework = "pytest" +ignore-paths = [] +formatter-cmds = ["ruff check --exit-zero --fix $file", "ruff format $file"]