Skip to main content

Client for codeflash.ai - automatic code performance optimization, powered by AI

Project description

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.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

codeflash-0.20.4.tar.gz (16.4 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

codeflash-0.20.4-py3-none-any.whl (726.8 kB view details)

Uploaded Python 3

File details

Details for the file codeflash-0.20.4.tar.gz.

File metadata

  • Download URL: codeflash-0.20.4.tar.gz
  • Upload date:
  • Size: 16.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for codeflash-0.20.4.tar.gz
Algorithm Hash digest
SHA256 f5b02b211ea6646f69ce4cd27d9e6d048a835f7a20fa45aee1c6d123f1ba83ac
MD5 ee70efc929c64108e1dfda88dfae6fa6
BLAKE2b-256 325be49801ed18ba35cfb419ec3cbdd8148cbda46052c8c178041b013f75f41d

See more details on using hashes here.

File details

Details for the file codeflash-0.20.4-py3-none-any.whl.

File metadata

  • Download URL: codeflash-0.20.4-py3-none-any.whl
  • Upload date:
  • Size: 726.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for codeflash-0.20.4-py3-none-any.whl
Algorithm Hash digest
SHA256 0e0ed4193b16849b189a94a72a98dae2923259af4d970a1dcec32da083e3d9ac
MD5 e37f0e3188603573ce11c3dcabdb40c9
BLAKE2b-256 7a0558f73e79f365e30266e10e9f1d25d0d8989615d1389a7f7b89cdeb160bde

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page