--- id: codeflash version: "0.20.6" license: unclear license_treatment: unclear maintenance: active --- # codeflash — Client for codeflash.ai - automatic code performance optimization, powered by AI License: unclear · Maintenance: active · Downloads: 191.9K/mo ## What it is and what it does Codeflash is a command-line client for an AI-powered code optimization service. It analyzes your Python code, generates multiple optimization candidates using LLMs, tests them for correctness, benchmarks them for performance, and opens pull requests with the best improvements. You configure it once with `codeflash init` (which asks for an API key and optional GitHub app setup), then run `codeflash --all` to optimize an entire codebase, `codeflash optimize myscript.py` for a single file, or set up GitHub Actions to optimize all future pull requests automatically. The tool depends on a large set of runtime libraries for code analysis (libcst, jedi), testing (pytest and variants), profiling (line-profiler, memray), and communication with the Codeflash service (requests, posthog, sentry-sdk). It's designed for teams shipping Python code—AI agents, computer vision, PyTorch, numerical, and backend workloads—where performance matters and code review is already part of the workflow. Use it for: - Optimize an entire existing Python codebase in one pass to find and merge performance improvements across all modules. - Automatically optimize new code in pull requests via GitHub Actions before it ships, ensuring performance without manual profiling. - Profile and optimize a single Python script or workflow end-to-end without manual benchmarking or code review. - Integrate performance optimization into CI/CD so that performance regressions are caught and fixed before merge. - Explore multiple optimization strategies for hot code paths and let the tool rank them by actual benchmark results. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Codeflash is a CLI tool that uses LLMs to automatically generate, test, and benchmark Python code optimizations, then opens pull requests with the best performance improvements found. Yes, with conditions. Install if you have an active Codeflash.ai account and API key, want LLM-assisted performance optimization integrated into your workflow, and are willing to review and merge AI-generated pull requests. The tool is actively maintained, has low install friction, and carries no known vulnerabilities. The main friction is the unclear license metadata—verify the BSL-1.1 terms apply to your use case before relying on it in production. The 38 runtime dependencies are substantial but necessary for the feature set. ## Install pip install codeflash uv add codeflash poetry add codeflash ## Installing codeflash Before you install: Low install friction with a pure-Python wheel. Requires 38 runtime dependencies including testing frameworks (pytest, pytest-asyncio, pytest-memray), profiling tools (line-profiler, memray), and LLM/analysis libraries (jedi, libcst, crosshair-tool). Active maintenance with latest release 76 days ago. License in practice: License treatment is unclear—no SPDX identifier or raw license text is available in the package metadata, though the description mentions BSL-1.1. Verify the actual license terms before committing to production use. Quickstart: pip install codeflash codeflash init codeflash --all Requires Python >=3.9. Codeflash init requires an API key from codeflash.ai and optionally a GitHub app installation to open pull requests. Verify before relying: - Whether the BSL-1.1 license mentioned in the description is the actual license or if the unclear metadata reflects a different licensing model. - Whether the 38 runtime dependencies are all required at install time or if some are optional for specific features. - Performance and cost implications of running LLM-based optimization on large codebases. ## Package facts - License: not declared (unclear) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 191.9K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags python code performance optimization, automatic code optimization with ai, llm-powered performance tuning, python performance profiling and optimization, code optimization pull requests, ai code optimizer, python benchmarking and optimization, performance-optimization, ai-assisted, code-analysis [View on SkillFed](https://skillfed.io/packages/codeflash) · [View on PyPI](https://pypi.org/project/codeflash/)