Registry / ai-ml / codeflash

codeflash

JSON →
library0.20.5pypypi✓ verified 33d 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.

ai-mldevopstesting
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

import 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 footguns
breakingIn v0.17.0, the API changed from `codeflash.optimize` to `codeflash.run_codeflash`. Old code using `import codeflash.optimize` will break.
gotchaCodeflash requires an API key set via `CODEFLASH_API_KEY` environment variable. Without it, `run_codeflash` raises an authentication error.
deprecatedThe `verbose` parameter in `run_codeflash` is deprecated since v0.19.0 and will be removed in v0.21.0. Use `logging` level instead.
gotchaCodeflash only supports Python 3.9 and above. Installing on older Python versions will fail with a `Requires-Python` error.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
0 hits · last 30 days

No traffic data recorded yet.

Resources