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
Saurabh Misra cdf28eb803
Some checks failed
CodeFlash / Optimize new Python code (pull_request) Failing after 2s
end-to-end-test / bubble-sort-optimization-pytest-no-git (pull_request) Failing after 2s
end-to-end-test / bubble-sort-optimization-unittest (pull_request) Failing after 2s
Coverage E2E / end-to-end-test-coverage (pull_request) Failing after 2s
end-to-end-test / futurehouse-structure (pull_request) Failing after 1s
end-to-end-test / init-optimization (pull_request) Failing after 2s
end-to-end-test / tracer-replay (pull_request) Failing after 1s
end-to-end-test / topological-sort-optimization (pull_request) Failing after 2s
Mypy Type Checking for CLI / type-check-cli (pull_request) Failing after 2s
/ Run pr agent on every pull request, respond to user comments (pull_request) Failing after 2s
unit-tests / unit-tests (3.10.13) (pull_request) Failing after 1s
unit-tests / unit-tests (3.11.6) (pull_request) Failing after 2s
unit-tests / unit-tests (3.12.1) (pull_request) Failing after 2s
unit-tests / unit-tests (3.13.0) (pull_request) Failing after 2s
unit-tests / unit-tests (3.9.18) (pull_request) Failing after 2s
Merge branch 'main' into update-docs-logos
2025-03-30 15:46:04 -07:00
.github/workflows Make codeflash github actions cooler? 2025-03-24 15:11:56 -07:00
code_to_optimize Merge branch 'main' into tracer_tracker 2025-03-13 00:34:10 +00:00
codeflash organized imports 2025-03-28 15:26:27 -07:00
docs update the logos 2025-03-30 15:45:22 -07:00
tests organized imports 2025-03-28 15:26:27 -07:00
.gitignore Use Pathlib instead, added .DS_Store to .gitignore 2025-02-14 23:19:14 +08:00
codeflash.code-workspace pass the right directory as arg 2025-03-03 15:17:40 -08:00
mypy_allowlist.txt mypy fixes 2024-12-26 14:46:26 -08:00
pyproject.toml adress review 2025-03-03 16:59:42 -08:00
README.md Apply suggestions from code review 2025-03-07 19:22:52 -08:00

Codeflash-banner

GitHub commit activity PyPI Downloads PyPI Downloads

Codeflash is a general purpose optimizer for Python that automatically improves 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 end-to-end by tracing the workflow.

Codeflash is used by top engineering teams at Pydantic, Langflow, Albumentations and many others to ship performant, expert level code.

Codeflash is great at optimizing AI Agents, Computer Vision algorithms, 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.

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

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.