{"id":21054,"library":"codeflash","title":"Codeflash","description":"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.","status":"active","version":"0.20.5","language":"python","source_language":"en","source_url":"https://github.com/codeflash-ai/codeflash","tags":["performance","optimization","AI","code-generation","linter-alternative"],"install":[{"cmd":"pip install codeflash","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"wrong":"from codeflash import run_codeflash","symbol":"run_codeflash","correct":"import codeflash"}],"quickstart":{"code":"from codeflash import run_codeflash\n\n# Example: optimize a simple function\ndef slow_function(n: int) -> int:\n    total = 0\n    for i in range(n):\n        total += i\n    return total\n\n# Run codeflash optimization (requires CODEFLASH_API_KEY env var)\noptimized_code = run_codeflash(slow_function, api_key=os.environ.get('CODEFLASH_API_KEY', ''))\nprint(optimized_code)","lang":"python","description":"Initialize Codeflash with API key and optimize a function."},"warnings":[{"fix":"Update imports to `from codeflash import run_codeflash`.","message":"In v0.17.0, the API changed from `codeflash.optimize` to `codeflash.run_codeflash`. Old code using `import codeflash.optimize` will break.","severity":"breaking","affected_versions":"<0.17.0"},{"fix":"Set `CODEFLASH_API_KEY` in your environment or pass `api_key` parameter.","message":"Codeflash requires an API key set via `CODEFLASH_API_KEY` environment variable. Without it, `run_codeflash` raises an authentication error.","severity":"gotcha","affected_versions":"all"},{"fix":"Remove `verbose` parameter and configure Python logging: `logging.basicConfig(level=logging.INFO)`.","message":"The `verbose` parameter in `run_codeflash` is deprecated since v0.19.0 and will be removed in v0.21.0. Use `logging` level instead.","severity":"deprecated","affected_versions":">=0.19.0, <0.21.0"},{"fix":"Ensure Python >=3.9 is used.","message":"Codeflash only supports Python 3.9 and above. Installing on older Python versions will fail with a `Requires-Python` error.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"search_vec":"'0.20.5':32 'activ':33 'ai':6,40 'ai-pow':5 'altern':46 'analyz':17 'automat':10 'code':13,18,42 'code-gener':41 'codeflash':1,2 'current':30 'develop':34 'generat':23,43 'improv':25 'intervent':29 'linter':45 'linter-altern':44 'minim':27 'optim':11,39 'perform':15,24,38 'power':7 'python':12 'releas':37 'run':19 'suit':21 'test':20 'tool':8 'user':28 'version':31 'week':36","created_at":"2026-04-27T16:57:50.598160+00:00","updated_at":"2026-04-27T16:57:50.598160+00:00","problems":null,"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"0.20.6","cli_name":"codeflash","cli_version":"Traceback (most recent call last):","type":"library","homepage":"https://codeflash.ai","github":null,"docs":null,"changelog":null,"pypi":"https://pypi.org/project/codeflash/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["ai-ml","devops","testing"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-30","last_verified":"2026-06-30","next_check":"2026-07-30","install_tag":null}}