Skip to main content

Python bindings for HoloScript — the universal spatial programming language for VR, AR, robotics, and digital twins

Project description

HoloScript Python Bindings

Python bindings for HoloScript - parse, validate, and generate HoloScript code from Python.

Installation

pip install holoscript

Quick Start

from holoscript import HoloScript

# Initialize
hs = HoloScript()

# Parse HoloScript code
ast = hs.parse("""
composition "My Scene" {
  object "Crystal" @grabbable @glowing {
    geometry: "sphere"
    color: "#00ffff"
  }
}
""")

# Validate code
result = hs.validate(ast)
if result.valid:
    print("✅ Valid HoloScript!")
else:
    for error in result.errors:
        print(f"❌ Line {error.line}: {error.message}")

# Generate from natural language
scene = hs.generate("a floating island with glowing crystals")
print(scene.code)

# Create shareable link
share = hs.share(scene.code, title="My VR Scene", platform="x")
print(f"Playground: {share.playground_url}")
print(f"Tweet: {share.tweet_text}")

Features

  • Parsing: Parse .hs, .hsplus, and .holo files
  • Validation: Validate syntax with AI-friendly error messages
  • Generation: Generate HoloScript from natural language
  • Rendering: Generate preview images/GIFs
  • Sharing: Create X-optimized shareable links

For AI Agents (Grok, etc.)

# Grok integration example
from holoscript import HoloScript

hs = HoloScript(api_key="your-api-key")  # Optional for remote rendering

# Generate scene from user prompt
user_prompt = "Create a VR scene with a floating castle"
scene = hs.generate(user_prompt)

# Validate
if hs.validate(scene.code).valid:
    # Create shareable preview
    preview = hs.render(scene.code, format="gif", duration=3000)
    share = hs.share(scene.code, title="Floating Castle", platform="x")

    # Return to user
    print(f"Here's your VR scene: {share.playground_url}")
    print(f"Preview: {preview.url}")

API Reference

See full documentation for complete API reference.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

holoscript-5.1.0.tar.gz (30.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

holoscript-5.1.0-py3-none-any.whl (23.2 kB view details)

Uploaded Python 3

File details

Details for the file holoscript-5.1.0.tar.gz.

File metadata

  • Download URL: holoscript-5.1.0.tar.gz
  • Upload date:
  • Size: 30.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for holoscript-5.1.0.tar.gz
Algorithm Hash digest
SHA256 fff084cead1881dc7bbbbbcc156f11a51b4669063eaf8c132e00fb6fcccfb6e3
MD5 dcc637ac4cf044abfd928df2ea6f045f
BLAKE2b-256 51a035607e0f6de0d931d1e4cb14698ebce19987c67594d5c866f100cb8f9fe1

See more details on using hashes here.

File details

Details for the file holoscript-5.1.0-py3-none-any.whl.

File metadata

  • Download URL: holoscript-5.1.0-py3-none-any.whl
  • Upload date:
  • Size: 23.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for holoscript-5.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 547a61aecef734a1d182d4d8000eab42750a36c10fd66415c9a92d55e6347c20
MD5 d71e31de10bc24fe5141a011e0e4f29a
BLAKE2b-256 dd2f8e87b4c5359e37051674b4770b3d2766c82d5f28a92cea97a790e16aebd3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page