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 '.[test,dev]'

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.39.tar.gz (47.4 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.39-py3-none-any.whl (41.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for wmk-0.39.tar.gz
Algorithm Hash digest
SHA256 a5a175859431267863b7b7efc774ed6f033e7e3c94fb4948eeedcdaed20de0d9
MD5 3523bb10a4c6fc3f2c5e8dcd3de386dd
BLAKE2b-256 18a0dff7193a2b7e8d0f34f2f3cbb80c0b6969218c66b2b9519de593ec72f6df

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: wmk-0.39-py3-none-any.whl
  • Upload date:
  • Size: 41.5 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.39-py3-none-any.whl
Algorithm Hash digest
SHA256 59fcb27d9282e7ce42dad1b01284bf33c2e028053cb4e131259b34c1eb4dd87b
MD5 bf8759651deae5c13f932e81a60665bb
BLAKE2b-256 687b94ff27aea6bb5026526e7eeb95b2bf2ad5e436fbfb1e69ca1c14ffc1906c

See more details on using hashes here.

Provenance

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