feat(exports): re-export 23 missing model classes from kalshi.__all__#110
Conversation
Closes #89 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Code Review — PR #110: Re-export 23 missing model classesOverall: Clean, well-scoped fix. The approach is correct and the dynamic parity test is the standout piece. A few minor points below. What this doesCloses the gap between Strengths
Issues / Suggestions1. Inline comment references issue #89 — remove it (CLAUDE.md §3) # Names added by issue #89 — keep this explicit so any future regression
# (e.g. a name silently dropped from kalshi/__init__.py) fails loudly with
# a clear list of what went missing.
NEWLY_EXPORTED: tuple[str, ...] = (CLAUDE.md says "Don't reference the current task, fix, or callers … since those belong in the PR description and rot as the codebase evolves." The comment also overstates what 2. The list captures a point-in-time audit snapshot. Once the next batch of exports is added,
3. def test_from_kalshi_import_star_exposes_newly_exported_names() -> None:
module = importlib.import_module("kalshi") # already imported as `kalshi` at top
namespace: dict[str, object] = {}
exec("from kalshi import *", namespace)
for name in NEWLY_EXPORTED:
assert name in namespace, f"`from kalshi import *` did not bind {name}"
assert namespace[name] is getattr(module, name)
4. Module docstring is fine; test function docstrings are inconsistent
Test coverage verdictThe three key properties are verified:
The 48 new tests match the CLAUDE.md baseline note. Coverage is solid. SummaryThe functional change is correct and ready to merge. The two items worth addressing before merge are the inline comment referencing issue #89 (violates CLAUDE.md §3) and the redundant |
Per code review on #110: - Drop the issue-referencing comment (CLAUDE.md §3 — task references rot). - Drop the NEWLY_EXPORTED point-in-time snapshot tuple; parametrize the identity test over kalshi.models.__all__ instead. Self-maintaining; no follow-up needed when more models get added to models.__all__. - Drop redundant importlib.import_module("kalshi") — use the existing top-level import. - Drop test docstrings that just restated the function name. Coverage strengthens: 48 -> 116 tests in this file (identity check now runs against every name in models.__all__, not just the audit-flagged 23). The __all__ membership check folds into the existing test_models_all_subset_of_kalshi_all parity test, removing duplication. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Addressed in latest commit:
The Test count for this file: 48 → 116 (identity check now runs against every name in |
Code Review — PR #110 (updated): Re-export 23 missing model classes
OverallClean, additive, correct. No functional changes, no regressions possible. The enforcement test is the right long-term investment.
|
Summary
kalshi.models.__all__but missing from the top-levelkalshi.__all__, so users canfrom kalshi import Xinstead offrom kalshi.models.<submodule> import X.tests/test_exports.py(48 tests): per-namefrom kalshi import Ximport + identity check against the underlying class,__all__membership check, and afrom kalshi import *star-import sanity check.Schedule classes decision (F-N-15 from the audit)
The schedule classes were lifted to top-level (rather than dropped from
kalshi.models.__all__). Rationale: minimal, additive, no breakage — matches the issue's preferred fix. Maintains parity invariant the new test now enforces.Closes #89
Test plan
uv run ruff check .cleanuv run mypy kalshi/clean