Skip to main content

Official SDK for building Multimodal Observer (MOo) plugins.

Project description

MO API SDK

mo-api-sdk is the official SDK for building backend/API plugins for the Multimodal Observer (MOo) application.
It provides core interfaces, utilities, and tools to ensure your plugins are fully compatible with the MO backend runtime.

🚀 Features

  • Exposes base interfaces and utilities for building valid MO-compatible plugins.
  • Includes CLI tools to assist in plugin development and packaging.
  • Current available commands:
    • create-mop: interactive template generator for starting new MO plugin projects.
    • build-mop: packages a plugin directory into a .zip file ready for use in MO.
    • test-capture-mop: simulate and test your MO CapturePlugin with real or simulated input events, including coverage reporting.

🛠️ Usage

Importing Base APIs

Import all base classes and utilities directly from mo to ensure compatibility with the MO backend:

    from mo.core.plugin import Plugin
    from mo.core import Properties, PropertySelectOption
    # Or import other base classes, helpers, or constants as needed

Building Your Plugin

  • Implement your plugin as a subclass of the provided base interfaces (Plugin, CapturePlugin, etc).
  • Use the provided tools to define properties, validate configuration, and interact with the MO runtime.
  • Add your metadata.json and all required files in your plugin directory.

📦 Example: Minimal Capture Plugin

    from mo.modules.capture import CapturePlugin, CaptureData

    class MyCapture(CapturePlugin):
        def load(self):
            # Initialize plugin
            pass

        def unload(self):
            # Cleanup resources
            pass

        # ...implement all required methods...

🔧 CLI Tools

The SDK provides a command-line tool for packaging your plugin:

create-mop

Start a new MO plugin project using the interactive template generator:

  create-mop
  • Prompts you for the essential details and generates a full plugin project structure.
  • Includes ready-to-edit metadata.json, code skeletons, property templates, icon, and locale folders.

You can also use command-line flags:

create-mop --plugin-id my-plugin --publisher-id my-lab --venv

build-mop

Package your plugin for MO by running:

    build-mop

This will:

  • Validate your metadata.json and all entry points.
  • Package all necessary files into a versioned .zip in the dist/ directory.
  • Ensure all dependencies are included in the package.

Note:
If you encounter issues with automatic dependency detection, you can provide your own requirements.txt file and specify it using the -r or --requirements flag when running build-mop.


test-capture-mop

Test your MO CapturePlugin implementation in isolation, with real or simulated input, and (optionally) get a code coverage report of your plugin.

test-capture-mop

Key features:

  • Runs your capture plugin just as MO would, and writes output to a timestamped file.
  • Lets you simulate external events (like mouse or keyboard) during the test using the --simulate option.
  • Supports pause/resume testing, custom flush interval, settings injection, and coverage analysis of your plugin's code.
  • You can also import the CapturePluginTester class in your own Python test files and run programmatic tests, not just from the CLI.

Common options:

Option / Short Description
--plugin-dir PATH Path to the plugin root or metadata.json (default: ./)
--pause, -p Simulate pause and resume during test
--duration SECONDS, -d Duration of the test (default: 3.0)
--flush SECONDS, -f Data flush interval (default: 1.0)
--settings FILE Path to settings file (JSON)
--out DIR, -o Output folder for results
--prefix STRING Prefix for output file name
--quiet, -q Only show warnings and errors
--verbose, -v Show detailed log output
--simulate ENTRYPOINT, -s Python entrypoint for a simulation function (e.g. my.mod:run)
--coverage, -c Measure coverage for just the plugin's entrypoint code

Examples:

  # Basic usage
  test-capture-mop --plugin-dir ./my_plugin
  # With keyboard simulation (run function in ./tests/sim_keyboard.py)
  test-capture-mop -s tests.sim_keyboard:run
  # Run for 10 seconds, with pause/resume, and coverage
  test-capture-mop -d 10 -p -c
  # Custom settings and output folder
  test-capture-mop --settings settings.json -o ./test-results

To see a coverage report after running with --coverage, just run:

  coverage report

Or for a HTML report:

  coverage html

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mo_sdk-1.0.0.tar.gz (29.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mo_sdk-1.0.0-py3-none-any.whl (36.5 kB view details)

Uploaded Python 3

File details

Details for the file mo_sdk-1.0.0.tar.gz.

File metadata

  • Download URL: mo_sdk-1.0.0.tar.gz
  • Upload date:
  • Size: 29.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.12.9 Windows/11

File hashes

Hashes for mo_sdk-1.0.0.tar.gz
Algorithm Hash digest
SHA256 f217b9074c5d7243f19ed249463efb06370c7698d97e37c663bf6926b013491b
MD5 a63f66d810fba63f19add76551f101fc
BLAKE2b-256 0c51649771b2fe01ddf19e96f5a43d750dacfd0e39cb5abce707f6ddf4351671

See more details on using hashes here.

File details

Details for the file mo_sdk-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: mo_sdk-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 36.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.12.9 Windows/11

File hashes

Hashes for mo_sdk-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8c7432e6c2915f7d0b303fc8549facda1dad3c0f4b94ec001c59c44fa2c95852
MD5 50d0b8e8115f92057450e3afe0eb4f8d
BLAKE2b-256 eadb633e1d127aede195f6f5225d101a86d3022ad0b61358e1cc1572d9fd2dfa

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page