from hyperscript import Hyperscript
from hyperscript.convergence import Convergence
from hyperscript.Shell import Shell
from hyperscript.File import File
echo "Hello, {name}!" > output.txt
for stdout in shell.execute():
return File("output.txt") # Return the output file
# Set up Convergence as our backend
convergence = Convergence(api_key=os.getenv("CONVERGENCE_API_KEY"))
# Initialize Hyperscript with Convergence's storage and event systems
storage=convergence.storage, events=convergence.events
task = await hs.run(fn=shell_script,
executor=convergence.executor
# Retrieve and print the result
async for file in task.files():
print(f"Got file: {file.name}")
# Hyperscript leverages asyncio, so we need to run our main function in an event loop
if __name__ == "__main__":