Upgrade to MADSci 0.8 + split COM driver into 32-bit sidecar#3
Open
RyanTheRobothead wants to merge 1 commit into
Open
Upgrade to MADSci 0.8 + split COM driver into 32-bit sidecar#3RyanTheRobothead wants to merge 1 commit into
RyanTheRobothead wants to merge 1 commit into
Conversation
MADSci 0.8 (via madsci-common 0.8.0) pulls in psycopg2-binary as a hard runtime dep. psycopg2-binary has no win32 wheel and falls back to a source build that needs pg_config — which means it can't be installed in 32-bit Python. The BMG node needs 32-bit Python because BMG_ActiveX.BMGRemoteControl is a 32-bit COM server. This splits the module into two processes (mirroring the pattern already used by inheco_incubator_module): - A new 32-bit FastAPI sidecar under sidecar/ that owns the ActiveX COM connection. Has no madsci dependency; minimal deps (fastapi, uvicorn, comtypes, pywin32, pydantic). - The existing src/bmg_rest_node.py now runs in 64-bit Python, drops the in-process BMGThread/BmgCom imports, and talks to the sidecar over loopback HTTP via the new sidecar_host / sidecar_port / sidecar_timeout config fields. Old src/bmg_interface.py and src/bmg_object_thread.py are deleted — the COM-owning code moved into sidecar/bmg_interface.py (with the EventClient dep stripped in favor of stdlib logging), and the thread/queue dispatcher is replaced by FastAPI request handling plus a single threading.Lock to serialize COM access. Also: - BmgCom.read_temps() now returns None per-sensor instead of raising when GetInfo returns a non-numeric value (typical when the device hasn't been initialized in SMART Control yet). - node uses self.node_info.node_name instead of the removed self.node_definition.node_name attribute (v0.8 breaking change). - pyproject: madsci.*~=0.6.0 → ~=0.8.0; requires-python >=3.9.1 → >=3.10 (v0.8 requires 3.10+); add requests; drop pywin32/comtypes (now sidecar- only). - .gitignore: ignore .madsci/ (runtime state) and .python-version (local dev). Cross-reference: blocks until upstream addresses AD-SDL/MADSci#343 (psycopg2-binary should not be a hard dep of madsci-common). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This was referenced May 28, 2026
Upgrade to MADSci 0.8 + lifespan migration + better COM diagnostics
AD-SDL/inheco_incubator_module#5
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
madsci.*pin from~=0.6.0to~=0.8.0; bump Python floor to 3.10 (required by v0.8).sidecar/, sincemadsci.common 0.8pulls inpsycopg2-binarywhich has no win32 wheel and breaks installs on the 32-bit Python the BMG ActiveX COM server requires.src/bmg_rest_node.pyto talk to the sidecar over loopback HTTP (mirrors the pattern already used byinheco_incubator_module), and delete the now-replacedsrc/bmg_interface.py+src/bmg_object_thread.py.Architecture
The split is the v0.8-specific workaround for upstream issue AD-SDL/MADSci#343 — the sidecar has no madsci dep at all, so the win32 wheel problem doesn't bite.
Notable details
sidecar/package has its ownpyproject.toml, its own venv (32-bit Python 3.12), and minimal deps (fastapi,uvicorn,pydantic,comtypes,pywin32).BMGNodeConfiggainssidecar_host/sidecar_port/sidecar_timeoutfields.self.node_definition.node_name→self.node_info.node_name(v0.8 removednode_definition).BmgCom.read_temps()now returnsNoneper-sensor instead of raising whenGetInforeturns a non-numeric value (typical when the device hasn't been initialized in SMART Control yet) — pre-existing bug exposed by the new HTTP-mediated state polling.Cross-references
psycopg2-binaryshould not be a hard dep ofmadsci-common. Until that lands, this sidecar split is the workaround.Test plan
pdm installinbmg_module/(64-bit venv) resolves cleanly with v0.8.pdm installinbmg_module/sidecar/(32-bit venv) resolves cleanly with no madsci deps.Initandread_tempsround-trip)./info,/state,/status.state_handlerpolls the sidecar without 500s.open,close,set_temp,run_assayround-trip through node → sidecar → COM.Readyfirst, node depends on it viaprocess_healthy.🤖 Generated with Claude Code