feat: add PythonPlugin with codeflash_core/codeflash_python packages#1887
feat: add PythonPlugin with codeflash_core/codeflash_python packages#1887
Conversation
|
Claude finished @KRRT7's task in 24m 53s —— View job PR Review Summary
Prek Checks
Code Review🔴 Critical Bugs (runtime crashes)1. Missing methods on
2.
3.
4. Behavioral regression in
🟡 Design Issues5.
6.
7. After removing the Duplicate DetectionHIGH confidence duplicates — code exists in both
The Test Coverage5 test files affected by this PR have test failures (7 Python, several Java). Java failures appear pre-existing (Java tracer infra issues unrelated to this PR). The Python failures listed above are regressions introduced by this PR. New files |
⚡️ Codeflash found optimizations for this PR📄 34% (0.34x) speedup for
|
⚡️ Codeflash found optimizations for this PR📄 17% (0.17x) speedup for
|
The codeflash_python verifier's generate_tests expected a Path but callers pass TestConfig. Match the old verifier's signature.
… mismatch The old AiServiceClient creates OptimizedCandidate from codeflash.models but the new OptimizationSet expects them from codeflash_python.models.
Delete src/codeflash_python/models/models.py and update all 53 files to import from codeflash.models.models — single source of truth.
Add ruff per-file-ignores for pre-existing PTH110, PTH123, PD011, E721 in src/codeflash_python/. Fix TC003 in addopts.py.
⚡️ Codeflash found optimizations for this PR📄 3,389% (33.89x) speedup for
|
⚡️ Codeflash found optimizations for this PR📄 2,465% (24.65x) speedup for
|
⚡️ Codeflash found optimizations for this PR📄 251% (2.51x) speedup for
|
The hot loop that processes invocation IDs now hoists three expensive operations outside the loop: `current_language_support()` (which imports and instantiates a registry lookup costing ~29 ms), `tests_root.resolve()` (filesystem stat calls adding ~1 ms), and constructing the Jest extensions tuple (repeated allocation overhead). Profiler data confirms `current_language_support()` consumed 99.8% of its 28.8 ms call time in a registry import, and moving it before the loop eliminates 17 redundant calls. Additionally, the optimized version skips `tabulate()` calls when row lists are empty, saving ~6-13 ms per empty table (three tables checked per invocation). These changes reduce the function's total time from 54.9 ms to 48.7 ms with no regressions.
⚡️ Codeflash found optimizations for this PR📄 21% (0.21x) speedup for
|
…2026-03-24T18.24.01 ⚡️ Speed up function `existing_tests_source_for` by 21% in PR #1887 (`codeflash_python`)
|
This PR is now faster! 🚀 @claude[bot] accepted my optimizations from: |
⚡️ Codeflash found optimizations for this PR📄 125% (1.25x) speedup for
|
Summary
codeflash_core(language-agnostic protocols, config, models) andcodeflash_python(~115 files, Python language plugin) undersrc/FunctionToOptimize,FunctionParent,HelperFunction, andTestConfigas single sources of truth fromcodeflash_corePythonPlugininto the orchestrator forbuild_index,rank_functions,cleanup_run, andget_call_graph_indexcurrent_language_support().function_optimizer_classwith directPythonFunctionOptimizerimportrank_all_functions_globally,rank_by_dependency_count,display_global_ranking)FunctionInfoalias — all code now importsFunctionToOptimizedirectlyCommits
Test plan
uv run pytest tests/passesuv run prekclean on all changed files