Skip to content

Releases: restatedev/sdk-python

v0.14.2

Choose a tag to compare

@slinkydeveloper slinkydeveloper released this 15 Jan 15:49

What's Changed

Full Changelog: v0.14.0...v0.14.2

v0.14.0

Choose a tag to compare

@slinkydeveloper slinkydeveloper released this 08 Jan 11:08

What's Changed

New Contributors

Full Changelog: v0.13.2...v0.14.0

v0.13.2

Choose a tag to compare

@slinkydeveloper slinkydeveloper released this 17 Dec 15:42

What's Changed

Full Changelog: v0.13.1...v0.13.2

v0.13.1

Choose a tag to compare

@slinkydeveloper slinkydeveloper released this 11 Dec 13:51

What's Changed

New Contributors

Full Changelog: v0.13.0...v0.13.1

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

v0.12.0

Choose a tag to compare

@slinkydeveloper slinkydeveloper released this 18 Nov 17:12

New features 🎉

  • Added ingress client to send requests from your python applications to restate services:
async with restate.create_client("http://localhost:8080") as client:
  await client.object_call(increment, key="a", arg=5)
  await client.object_send(increment, key="a", arg=5)

  current_count = await client.object_call(count, key="a", arg=None)
  • Added new test harness constructor to be used in combination with @pytest.fixture:
# Your fixture
@pytest.fixture(scope="session")
async def restate_test_harness():
  app = restate.app([greeter])
  async with restate.create_test_harness(app) as harness:
        yield harness
        
# A test example, using the client
async def test_greeter(restate_test_harness: HarnessEnvironment):
    greeting = await restate_test_harness.client.service_call(greet, arg="Pippo")
    assert greeting == "Hello Pippo!"
  • Various type hints improvements, such as #112

What's Changed

Full Changelog: v0.11.0...v0.12.0

v0.11.0

Choose a tag to compare

@slinkydeveloper slinkydeveloper released this 21 Oct 16:18

New features

  • You can configure more retry options for ctx.run_typed:
ctx.run_typed("payment", payment, RunOptions(
    # Initial retry interval
    initial_retry_interval=timedelta(milliseconds=100),
    # Retry policies are exponential, the retry interval will double on each attempt
    retry_interval_factor=2.0,
    # Maximum retry interval
    max_retry_interval=timedelta(seconds=10),
    # Max duration of retries before giving up
    max_duration=timedelta(minutes=5),
    # Max attempts (including the initial) before giving up
    max_attempts=10,
))
  • You can now provide a name to sleep, you'll be able to see this name in the UI.

Notable changes

  • When suspending, the SDK will now throw an asyncio.CancelledError, instead of the previously thrown custom error. Catch this exception only if you need to cleanup some external resources between execution attempts.

What's Changed

Full Changelog: v0.10.1...v0.11.0

v0.10.2

Choose a tag to compare

@slinkydeveloper slinkydeveloper released this 22 Sep 17:38

Removed typing_extensions dependency.

Full Changelog: v0.10.1...v0.10.2

v0.10.1

Choose a tag to compare

@slinkydeveloper slinkydeveloper released this 22 Sep 11:32

What's Changed

Full Changelog: v0.10.0...v0.10.1

v0.10.0

Choose a tag to compare

@slinkydeveloper slinkydeveloper released this 16 Sep 13:01

Invocation retry policy

When used with Restate 1.5, you can now configure the invocation retry policy from the SDK directly. See https://github.com/restatedev/restate/releases/tag/v1.5.0 for more details on the new invocation retry policy configuration.

What's Changed

Full Changelog: v0.9.1...v0.10.0