{"library":"nexus-rpc","code":"from dataclasses import dataclass\nimport nexusrpc\n\n@dataclass\nclass MyInput:\n    name: str\n\n@dataclass\nclass MyOutput:\n    message: str\n\n@nexusrpc.service\nclass MyNexusService:\n    my_sync_operation: nexusrpc.Operation[MyInput, MyOutput]\n\n@nexusrpc.handler.service_handler(service=MyNexusService)\nclass MyNexusServiceHandler:\n    @nexusrpc.handler.sync_operation\n    async def my_sync_operation(\n        self, ctx: nexusrpc.handler.StartOperationContext, input: MyInput\n    ) -> MyOutput:\n        return MyOutput(message=f\"Hello {input.name}!\")\n\n# In a real application, you would instantiate MyNexusServiceHandler\n# and integrate it with your server/worker to process Nexus requests.\n# For example:\n# handler_instance = MyNexusServiceHandler()","lang":"python","description":"This quickstart demonstrates how to define a Nexus service and implement a synchronous operation handler. It uses dataclasses for input and output types, decorates a class as a Nexus service, and then implements a service handler with a decorated synchronous operation.","tag":null,"tag_description":null,"last_tested":"2026-04-24","results":[{"runtime":"python:3.10-alpine","exit_code":0},{"runtime":"python:3.10-slim","exit_code":0},{"runtime":"python:3.11-alpine","exit_code":0},{"runtime":"python:3.11-slim","exit_code":0},{"runtime":"python:3.12-alpine","exit_code":0},{"runtime":"python:3.12-slim","exit_code":0},{"runtime":"python:3.13-alpine","exit_code":0},{"runtime":"python:3.13-slim","exit_code":0},{"runtime":"python:3.9-alpine","exit_code":0},{"runtime":"python:3.9-slim","exit_code":0}]}