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.36.tar.gz (48.0 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.36-py3-none-any.whl (42.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for wmk-0.36.tar.gz
Algorithm Hash digest
SHA256 df82c47482657b1ec91377e27120efa4b5a5fc9e214304145191585091228d0a
MD5 f94f5388c47d58c265961085d81affc4
BLAKE2b-256 fa17401e98249a0aa414c29a1b67d53db2b65124e272416558fc70ce4a0052d4

See more details on using hashes here.

Provenance

The following attestation bundles were made for wmk-0.36.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.36-py3-none-any.whl.

File metadata

  • Download URL: wmk-0.36-py3-none-any.whl
  • Upload date:
  • Size: 42.3 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.36-py3-none-any.whl
Algorithm Hash digest
SHA256 4efc25523edcd0d64b5bc77ec1b38b54517268af03cbd0cb41d40e01af4bea27
MD5 97a369e7bdd5164ab596ab41ca5eafe0
BLAKE2b-256 e2bfd3154a4d4fedf1197a3eaf0958b6b6bb3ed5c77ea1dd735a4e5ff8efde62

See more details on using hashes here.

Provenance

The following attestation bundles were made for wmk-0.36-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