Skip to content

v0.13.0

Choose a tag to compare

@slinkydeveloper slinkydeveloper released this 09 Dec 18:28

New features πŸŽ‰

  • Use context manager together with service handlers:
@contextvar
@asynccontextmanager
async def my_resource_manager():
    yield "hello"


@greeter.handler(invocation_context_managers=[my_resource_manager])
async def greet_with_cm(ctx: Context, name: str) -> str:
    return my_resource_manager.value
  • Add msgspec support, works out of the box when adding restate_sdk[serde] dependency:
# models
class GreetingRequest(msgspec.Struct):
    name: str

class Greeting(msgspec.Struct):
    message: str

msgspec_greeter = Service("msgspec_greeter")

@msgspec_greeter.handler()
async def greet(ctx: Context, req: GreetingRequest) -> Greeting:
    return Greeting(message=f"Hello {req.name}!")
  • Add extension modules for Google ADK and OpenAI, more info soon!

What's Changed

  • Add current_context() extension point by @igalshilman in #148
  • Add context manager support by @igalshilman in #149
  • Rename to invocation_context_managers by @igalshilman in #150
  • Rethrow TerminalError/SdkBaseException accidentally wrapped by @igalshilman in #151
  • feat: add msgspec support by @v1gnesh in #154
  • Consolidate msgspec conditional imports into a single place by @igalshilman in #155
  • Use DefaultSerde instead of JsonSerde for promise() default parameter by @Gustavo-Hagenbeck in #157
  • Support union | None return types by @igalshilman in #158
  • Use HttpError for the typed ingress client by @igalshilman in #159
  • Replace traceback.print_exc() with logger.exception() for proper logging by @Gustavo-Hagenbeck in #160
  • Add an optional extension module for Google ADK integration by @igalshilman in #161
  • Add an optional ext module for openai by @igalshilman in #162

New Contributors

  • @v1gnesh made their first contribution in #154
  • @Gustavo-Hagenbeck made their first contribution in #157

Full Changelog: v0.12.0...v0.13.0