Skip to content

fix(typing): normalize polars aggregates for polars 1.44 (unblocks #154) - #157

Merged
TexasCoding merged 1 commit into
mainfrom
maint/154-polars-mypy
Oct 5, 2026
Merged

TexasCoding merged 1 commit into
mainfrom
maint/154-polars-mypy

Conversation

@TexasCoding

Copy link
Copy Markdown
Owner

Unblocks Dependabot #154 (python-patch group), whose CI lint job fails only on mypy after its polars 1.32.2 → 1.44.2 bump. Polars 1.44 types Series.sum() as int | float | Decimal, which produced 11 operator/TypedDict errors in:

  • sessions/statistics.py (VWAP)
  • client/market_data.py (session VWAP)
  • orderbook/base.py (bid/ask totals and imbalance)

The fix converts the aggregates to float/int where they're read. Runtime return values are unchanged (orderbook volume is Int64; empty/zero handling is the same). There's no # type: ignore and no public API change. Unit tests pin VWAP, session VWAP, and orderbook totals/imbalance, including empty sides.

The branch is code-only and doesn't touch uv.lock; Dependabot owns the lock. I checked mypy locally against both polars 1.32.2 (the current lock) and 1.44.2.

Refs #154

Polars 1.44 types Series.sum() as int | float | Decimal, so mypy
rejects arithmetic on VWAP and orderbook imbalance. Convert aggregates
to float/int at the read site. Runtime return values are unchanged.
@TexasCoding
TexasCoding merged commit 08b4d85 into main Oct 5, 2026
7 checks passed
@TexasCoding
TexasCoding deleted the maint/154-polars-mypy branch October 5, 2026 11:39
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