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.33.tar.gz (46.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.33-py3-none-any.whl (41.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: wmk-0.33.tar.gz
  • Upload date:
  • Size: 46.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.33.tar.gz
Algorithm Hash digest
SHA256 ac948054944fdc6f2525829805acbbaeae2d694ccf073d0f1e4371253692385d
MD5 1e76d952732a206a8e88a3de4b358d65
BLAKE2b-256 13077dafc741908a79ea0b5be5be099366176dda4e72afdb30833740d770142d

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: wmk-0.33-py3-none-any.whl
  • Upload date:
  • Size: 41.0 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.33-py3-none-any.whl
Algorithm Hash digest
SHA256 bd50c68f3eef1886198eb210bd0db9db7e48d923875c660202a9b282dfdf4de0
MD5 b5f8d036cc8fb1d9d344035b3ead1308
BLAKE2b-256 5380377b81b29cb3f507ffb02e843687261c8cf6443642d020810005e502f357

See more details on using hashes here.

Provenance

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