Skip to main content

enigma (host library)

The Python side of Enigma: it enumerates the USB-HID boards, applies JSON configs (control names, LED schemes, thresholds), reads control-state changes, drives indicator LEDs, and publishes state to companion displays over WebSocket.

Install

pip install .

That pulls the core runtime dependencies: hid and pyusb (USB-HID access) and python-socketio[asyncio_client] (which brings in aiohttp) for the WebSocket client that publishes spec values to displays.

Two optional extras add subsystem-specific dependencies, installed only if you ask for them:

Command Adds For
pip install .[audio] pyaudio, soundfile, pydub audio playback (music, voice, ambient, alerts)
pip install .[display] flask, flask-socketio the Flask companion-display server
pip install .[audio,display] both of the above audio + displays

The audio packages have native prerequisites (PyAudio needs PortAudio), so they are kept out of the base install for anyone who only wants control-surface and display functionality.

How it works

EnigmaManager owns the boards and the displays. You hand it a ConfigManager pointed at your JSON config directory; it reads the configs, brings up every connected board, and from then on each update() tick polls hardware, runs your device logic, drives the indicator LEDs, and pushes changed spec values to any connected displays.

For a runnable end-to-end version, see examples/engine-sw/.

Package layout

Module What it is Interface reference
enigma/manager.py EnigmaManager: top-level orchestrator for boards + displays Manager
enigma/config.py ConfigManager: loads and validates the JSON configs ConfigManager
enigma/device.py spec / published-value base classes (the shared state model) Device, specs
enigma/panelmanager.py panel/control lifecycle across boards Panel
enigma/displaymanager.py WebSocket display publishing + inbound events DisplayManager
enigma/hid_protocol.py the board wire protocol HID protocol
enigma/colors.py print_error / print_warning / brightness helpers -
enigma/boards/ per-board drivers: SW14, QD04, AN08, plus Thrustmaster and G Pro New board handler
enigma/audio/ the layered audio engine (optional [audio] extra) Audio, usage
enigma/tools/ code generators and command-line utilities (below) Code generation
enigma/docs/ full documentation docs index

The generated control classes (EngineControl etc.) aren't a module here: they are produced from the configs; their interface is the Control reference.

Code generation

The Spec, control, and audio classes your code imports are generated from the JSON configs. Regenerate after editing any config:

./mk.sh

mk.sh is a convenience wrapper over the three generators in enigma/tools/; see CODE_GENERATION.md for what each one does and the switches they take. The generators emit both Python code and reference docs.

Command-line tools

In enigma/tools/:

  • enigma_cli.py: inspect and exercise connected boards from a shell
  • hid_monitor.py: watch raw HID traffic to and from a board
  • generate_controls.py / generate_devices.py / generate_audio.py: the code generators (mk.sh runs all three)
  • gpro-daemon-*.sh: build, install, and manage the G Pro keyboard daemon

Documentation

Full reference documentation lives in enigma/docs/. Start with the design guide, then:

Example

examples/engine-sw/ is a complete end-to-end slice: a Python app that defines a spec and publishes values, its JSON board and display config, a Flask browser display, and a Unity receiver. See examples/.

Elsewhere in the repo

License

MIT; see the repository root LICENSE. Source files carry SPDX identifiers.

Metadata

Release files for enigma-console 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for enigma-console 1.0.1
File Size Uploaded
enigma_console-1.0.1.tar.gz 122.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for enigma-console 1.0.1
File Interpreter ABI Platform
enigma_console-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 260.3 kB

Release files / enigma_console-1.0.1.tar.gz

Download URL enigma_console-1.0.1.tar.gz
Size 122.1 kB
Tags Source
SHA-256 checksum
How to use checksums
674671001f40f7f9270c292db77f3368eae7f0de09587a00afa160f933c5a0af
BLAKE2b-256 checksum
How to use checksums
bdf4a8d4f0e2252e505c1e8c9da6a91f7ace6151dd81a2aa1e4ecba38246da1a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Release files / enigma_console-1.0.1-py3-none-any.whl

Download URL enigma_console-1.0.1-py3-none-any.whl
Size 138.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6ce16c6c07f51f1fff251dbb8b36fbfa5cb6a67513f06f18fc80a6479785c81f
BLAKE2b-256 checksum
How to use checksums
a8a5753dd22a8f7a4d10498b9a402ff21ec37e22f42e6121e338abf4ac4da185
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page