Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

PyPI version PyPI - Python Version

IS Matrix Forge

IS Matrix Forge is a Python framework for creating applications that drive 9×34 LED matrix displays. It provides high level helpers for talking to the hardware, tools for building animations, and utilities such as progress bars.

Features

  • Hardware control — device discovery and control over serial via pyserial, with support for multiple connected matrices
  • Mixin-based controller — LEDMatrixController composes device access, keep-alive pings, brightness and "breather" management, device identification, and command history with restore support; optional thread_safe=True mode guards device operations behind an RLock
  • Display engine — draw grids and patterns with the Grid class, build frame-based Animations (rewind, fast-forward, seek), and scroll text horizontally or vertically with TextScroller and bitmap font maps
  • Firmware games — launch Snake, Pong, Tetris, and Game of Life (with classic start patterns like glider, blinker, and toad) on the matrix
  • Audio tools — notification sounds via is_matrix_forge.notify.sounds and an optional AudioVisualizer in is_matrix_forge.led_matrix.display.animations.audio_visualizer for live input and audio files
  • Designer tools — a PySimpleGUI desktop designer, a JSON preset system with verified installs, and an optional Streamlit web-based pixel-grid animation editor
  • Progress bars — a tqdm-style helper that renders progress on the matrix
  • CLI — led-matrix console entry point with a threaded identify-matrices subcommand that identifies connected devices concurrently

Hardware Requirements

  • LED Matrix display with dimensions 9x34 (compatible with the project's specifications)
  • Serial connection to the computer (USB)
  • The LED matrix should have the following hardware identifiers:
    • VID: 0x32AC
    • PID: 0x20
    • Serial Number Prefix: FRAK

Software Dependencies

This project requires Python 3.12 or newer and the following dependencies:

  • chime (>=0.7.0,<0.8.0) - For audio notifications
  • pyserial (>=3.5,<4.0) - For serial communication with the LED matrix
  • inspy-logger (>=3.2.3,<4.0.0) - For logging
  • inspyre-toolbox (>=1.6.0) - Utility functions
  • pillow (>=11.2.1,<12.0.0) - Image processing
  • opencv-python (>=4.11.0.86,<5.0.0.0) - Image processing

Optional Tool Dependencies

The Streamlit editor and audio visualizer are included in the source tree but their third-party dependencies are not installed by poetry install or pip install .. Install only the dependencies for the tools you intend to use:

# Streamlit pixel-grid editor
pip install streamlit

# Audio visualizer (live input and audio-file playback)
pip install sounddevice soundfile

When using Poetry, run these commands after poetry shell so the packages are installed in the project's virtual environment.

Installation Instructions

  1. Clone the repository:

    git clone https://github.com/Inspyre-Softworks/IS-Matrix-Forge.git
    cd IS-Matrix-Forge
    
  2. Install dependencies using Poetry:

    poetry install
    
  3. Activate the virtual environment:

    poetry shell
    

Using pip

  1. Clone the repository:

    git clone https://github.com/Inspyre-Softworks/IS-Matrix-Forge.git
    cd IS-Matrix-Forge
    
  2. Install the package:

    pip install .
    

Usage Examples

Identify Connected Devices

from is_matrix_forge.led_matrix.helpers.device import DEVICES

for dev in DEVICES:
    print(dev)

Display Text on the Matrix

from is_matrix_forge.led_matrix.controller.controller import LEDMatrixController
from is_matrix_forge.led_matrix.helpers.device import DEVICES

ctrl = LEDMatrixController(DEVICES[0])
ctrl.scroll_text("Hello World!", loop=False)

Navigate an Animation

from is_matrix_forge.led_matrix.display.animations.animation import Animation
from is_matrix_forge.led_matrix.display.animations.frame.base import Frame

animation = Animation(
    frame_data=[
        Frame(grid=[[1]], duration=0.1, width=1, height=1),
        Frame(grid=[[0]], duration=0.1, width=1, height=1),
        Frame(grid=[[1]], duration=0.1, width=1, height=1),
    ]
)

animation.fast_forward()   # jump all the way to the last frame
animation.rewind()         # jump all the way back to the first frame
animation.fast_forward(2)  # move ahead two frames from the current cursor
animation.rewind(1)        # move back one frame from the current cursor
animation.seek(0)          # jump to an absolute frame index

Animation.rewind() and Animation.fast_forward() use relative step counts. Passing 0 or omitting the argument jumps to the beginning/end respectively. Use Animation.seek(index) when you want to jump to an absolute frame index.

Controller Architecture

  • Composition is implemented via multiple mixins that all use cooperative initialization with super().
  • MRO ordering ensures safe access patterns during __init__:
    • DeviceBase initializes early so mixins can use self.device.
    • BrightnessManager precedes BreatherManager because the breather inspects brightness at init time.
    • BreatherManager precedes IdentifyManager because IdentifyManager may call @synchronized methods in __init__ that rely on a breather pause context.
    • Loggable is placed last so the cooperative chain can pass logger= safely.
  • Thread safety: pass thread_safe=True to enable an internal RLock used by the @synchronized decorator for device operations.
  • Logging: integrates with InspyLogger when available and falls back to a simple logger; the controller passes parent_log_device through the cooperative chain and the fallback stub supports it.

MRO diagram (left → right, init order) DeviceBase → KeepAliveManager → AnimationManager → DrawingManager → BrightnessManager → BreatherManager → IdentifyManager → Loggable

Progress Bars

import time
from is_matrix_forge.progress import tqdm

for _ in tqdm(range(100)):
    time.sleep(0.05)

Troubleshooting

LED Matrix Not Detected

  1. Check that the LED matrix is properly connected to your computer.
  2. Verify that the LED matrix has the correct hardware identifiers (VID, PID, SN_PREFIX).
  3. Make sure you have the necessary permissions to access the serial port.
  4. Try running the application with administrator/root privileges.

Audio Notifications Not Working

  1. Ensure your system's audio is working correctly.
  2. Check that the WAV files for notifications exist in the expected locations.
  3. Verify that the chime library is properly installed.

Animation Issues

  1. Verify that the LED matrix is functioning correctly.
  2. Check that the matrix dimensions match the expected 9x34 size.
  3. Try clearing the matrix and restarting the application.

Contributing

Contributions are welcome! If you have ideas or improvements for Matrix Forge, feel free to open an issue or submit a pull request.

  • See docs/contributing-mixins.md for guidance on authoring new controller mixins using cooperative initialization and the @synchronized decorator. A minimal reference mixin is available at is_matrix_forge/led_matrix/controller/components/example_template.py.

Quick checklist for a new controller mixin

  • Create is_matrix_forge/led_matrix/controller/components/<name>.py with ClassNameManager.
  • In __init__(...), accept keyword-only args and call super().__init__(**kwargs).
  • Avoid IO-heavy work in __init__; use @synchronized for device methods.
  • If calling synchronized methods in __init__, ensure MRO places you after BreatherManager.
  • If adding to the main controller, place after DeviceBase and before IdentifyManager; consider dependencies.
  • Provide docstrings, type hints, and a small usage example or test.

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

Metadata

Release files for IS-Matrix-Forge 1.0.0.dev30

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

Source distribution (sdist)

Source distribution for IS-Matrix-Forge 1.0.0.dev30
File Size Uploaded Provenance Actions
is_matrix_forge-1.0.0.dev30.tar.gz 782.4 kB Without provenance Details for is_matrix_forge-1.0.0.dev30.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for IS-Matrix-Forge 1.0.0.dev30
File Interpreter ABI Platform Actions
is_matrix_forge-1.0.0.dev30-py3-none-any.whl Python 3 none any Details for is_matrix_forge-1.0.0.dev30-py3-none-any.whl

Total release size: 1.6 MB

Release files / is_matrix_forge-1.0.0.dev30.tar.gz

Download URL is_matrix_forge-1.0.0.dev30.tar.gz
Size 782.4 kB
Tags Source
SHA-256 checksum
How to use checksums
b224bd3540e2f7ebd83606a3bc4ad4477342648ae89cf01d92062c96896c7e21
BLAKE2b-256 checksum
How to use checksums
47b40395813c20f997063f38e498eeb552c6b0793cabd895b5eb4a8b65272e1d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.2.1 CPython/3.13.11 Windows/11

Release files / is_matrix_forge-1.0.0.dev30-py3-none-any.whl

Download URL is_matrix_forge-1.0.0.dev30-py3-none-any.whl
Size 848.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
499b5f7548c7cb74290f3d96082add4a4e7ff7ff45061077ec4b74e5492b3c77
BLAKE2b-256 checksum
How to use checksums
696ac3fa37f03338d4059af4f5ec11bb6f3a00ef57278c8f10b0b18edd08961c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.2.1 CPython/3.13.11 Windows/11

Security for IS-Matrix-Forge 1.0.0.dev30

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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