Skip to content

Fix Bokeh typing errors in visualization module - #17

Merged
mahynski merged 2 commits into
mainfrom
codex/fix-ci/cd-mypy-errors
Jul 23, 2026
Merged

Fix Bokeh typing errors in visualization module#17
mahynski merged 2 commits into
mainfrom
codex/fix-ci/cd-mypy-errors

Conversation

@mahynski

Copy link
Copy Markdown
Owner

Motivation

  • Mypy was failing on starlingrt.visualize because Bokeh public exports and overloads caused incorrect type complaints for widget imports and figure usage.
  • The histogram point data name collided with a later glyph renderer variable, creating typing/confusion risks in code and CustomJS args.

Description

  • Replace widget imports from bokeh.models.widgets.inputs with the typed public exports via from bokeh.models import FileInput, RangeSlider, Select, Slider, TextInput to match Bokeh's typing surface.
  • Add from typing import Any, cast and define bokeh_figure = cast(Any, figure) then use bokeh_figure(...) where a typed-agnostic figure constructor is required to avoid mypy overload issues while preserving runtime behavior.
  • Rename histogram point return to hist_points (from points) and update usages passed into CustomJS to avoid colliding with the glyph renderer variable points used for plotting.
  • Change CrosshairTool(overlay=[...]) lists to tuples CrosshairTool(overlay=(...)) to satisfy the typed API for overlays in Bokeh.

Testing

  • Ran python -m mypy --ignore-missing-imports -p starlingrt and it completed with no issues.
  • Ran python -m pytest and all tests passed (1 passed, 1 skipped).

Codex Task

### Motivation
- Mypy was failing on `starlingrt.visualize` because Bokeh public exports and overloads caused incorrect type complaints for widget imports and `figure` usage.
- The histogram point data name collided with a later glyph renderer variable, creating typing/confusion risks in code and CustomJS args.

### Description
- Replace widget imports from `bokeh.models.widgets.inputs` with the typed public exports via `from bokeh.models import FileInput, RangeSlider, Select, Slider, TextInput` to match Bokeh's typing surface.
- Add `from typing import Any, cast` and define `bokeh_figure = cast(Any, figure)` then use `bokeh_figure(...)` where a typed-agnostic figure constructor is required to avoid mypy overload issues while preserving runtime behavior.
- Rename histogram point return to `hist_points` (from `points`) and update usages passed into `CustomJS` to avoid colliding with the glyph renderer variable `points` used for plotting.
- Change `CrosshairTool(overlay=[...])` lists to tuples `CrosshairTool(overlay=(...))` to satisfy the typed API for overlays in Bokeh.

### Testing
- Ran `python -m mypy --ignore-missing-imports -p starlingrt` and it completed with no issues.
- Ran `python -m pytest` and all tests passed (1 passed, 1 skipped).
@codecov

codecov Bot commented Jul 23, 2026

Copy link
Copy Markdown

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

@mahynski
mahynski marked this pull request as ready for review July 23, 2026 20:09
@mahynski
mahynski merged commit 304ee68 into main Jul 23, 2026
3 checks passed
@mahynski
mahynski deleted the codex/fix-ci/cd-mypy-errors branch July 23, 2026 20:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant