Skip to main content

World Model Kit

Project description

World Model Kit

PyPI Tests

World Model Kit (WMK) is a comprehensive toolkit designed to streamline the development, deployment, and operation of interactive world models.

Key Features

  • High-Performance Rendering Native system integration for efficient real-time visualization of world model outputs, optimized for various display environments.

  • Interactive User Interface Comprehensive input processing system with support for keyboard and mouse interactions, event handling, and real-time response capabilities.

  • Extensible Architecture Built on top of Pyglet, enabling easy creation of custom window classes, event handlers, and graphics components.

  • Advanced Communication Layer Robust inter-process communication system featuring seamless integration with web clients and flexible message passing capabilities.

  • Media Processing Built-in support for audio and video capture from PipeWire sources with real-time processing capabilities.

  • Dependency Management Tools for packaging Python dependencies and project files into distributable archives with platform-specific package handling.

Installation

pip install wmk

Usage

Interactive Display with Player

Example of using the Player and Messenger modules for interactive applications:

from wmk.player import Player
from wmk.messenger import Messenger

is_user_connected = False

def handle_user_connection(message):
    nonlocal is_user_connected
    is_user_connected = True if message["type"] == "connected" else False

messenger = Messenger("/tmp/server.sock", "/tmp/client.sock")
messenger.push_handlers(connected=handle_user_connection, disconnected=handle_user_connection)

def frame_generator(window, dt):
    # Generate and return your frame here
    return frame if is_user_connected else empty_frame

player = Player(frame_generator)
player.run()

messenger.start()

Media Capture with MediaConsumer

To use MediaConsumer, make sure that your system supports GStreamer, for Ubuntu install the following packages:

sudo apt install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev python3-gi libgirepository-2.0-dev libcairo2-dev

Install WMK with optional dependencis media:

pip install wmk[media]

Example of capturing audio and video from PipeWire sources:

from wmk.media_consumer import MediaConsumer

def handle_media(frame):
    if frame.type == 'video':
        # Process video frame
        print(f"Received video frame: {frame.data.shape}")
    else:
        # Process audio data
        print(f"Received audio samples: {len(frame.data)}")

consumer = MediaConsumer(audio_node_id=51, video_node_id=52)
consumer.push_handlers(data=handle_media)
consumer.start()

File Downloads

Using the Loader for managing file downloads:

from wmk.loader import Loader

loader = Loader()

# Single file download
loader.download_file("https://example.com/file.dat", "local_file.dat")

# Multiple files in parallel
urls = {
    "https://example.com/file1.dat": "local_file1.dat",
    "https://example.com/file2.dat": "local_file2.dat"
}
results = loader.download_files(urls)

Command Line Interface

WMK provides a CLI for common operations:

# Package a project
wmk package --target ./myproject --name build.zip --platform manylinux2014_x86_64

# Download a file
wmk download --url https://example.com/file.dat --filepath local_file.dat

Development

To contribute to this library, first checkout the code. Then create a new virtual environment:

cd wmk
python -m venv venv
source venv/bin/activate

And install the dependencies:

python -m pip install -e '.'

To run the tests:

python -m pytest

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

wmk-0.37.tar.gz (47.7 kB view details)

Uploaded Source

Built Distribution

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

wmk-0.37-py3-none-any.whl (41.9 kB view details)

Uploaded Python 3

File details

Details for the file wmk-0.37.tar.gz.

File metadata

  • Download URL: wmk-0.37.tar.gz
  • Upload date:
  • Size: 47.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for wmk-0.37.tar.gz
Algorithm Hash digest
SHA256 7b00922b904e55a5a2365a1d8ac052478732a7ce402037e0b21cf51daf583eb5
MD5 a75d55ded134cca8383bc92c1fe66254
BLAKE2b-256 956e387b80056a851570c9124029300beca5ab49360f76f8edb1154cadac1479

See more details on using hashes here.

Provenance

The following attestation bundles were made for wmk-0.37.tar.gz:

Publisher: publish.yml on journee-live/wmk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file wmk-0.37-py3-none-any.whl.

File metadata

  • Download URL: wmk-0.37-py3-none-any.whl
  • Upload date:
  • Size: 41.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for wmk-0.37-py3-none-any.whl
Algorithm Hash digest
SHA256 a3186364f9141ddcb5ff5921e6de3baf086ec217d9644a7ce04bbfc3ca1a3ecd
MD5 ef2a43e6b25e4e72f8c1e01c8788372b
BLAKE2b-256 862cb527bfc44011c956d8f549eb11b3d1f6e7f7e64a8452257049d1b605873f

See more details on using hashes here.

Provenance

The following attestation bundles were made for wmk-0.37-py3-none-any.whl:

Publisher: publish.yml on journee-live/wmk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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