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.29.tar.gz (42.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.29-py3-none-any.whl (37.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for wmk-0.29.tar.gz
Algorithm Hash digest
SHA256 2b5765cd3bbded0cd48a7312800f20f57c983cccf3ca66a67ef77038de036736
MD5 fd34df0cb505fd64768da288811364c1
BLAKE2b-256 a9cd4c11046af2fc8a49f65ea773c61af2ef25940b542bbcf95dbc8e9b8a5527

See more details on using hashes here.

Provenance

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

File metadata

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

File hashes

Hashes for wmk-0.29-py3-none-any.whl
Algorithm Hash digest
SHA256 de848346d241f4f316e63cbd05ae0a91b2a9bce6e13b0388a7e808245e9e6255
MD5 e2edd113f4bb306a96ae3fb9ff74077c
BLAKE2b-256 c70f19f872b6462ca103f129a8fadf04f9a1ccda8b57f4ef40b64f972b37340c

See more details on using hashes here.

Provenance

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