Drop pynput dependency to fix Linux installs#323
Open
m9h wants to merge 1 commit intoNeuroTechX:masterfrom
Open
Drop pynput dependency to fix Linux installs#323m9h wants to merge 1 commit intoNeuroTechX:masterfrom
m9h wants to merge 1 commit intoNeuroTechX:masterfrom
Conversation
pynput pulls in `evdev`, which currently fails to build from source under several common Linux toolchains (the symbol `SND_PROFILE_RING` used in evdev 1.9's input.h binding is missing from older kernel headers and conda's sysroot). Users hitting this see a wall of C compile errors at `uv pip install`/`pip install` time. The only two callsites of pynput in the tree are `check_report`-style "press C + enter within 5 seconds to cancel" prompts in `analysis/utils.py` and `analysis/streaming_utils.py`. Both are replaced with a small `wait_for_cancel(timeout, cancel_key)` helper in the new `eegnb/utils/cancel.py` that reads stdin on a daemon thread. Cross-platform, zero new dependencies, same observable UX. Also guards the unconditional `import pyxid2` in `devices/eeg.py` behind a try/except. pyxid2 is only exercised by the Cedrus response-box path (`_init_xid`) and is not needed for the main Muse / OpenBCI / Unicorn pipelines; it was blocking imports in environments where the Cedrus C library isn't available. A clear ImportError is raised if the user actually invokes `_init_xid` without the library installed. No behaviour change on the supported backends.
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
pynputpulls inevdev, which fails to build on many modern Linux toolchains (missingSND_PROFILE_RINGsymbol when the build environment's kernel headers or conda sysroot is older than the oneevdev1.9 expects). Users hitting this see a wall of C compile errors at install time, andpip install eeg-notebooksbecomes non-functional on Fedora 43 + miniconda, and on several fresh-install Ubuntu/Debian setups.pynputis only used in two places: the "press C + enter within 5s to cancel" prompt insidecheck_reportinanalysis/utils.pyand its twin inanalysis/streaming_utils.py. Neither benefits from pynput's global-keyboard hook — a plain stdin read suffices.This PR replaces both callsites with a small
wait_for_cancel(timeout, cancel_key)helper (eegnb/utils/cancel.py, ~40 lines) that reads stdin on a daemon thread. Cross-platform, zero new dependencies, identical observable UX.It also makes the top-level
import pyxid2indevices/eeg.pylazy:pyxid2is only exercised by the Cedrus XID response-box path (_init_xid), and is not needed for Muse / OpenBCI / Unicorn. Wrapping the import in try/except unblocks environments where the Cedrus C library isn't installable while still raising a clearImportErrorif the user actually invokes_init_xidwithout it.No behaviour change on the supported backends.
Test plan
🤖 Generated with Claude Code