This release is a pre-release and may not be stable for production use.
Brayns Python Client
A client for Brayns based on the Rockets client to provide remote control of a running Brayns instance.
Table of Contents
Installation
You can install this package from PyPI:
pip install brayns
Usage
Client vs. AsyncClient
Brayns provides to types of clients to support asychronous and synchronous usage.
The AsyncClient exposes all of its functionality as async functions, hence an asyncio
event loop is needed to complete pending
execution via await or run_until_complete(). The added benefit is to watch progress of pending
tasks or cancel their execution. This is provided by according widgets if the Brayns client is used
from within a Jupyter notebook.
For simplicity, a synchronous Client is provided which automagically executes in a synchronous,
blocking fashion.
Connection
Create a client:
from brayns import Client
client = Client('localhost:8200')
print(brayns)
`Brayns version 0.8.0.c52dd4b running on http://localhost:8200/`
Create an asynchronous client:
from brayns import AsyncClient
client = await AsyncClient('localhost:8200')
print(brayns)
`Brayns version 0.8.0.c52dd4b running on http://localhost:8200/`
Properties
Exposed properties from Brayns are properties on the python side as well:
from brayns import Client
client = Client('myhost:8080')
print(client.camera)
Changes on the properties must be communicated with commit() to Brayns:
from brayns import Client
client = Client('myhost:8080')
client.camera.origin = [1,2,3]
client.camera.commit()
Methods
Calling an RPC on Brayns is as simple as calling a method on the client object:
from brayns import Client
client = Client('myhost:8080')
client.set_camera(current='orthographic')
Above method does only return something on error. There are also requests:
from brayns import Client
client = Client('myhost:8080')
clip_planes = client.get_clip_planes()
Snapshot
Make a snapshot and return a PIL image:
from brayns import Client
client = Client('myhost:8080')
img = client.image(format='png', size=(1920, 1080), samples_per_pixel=64)
Live rendering
If you are using the client in a Jupyter notebook, you can watch the live rendering of Brayns in a widget:
from brayns import Client
client = Client('myhost:8080')
client.show()
Release files for brayns 0.8.0.dev0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| brayns-0.8.0.dev0.tar.gz | 13.7 kB | Details |
Release files / brayns-0.8.0.dev0.tar.gz
| Download URL | brayns-0.8.0.dev0.tar.gz |
|---|---|
| Size | 13.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bc0e55b9eeeec57fb83050c2e453160f286a6699f698502c3de67b2508c2cd15
|
|
BLAKE2b-256 checksum How to use checksums |
dafed0e19ff6a5579c9a751ac1526193f53351460a7060a6d43cb4a00c861883
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.6
|