Skip to content

Hello World

Here’s a simple “Hello, World!” example using Hyperscript with the Convergence backend. This and all other examples assume you have already set up your Convergence API key as an environment variable named CONVERGENCE_API_KEY.

from hyperscript import Hyperscript
from hyperscript.convergence import Convergence
import os
# Define the function we want run in the cloud
def hello_world():
return "Hello, World!"
async def main():
# Set up Convergence as our backend
convergence = Convergence(api_key=os.getenv("CONVERGENCE_API_KEY"))
# Initialize Hyperscript with Convergence's storage and event systems
async with Hyperscript(
storage=convergence.storage, events=convergence.events
) as hs:
# Run the hello_world function in the cloud
task = await hs.run(fn=hello_world, args=[], executor=convergence.executor)
# Retrieve and print the result
async for result in task.results():
print(f"Got result: {result}")
# Hyperscript leverages asyncio, so we need to run our main function in an event loop
if __name__ == "__main__":
import asyncio
asyncio.run(main())