Skip to content

refactor: split types.py into device.py, net.py, and network/records.py - #15

Merged
kewde merged 1 commit into
refactor/move-color-helpers-out-of-typesfrom
refactor/split-types-module
Aug 20, 2026
Merged

refactor: split types.py into device.py, net.py, and network/records.py#15
kewde merged 1 commit into
refactor/move-color-helpers-out-of-typesfrom
refactor/split-types-module

Conversation

@kewde

@kewde kewde commented Aug 20, 2026

Copy link
Copy Markdown
Collaborator

Summary

Stacked on #14 — targets that branch instead of master since it continues the same cleanup; merge #14 first, then retarget/merge this one.

types.py had become a grab-bag with three genuinely unrelated concerns living in one file with no clear ownership:

  • knx_gui/device.py — the device/com-object domain model (Device, ComObject, ComObjectFlags, PinDir, PinRow, generate_rows, etc.). Kept together as one module rather than split further: Device.rows calls generate_rows/PinRow directly, so splitting those into plugins/node_editor/ would've made a top-level domain type depend on a specific UI plugin — the same backwards-dependency problem already being avoided elsewhere in this codebase.
  • knx_gui/net.pyTelegramSource, the dispatch-chain source tag shared by connection/network/proxy/virtual. (Will end up alongside Peer once the in-progress pcap-capture branch merges — same category of thing, used by the same set of files.)
  • knx_gui/plugins/network/records.pyCemiRecord, TelegramRecord. Exclusively consumed by the network plugin, so plugin-local scope fits.

Also removed is_default_flags/listen_obj/send_obj/bidirectional_obj — confirmed dead code (defined, never called anywhere in the app).

Test plan

  • uv run ruff check / ruff format --check clean
  • uv run pyright — 0 errors (note: doesn't actually cover apps/knx-gui, scoped to packages/* only)
  • Direct import smoke test of all 19 touched modules — all import cleanly
  • uv run pytest — 231 passed
  • Launched the GUI — demo project loads with 5 devices, exercising the moved Device/ComObject code path directly

types.py had become a grab-bag: the device/com-object domain model
(Device, ComObject, ComObjectFlags, PinDir, PinRow...), dispatch-chain
vocabulary shared across connection/network/proxy/virtual
(TelegramSource), and network-capture-specific display records
(CemiRecord, TelegramRecord) all lived in one file with no clear
ownership.

- knx_gui/device.py: the device/com-object domain model. Kept
  together rather than split further, since Device.rows depends
  directly on PinRow/generate_rows - splitting those into
  plugins/node_editor/ would have made a top-level domain type
  depend on a specific UI plugin.
- knx_gui/net.py: TelegramSource (joins Peer from the in-progress
  pcap capture branch - both are dispatch-chain plumbing shared by
  the same set of plugins).
- knx_gui/plugins/network/records.py: CemiRecord, TelegramRecord -
  exclusively consumed by the network plugin.

Also dropped is_default_flags/listen_obj/send_obj/bidirectional_obj -
confirmed dead code (defined, never called anywhere in the app).
@kewde
kewde merged commit 681a997 into master Aug 20, 2026
5 checks passed
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