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.
Install
pip install py-viewportRun the examples
python examples/00_hello_world.py
Start the server as a standalone process
py-viewport startRender 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())Install system dependencies
brew install protobufActivate the python environment
pipenv install
pipenv shellInstall frontend dependencies and start the dev server
cd frontend/
npm installCompile protobuf bindings
cd src/
./compile_protos.shInstall the python package in editable mode
pip install -e .Run the python server with live reload
py-viewport start --reloadStart the frontend dev server with live reload
cd frontend/
npm run start