Coding super-intelligence to find the most optimized Python code. Use it to optimize existing codebases or new Pull requests as a GitHub Action or a VS Code Extension.
Find a file
Kevin Turcios ba56064c72
Merge pull request #2108 from codeflash-ai/chore/fix-claude-hooks
chore: fix claude hooks and add LSP tool env
2026-04-23 05:09:47 -05:00
.claude chore: fix claude hooks and add LSP tool env 2026-04-23 05:08:37 -05:00
.codeflash/benchmarks fix: resolve Windows 8.3 short paths in get_run_tmp_file and fix ruff lint errors 2026-04-10 08:51:10 -05:00
.codex chore: update tessl agent config files 2026-02-18 20:23:23 -05:00
.gemini chore: update tessl agent config files 2026-02-18 20:23:23 -05:00
.github fix: only skip linked-issue check for org members, not collaborators 2026-04-23 05:05:12 -05:00
benchmarks bench: add CLI startup benchmark for codeflash compare --script 2026-04-09 23:59:26 -05:00
code_to_optimize Remove test fixture lockfile: code_to_optimize_vitest 2026-04-23 04:14:16 -05:00
codeflash feat(js): add JavaScript function tracer with Babel instrumentation 2026-04-23 04:33:58 -05:00
codeflash-benchmark fix: prevent ruff auto-format from rewriting version.py placeholders 2026-04-09 23:21:25 -05:00
codeflash-java-runtime Remove debug timing instrumentation from tracer 2026-04-10 05:16:49 -05:00
docs update Docs for Plugin 2026-04-15 00:37:17 +05:30
experiments fix: lint issues in experiments folder and format fixes 2026-01-29 19:26:50 +05:30
packages/codeflash feat(js): add JavaScript function tracer with Babel instrumentation 2026-04-23 04:33:58 -05:00
tests feat(js): add JavaScript function tracer with Babel instrumentation 2026-04-23 04:33:58 -05:00
.coveragerc fix: exclude test_tracer.py from coverage run and lower floor to 58% 2026-04-23 03:04:49 -05:00
.gitignore chore: rebuild .claude config from scratch 2026-04-23 04:31:04 -05:00
.mcp.json Add MCP config for .mcp.json 2026-02-15 00:20:41 +00:00
.pre-commit-config.yaml chore: add mypy to pre-commit config and document setup 2026-04-23 04:38:34 -05:00
CLAUDE.md chore: add mypy to pre-commit config and document setup 2026-04-23 04:38:34 -05:00
codeflash.code-workspace Move benchmarks to .codeflash/benchmarks/ and auto-discover 2026-04-10 08:39:15 -05:00
CONTRIBUTING.md chore: require PRs to link an issue or discussion 2026-04-23 02:27:49 -05:00
LICENSE fix: update license format to use license-files 2026-02-17 05:54:21 +00:00
mypy_allowlist.txt fix: remove deleted cli_common.py from mypy_allowlist.txt 2026-03-17 08:18:45 +00:00
pyproject.toml chore: bump all dependency lower bounds to latest 3.9-compatible versions 2026-04-23 04:43:39 -05:00
README.md release/v0.17.0 (#756) 2025-09-23 14:02:30 -07:00
SECURITY.md Create SECURITY.md 2025-08-06 18:50:57 -07:00
tessl.json chore: update tessl tiles and upgrade dependencies 2026-02-18 20:23:23 -05:00
uv.lock chore: bump all dependency lower bounds to latest 3.9-compatible versions 2026-04-23 04:43:39 -05:00

Codeflash-banner

GitHub commit activity PyPI Downloads PyPI Downloads

Codeflash is a general purpose optimizer for Python that helps you improve the performance of your Python code while maintaining its correctness. It uses advanced LLMs to generate multiple optimization ideas for your code, tests them to be correct and benchmarks them for performance. It then creates merge-ready pull requests containing the best optimization found, which you can review and merge.

How to use Codeflash -

  • Optimize an entire existing codebase by running codeflash --all
  • Automate optimizing all future code you will write by installing Codeflash as a GitHub action.
  • Optimize a Python workflow python myscript.py end-to-end by running codeflash optimize myscript.py

Codeflash is used by top engineering teams at Pydantic (PRs Merged), Roboflow (PRs Merged 1, PRs Merged 2), Unstructured (PRs Merged 1, PRs Merged 2), Langflow (PRs Merged) and many others to ship performant, expert level code.

Codeflash is great at optimizing AI Agents, Computer Vision algorithms, PyTorch code, numerical code, backend code or anything else you might write with Python.

Installation

To install Codeflash, run:

pip install codeflash

Add codeflash as a development time dependency if you are using package managers like uv or poetry.

Quick Start

  1. To configure Codeflash for a project, at the root directory of your project where the pyproject.toml file is located, run:

    codeflash init
    
    • It will ask you a few questions about your project like the location of your code and tests
    • Ask you to generate an API Key to access Codeflash's LLMs
    • Install a GitHub app to open Pull Requests on GitHub.
    • Ask if you want to setup a GitHub actions which will optimize all your future code.
    • The codeflash config is then saved in the pyproject.toml file.
  2. Optimize your entire codebase:

    codeflash --all
    

    This can take a while to run for a large codebase, but it will keep opening PRs as it finds optimizations.

  3. Optimize a script:

    codeflash optimize myscript.py
    

Documentation

For detailed installation and usage instructions, visit our documentation at docs.codeflash.ai

Demo

  • Optimizing the performance of new code for a Pull Request through GitHub Actions. This lets you ship code quickly while ensuring it remains performant.

https://github.com/user-attachments/assets/38f44f4e-be1c-4f84-8db9-63d5ee3e61e5

  • Optiming a workflow end to end automatically with codeflash optimize

https://github.com/user-attachments/assets/355ba295-eb5a-453a-8968-7fb35c70d16c

Support

Join our community for support and discussions. If you have any questions, feel free to reach out to us using one of the following methods:

License

Codeflash is licensed under the BSL-1.1 License. See the LICENSE file for details.