Registry / ai-ml / codeflash

codeflash

JSON →
library0.20.6pypypi✓ verified 88d ago

Codeflash is an AI-powered tool that automatically optimizes Python code for performance. It analyzes code, runs test suites, and generates performance improvements with minimal user intervention. Current version: 0.20.5, active development with weekly releases.

pip install codeflash
INSTALL
IMPORT
SIG · CODEFLASH
C
codeflash
ai-mlpythonv0.20.6
Install
16.4s avg
Import
—
Disk
256MB
Pass rate
5/ 10
Env Coverage5 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v0.20.6 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.95 runs
build_error
glibc
py 3.10–3.95 runs
installs and imports cleanly · install 16.4s · import 0.000s · 258MB
256MB installed
● package 256MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

run_codeflash
✓ import codeflash
✗ from codeflash import run_codeflash

Initialize Codeflash with API key and optimize a function.

from codeflash import run_codeflash # Example: optimize a simple function def slow_function(n: int) -> int: total = 0 for i in range(n): total += i return total # Run codeflash optimization (requires CODEFLASH_API_KEY env var) optimized_code = run_codeflash(slow_function, api_key=os.environ.get('CODEFLASH_API_KEY', '')) print(optimized_code)
codeflash --version
Debug
Known issues
breakingIn v0.17.0, the API changed from `codeflash.optimize` to `codeflash.run_codeflash`. Old code using `import codeflash.optimize` will break.
fix
Update imports to `from codeflash import run_codeflash`.
affects: <0.17.0
gotchaCodeflash requires an API key set via `CODEFLASH_API_KEY` environment variable. Without it, `run_codeflash` raises an authentication error.
fix
Set `CODEFLASH_API_KEY` in your environment or pass `api_key` parameter.
affects: all
deprecatedThe `verbose` parameter in `run_codeflash` is deprecated since v0.19.0 and will be removed in v0.21.0. Use `logging` level instead.
fix
Remove `verbose` parameter and configure Python logging: `logging.basicConfig(level=logging.INFO)`.
affects: >=0.19.0, <0.21.0
gotchaCodeflash only supports Python 3.9 and above. Installing on older Python versions will fail with a `Requires-Python` error.
fix
Ensure Python >=3.9 is used.
affects: all
Upgrade
Version history
0.20.6latest on PyPI · released May 30, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
21 hits · last 30 days
node
16
OpenAI (training)
2
Resources
codeflash — pip install codeflash · libregistry