Skip to content

pmatev/py-viewport

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

py-viewport

A simple Python -> WebGL Bridge. Batteries not included.

Send raw image data to a browser window from python over websockets.

You can use this to live debug your python code and build visualisations without having to write out frames to a file or video.

Getting started

Install

pip install py-viewport

Run the examples

python examples/00_hello_world.py

Running in production

Start the server as a standalone process

py-viewport start

Usage

Render an image to the viewport

from viewport import Viewport

async with Viewport() as v:
    img = np.zeros([100,100,3], dtype=np.uint8)

    await v.draw(img.tobytes())

Examples

Development

Install system dependencies

brew install protobuf

Activate the python environment

pipenv install
pipenv shell

Install frontend dependencies and start the dev server

cd frontend/
npm install

Compile protobuf bindings

cd src/
./compile_protos.sh

Install the python package in editable mode

pip install -e .

Run the python server with live reload

py-viewport start --reload

Start the frontend dev server with live reload

cd frontend/
npm run start

About

Simple Python -> WebGL Bridge

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published