Skip to content

fix(bench): treat pandas as optional in correctness_precheck#16

Merged
lavs9 merged 1 commit into
mainfrom
fix/benchmark-pandas-optional
Jul 16, 2026
Merged

fix(bench): treat pandas as optional in correctness_precheck#16
lavs9 merged 1 commit into
mainfrom
fix/benchmark-pandas-optional

Conversation

@lavs9

@lavs9 lavs9 commented Jul 16, 2026

Copy link
Copy Markdown
Owner

Summary

test_correctness_precheck_runs hard-failed with ModuleNotFoundError: No module named 'pandas', taking the whole benchmark harness self-test down with it.

benchmarks/python_comparisons.py already treats every other comparison dependency as optional:

helper missing dep behaviour
_tail_sma_talib returns Nonechecks["talib"] = "not_installed"
_tail_sma_quantwave returns Nonechecks["quantwave_ta"] = "skipped"
_collect_versions records "not_installed" for talib / pandas_ta
_tail_sma_pandas bare import pandas as pd → hard crash

Pandas was the sole mandatory dependency in a module built end-to-end to tolerate missing ones. _tail_sma_pandas now returns None on ImportError, and correctness_precheck records "pandas_rolling": "not_installed" — the same shape as the talib branch directly below it.

Why not pytest.importorskip("pandas")

That was the obvious one-liner, and it's wrong. It skips the entire precheck, discarding the quantwave_ta correctness check — the one comparison that actually guards this library. A green-by-skipping test is exactly the kind of thing planning/BRUTAL_REVIEW_2026-07-07.md calls out.

Polars remains the reference (_tail_sma_polars), so a missing pandas costs one cross-check, not the precheck. Without pandas installed, the precheck now still runs and reports:

passed: True
  pandas_rolling   not_installed
  quantwave_ta     ok            <-- still guarding the library
  talib            not_installed

Verification

Relates to quantwave-9gek.2 (benchmark harness).

🤖 Generated with Claude Code

test_correctness_precheck_runs hard-failed with ModuleNotFoundError when
pandas was absent, taking the whole benchmark harness self-test down with it.

python_comparisons.py already treats every other comparison dependency as
optional -- _tail_sma_talib returns None on ImportError -> "not_installed",
_tail_sma_quantwave returns None -> "skipped", and _collect_versions records
"not_installed" for talib/pandas_ta. Only _tail_sma_pandas hard-imported,
making pandas the sole mandatory dep in a module built to tolerate missing
ones.

_tail_sma_pandas now returns None on ImportError and correctness_precheck
records "pandas_rolling": "not_installed", matching the talib branch exactly.

Deliberately NOT pytest.importorskip("pandas") on the test: that would skip
the entire precheck and discard the quantwave_ta correctness check -- the one
comparison that actually guards this library. The precheck now still runs and
reports quantwave_ta: ok without pandas installed.

Polars remains the reference (_tail_sma_polars), so a missing pandas costs one
cross-check, not the precheck.

tests/python/test_benchmark_harness.py: 4 passed (was 3 passed, 1 failed).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@lavs9 lavs9 merged commit 36161e8 into main Jul 16, 2026
5 checks passed
@lavs9 lavs9 deleted the fix/benchmark-pandas-optional branch July 16, 2026 03:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant