Codeflash Benchmark

raw JSON →
0.3.0 verified Sat May 09 auth: no python

Pytest plugin for automatic code performance benchmarking and optimization, integrated with codeflash.ai. Current version 0.3.0, regular updates.

pip install codeflash-benchmark
error ModuleNotFoundError: No module named 'codeflash_benchmark'
cause Wrong import or not installed.
fix
Install with: pip install codeflash-benchmark
error usage: pytest [options] ... pytest: error: unrecognized arguments: --benchmark-only
cause Plugin not registered.
fix
Add 'pytest_plugins = ["codeflash_benchmark"]' to conftest.py or pytest.ini
gotcha Ensure CODEFLASH_API_KEY environment variable is set for remote optimization. Without it, benchmarking only runs locally.
fix Set CODEFLASH_API_KEY in your environment.
deprecated The auto-optimization feature may be deprecated in future versions; check docs for manual optimization.
fix Use explicit --benchmark-flags instead.

Enable the plugin via pytest_plugins and run with --benchmark-only flag.

# Add to conftest.py or pytest.ini
# pytest_plugins = ['codeflash_benchmark']
# Then run: pytest --benchmark-only
import os
if os.environ.get('CODEFLASH_API_KEY', ''):
    print('Benchmarking with codeflash.ai')