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.5.tar.gz (735.0 kB 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.5-py3-none-any.whl (729.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: codeflash-0.20.5.tar.gz
  • Upload date:
  • Size: 735.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","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.5.tar.gz
Algorithm Hash digest
SHA256 8f627416ac9f131a7d6893b1ae6984e0f46fa658aedc330e9990aeeaf461021b
MD5 a4638aabe1072b01f291558c391ce325
BLAKE2b-256 c5cf8ce2ac7c3e9174e8eee3eae27b47fea506bb937e5ef5ea226316482485dd

See more details on using hashes here.

File details

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

File metadata

  • Download URL: codeflash-0.20.5-py3-none-any.whl
  • Upload date:
  • Size: 729.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 7345d789f8ca1971a0c0d0a8eef6562894eef2ffde43069fc3e35255af0195ea
MD5 71e0f439c4e8d46ef9c1a2fb76393889
BLAKE2b-256 7cbf965d80211eb0d87760f350bdd478aae1de78470586895e91dd84e932f062

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