From 1daacfa097b13fce67f68f3a23b2dd503ebbbb86 Mon Sep 17 00:00:00 2001 From: phi Date: Thu, 29 Feb 2024 19:14:25 +0900 Subject: [PATCH] doc: update readme --- README.md | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 3eb6467..710b10a 100644 --- a/README.md +++ b/README.md @@ -9,22 +9,16 @@ ```shell $ pip install timeout_executor # or -$ pip install "timeout_executor[all]" -# or -$ pip install "timeout_executor[billiard]" -# or -$ pip install "timeout_executor[loky]" -# or -$ pip install "timeout_executor[dill]" -# or -$ pip install "timeout_executor[cloudpickle]" +$ pip install "timeout_executor[uvloop]" ``` ## how to use ```python +from __future__ import annotations + import time -from timeout_executor import TimeoutExecutor +from timeout_executor import AsyncResult, TimeoutExecutor def sample_func() -> None: @@ -37,9 +31,11 @@ try: except Exception as exc: assert isinstance(exc, TimeoutError) -executor = TimeoutExecutor(1, pickler="dill") # or cloudpickle +executor = TimeoutExecutor(1) result = executor.apply(lambda: "done") -assert result == "done" +assert isinstance(result, AsyncResult) +value = result.result() +assert value == "done" ``` ## License