Skip to content

Commit

Permalink
doc: update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
phi-friday committed Feb 29, 2024
1 parent 2122925 commit 1daacfa
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down

0 comments on commit 1daacfa

Please sign in to comment.