openspace-api-python
Python library to interface with OpenSpace using TCP sockets.
Work in progress - Both the API and library are still under active development and are subject to change.
Install
Stable releases are published on PyPI. Install the latest version with:
pip install openspace-api
Quick start
import asyncio
import openspace as OpenSpace
api = OpenSpace.Api('localhost', 4681)
disconnect = asyncio.Event()
async def onConnect():
openspace = await api.library()
time = await openspace.time.UTC()
print(f"Current simulation time: {time}")
disconnect.set()
def onDisconnect():
disconnect.set()
api.onConnect(onConnect)
api.onDisconnect(onDisconnect)
async def main():
await api.connect()
await disconnect.wait()
asyncio.run(main())
Examples
Install the example dependencies first:
pip install -r example/requirements.txt
- example.py - Async script demonstrating get/set property, property subscriptions, event subscriptions, calling Lua library functions, and adding scene graph nodes. Run with:
python example/example.py
- example/sync-example.py - Shows how to wrap async API calls to make them synchronous, useful in interactive shells (Python REPL, IPython). Run with:
python example/sync-example.py
- example/notebook-examples.py - Self-contained async functions designed for Jupyter notebooks (
await functionName()) or scripts (asyncio.run(functionName())). Covers pausing simulation, navigating to geo coordinates, setting time, and adding globe layers.
Requirements
- Python 3.10+
- A running instance of OpenSpace
Metadata
Release files for openspace-api 0.9.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| openspace_api-0.9.1.tar.gz | 9.3 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| openspace_api-0.9.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 19.0 kB
Release files / openspace_api-0.9.1.tar.gz
| Download URL | openspace_api-0.9.1.tar.gz |
|---|---|
| Size | 9.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2c0e93c99878feb7e65e7bd10aafa546ad1d28a5935f92e4ecbf0f3bf69b380a
|
|
BLAKE2b-256 checksum How to use checksums |
19d9ccfc4ff0435c806b8fff17b71e51f4d8cdb1386713a669b29ddab80844b4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.0
|
Release files / openspace_api-0.9.1-py3-none-any.whl
| Download URL | openspace_api-0.9.1-py3-none-any.whl |
|---|---|
| Size | 9.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e3f187e527fac1fd7e430114e57f60e551a9f589b39e4d65f4f49e987b24397b
|
|
BLAKE2b-256 checksum How to use checksums |
8cbadef5cbb3646eefa093f4457a4c91f549611a9ab3aecd004878d3ee30f804
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.0
|
Security for openspace-api 0.9.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.