Skip to content

refactor: extract device registry and protocol from canvas.py#2201

Open
danielislas3 wants to merge 1 commit into
artisan-roaster-scope:masterfrom
danielislas3:feat/extract-device-registry
Open

refactor: extract device registry and protocol from canvas.py#2201
danielislas3 wants to merge 1 commit into
artisan-roaster-scope:masterfrom
danielislas3:feat/extract-device-registry

Conversation

@danielislas3

Copy link
Copy Markdown

What

Move the master device list (206 entries) and category sets from canvas.py into a standalone device_registry module, and define device protocols.

Why

  • The device list and category metadata are static data with no Qt dependency, but live inside a 19K-line canvas.py
  • Extracting them enables tooling, tests, and eventual SDK usage without instantiating the full application
  • 30+ machine drivers (KaleidoPort, Santoker, Orbiter, etc.) all implement the same implicit interface — now documented as RoasterProtocol

Files

File Change
artisanlib/device_registry.py New — 206-device list, 5 category sets, DEVICE_INFO dict, helper functions
artisanlib/device_protocol.py New — RoasterProtocol, ScaleProtocol
artisanlib/canvas.py Modified — imports from device_registry instead of ~400 inline lines
artisan.pro Modified — 2 new source files

Verification

  • ruff ✅
  • pylint 10/10 ✅
  • mypy ✅
  • pyright 0 errors ✅
  • pytest 2252 passed, 0 failed ✅

Zero behavior change.

Move the master device list (206 entries) and category sets
(phidget, nonSerial, nonTemp, special, binary devices) from
canvas.py into a standalone device_registry module.

Define RoasterProtocol and ScaleProtocol in device_protocol.py
to document the implicit interface that 30+ machine drivers
already implement.

All 2252 existing tests pass. Zero behavior change.
@danielislas3 danielislas3 force-pushed the feat/extract-device-registry branch from f13c3e7 to ee42d04 Compare June 27, 2026 06:31
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