pyopenxr

July 29, 2025 ยท View on GitHub

Unofficial Python bindings for the OpenXR SDK to access VR and AR devices

pyopenxr is a Python developer SDK for device tracking and rapid virtual reality prototyping using the headset-agnostic OpenXR API. It provides a clean, Pythonic interface to the OpenXR runtime, enabling cross-platform AR/VR development with minimal boilerplate.

Build Status Pages Doc Status Documentation License

hello_xr1


๐Ÿš€ Installation

pip install pyopenxr

๐Ÿงช Quick Start

import xr

# Query the available VR/AR extensions
available = xr.enumerate_instance_extension_properties()

# Replace with whatever extensions are required for your application...
required = [xr.KHR_OPENGL_ENABLE_EXTENSION_NAME]
for prop in required:
    assert prop in available

Explore the complete working example hello_xr.py for a hands-on introduction.

Pythonic naming conventions

symbolPython exampleC example
functionxr.create_instance(...)xrCreateInstance(...)
constantxr.MAX_SYSTEM_NAME_SIZEXR_MAX_SYSTEM_NAME_SIZE
struct namexr.ExtensionPropertiesXrExtensionProperties
type aliasxr.VersionXrVersion
enum typexr.FormFactorxrFormFactor
enum valuexr.FormFactor.HEAD_MOUNTED_DISPLAYXR_FORM_FACTOR_HEAD_MOUNTED_DISPLAY
handlexr.InstanceXrInstance

๐Ÿ“š Documentation

Full API reference and guides are available

๐Ÿ“ฆ License

This project is licensed under the Apache License 2.0.

Copyright ยฉ 2021 Christopher Bruns.