Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
phi-friday committed Feb 29, 2024
2 parents c41cbb6 + 1daacfa commit 31e0df6
Show file tree
Hide file tree
Showing 40 changed files with 598 additions and 2,611 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
42 changes: 13 additions & 29 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,44 +16,24 @@ classifiers = [
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: Implementation :: CPython",
"Framework :: AnyIO",
"Framework :: AsyncIO",
"Framework :: Trio",
]
requires-python = ">= 3.8"
dependencies = [
"anyio>=4.3.0",
"typing-extensions>=4.10.0",
"cloudpickle>=3.0.0",
"async-wrapper>=0.8.3",
"tblib>=3.0.0",
]

[project.urls]
Repository = "https://github.com/phi-friday/timeout-executor"

[project.optional-dependencies]
all = [
"billiard>=4.2.0",
"cloudpickle>=3.0.0",
"dill>=0.3.8",
"loky>=3.4.1",
"psutil>=5.9.8",
]
billiard = [
"billiard>=4.2.0",
"dill>=0.3.8",
]
loky = [
"cloudpickle>=3.0.0",
"loky>=3.4.1",
"psutil>=5.9.8",
]
dill = [
"dill>=0.3.8",
]
cloudpickle = [
"cloudpickle>=3.0.0",
]


[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
uvloop = ["uvloop>=0.19.0; platform_system != 'Windows'"]

[tool.rye]
managed = true
Expand All @@ -62,10 +42,14 @@ dev-dependencies = [
"ipykernel>=6.29.3",
"pre-commit>=3.5.0",
"pytest>=8.0.2",
"pytest-asyncio>=0.23.5",
"pyyaml>=6.0.1",
"trio>=0.24.0",
]

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.hatch.metadata]
allow-direct-references = true

Expand Down Expand Up @@ -182,4 +166,4 @@ split-on-trailing-comma = false
include = ["src", "tests"]
pythonVersion = '3.8'
pythonPlatform = 'Linux'
diagnostic = 'basic'
diagnostic = 'basic'
5 changes: 3 additions & 2 deletions src/timeout_executor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

from typing import Any

from .executor import TimeoutExecutor, get_executor
from timeout_executor.executor import TimeoutExecutor, apply_func, delay_func
from timeout_executor.result import AsyncResult

__all__ = ["TimeoutExecutor", "get_executor"]
__all__ = ["TimeoutExecutor", "AsyncResult", "apply_func", "delay_func"]

__version__: str

Expand Down
6 changes: 0 additions & 6 deletions src/timeout_executor/concurrent/__init__.py

This file was deleted.

Empty file.
Empty file.

This file was deleted.

Loading

0 comments on commit 31e0df6

Please sign in to comment.