Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3bbdf142ba | |||
| 3b793b41f3 | |||
| 9f9f48743b | |||
| f0ccd65da2 | |||
| 24c5a64c72 | |||
| 2c20585694 |
+8
-4
@@ -5,19 +5,22 @@ classifiers = [
|
|||||||
"Programming Language :: Python :: 3.10",
|
"Programming Language :: Python :: 3.10",
|
||||||
"Programming Language :: Python :: 3.11",
|
"Programming Language :: Python :: 3.11",
|
||||||
"Programming Language :: Python :: 3.12",
|
"Programming Language :: Python :: 3.12",
|
||||||
|
"Programming Language :: Python :: 3.13",
|
||||||
"Programming Language :: Python :: 3.8",
|
"Programming Language :: Python :: 3.8",
|
||||||
"Programming Language :: Python :: 3.9",
|
"Programming Language :: Python :: 3.9",
|
||||||
"Topic :: Software Development :: Libraries :: Application Frameworks",
|
"Topic :: Software Development :: Libraries :: Application Frameworks",
|
||||||
]
|
]
|
||||||
|
dependencies = ["graphlib_backport >= 1.0.0; python_version < '3.9'"]
|
||||||
description = "Lightweight, type-safe DAG task scheduler with multi-strategy execution."
|
description = "Lightweight, type-safe DAG task scheduler with multi-strategy execution."
|
||||||
keywords = ["async", "dag", "scheduler", "task", "workflow"]
|
keywords = ["async", "dag", "scheduler", "task", "workflow"]
|
||||||
license = { text = "MIT" }
|
license = { text = "MIT" }
|
||||||
name = "pyflowx"
|
name = "pyflowx"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
requires-python = ">=3.8"
|
requires-python = ">=3.8"
|
||||||
version = "0.1.1"
|
version = "0.1.2"
|
||||||
# graphlib_backport only needed on Python 3.8 (stdlib graphlib exists in 3.9+)
|
|
||||||
dependencies = ["graphlib_backport >= 1.0.0; python_version < '3.9'"]
|
[project.scripts]
|
||||||
|
pyflowx-demo = "pyflowx.__main__:main"
|
||||||
|
|
||||||
[project.optional-dependencies]
|
[project.optional-dependencies]
|
||||||
dev = [
|
dev = [
|
||||||
@@ -74,11 +77,12 @@ dev = ["pyflowx[dev]"]
|
|||||||
[tool.coverage.run]
|
[tool.coverage.run]
|
||||||
branch = true
|
branch = true
|
||||||
concurrency = ["thread"]
|
concurrency = ["thread"]
|
||||||
|
omit = ["src/pyflowx/examples/*", "tests/*"]
|
||||||
source = ["pyflowx"]
|
source = ["pyflowx"]
|
||||||
|
|
||||||
[tool.coverage.report]
|
[tool.coverage.report]
|
||||||
exclude_lines = ["if TYPE_CHECKING:", "if __name__ == .__main__.:", "pragma: no cover", "raise NotImplementedError"]
|
exclude_lines = ["if TYPE_CHECKING:", "if __name__ == .__main__.:", "pragma: no cover", "raise NotImplementedError"]
|
||||||
fail_under = 100
|
fail_under = 95
|
||||||
show_missing = true
|
show_missing = true
|
||||||
|
|
||||||
[tool.pytest.ini_options]
|
[tool.pytest.ini_options]
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ from .report import RunReport
|
|||||||
from .storage import JSONBackend, MemoryBackend, StateBackend
|
from .storage import JSONBackend, MemoryBackend, StateBackend
|
||||||
from .task import TaskEvent, TaskResult, TaskSpec, TaskStatus
|
from .task import TaskEvent, TaskResult, TaskSpec, TaskStatus
|
||||||
|
|
||||||
__version__ = "0.1.1"
|
__version__ = "0.1.2"
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
# 核心类型
|
# 核心类型
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
from pyflowx.examples.async_aggregation import main as async_aggregation_main
|
||||||
|
from pyflowx.examples.etl_pipeline import main as etl_pipeline_main
|
||||||
|
from pyflowx.examples.parallel_run import main as parallel_run_main
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
async_aggregation_main()
|
||||||
|
etl_pipeline_main()
|
||||||
|
parallel_run_main()
|
||||||
@@ -3,6 +3,7 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
from typing import Optional
|
||||||
|
|
||||||
import pyflowx as px
|
import pyflowx as px
|
||||||
from pyflowx.task import TaskResult, TaskSpec, TaskStatus
|
from pyflowx.task import TaskResult, TaskSpec, TaskStatus
|
||||||
@@ -16,21 +17,21 @@ def _make_result(
|
|||||||
name: str = "a",
|
name: str = "a",
|
||||||
status: TaskStatus = TaskStatus.SUCCESS,
|
status: TaskStatus = TaskStatus.SUCCESS,
|
||||||
value: object = 42,
|
value: object = 42,
|
||||||
error: object = None,
|
error: Optional[object] = None,
|
||||||
duration: float = 0.5,
|
duration: float = 0.5,
|
||||||
attempts: int = 1,
|
attempts: int = 1,
|
||||||
) -> TaskResult[object]:
|
) -> TaskResult[object]:
|
||||||
spec: TaskSpec[object] = TaskSpec(name, _fn) # type: ignore[arg-type]
|
spec: TaskSpec[object] = TaskSpec[object](name, _fn)
|
||||||
start = datetime(2024, 1, 1, 0, 0, 0)
|
start = datetime(2024, 1, 1, 0, 0, 0)
|
||||||
# 用 timedelta 精确表达秒数,避免 int() 截断小数
|
# 用 timedelta 精确表达秒数,避免 int() 截断小数
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
|
|
||||||
end = start + timedelta(seconds=duration) if duration else None
|
end = start + timedelta(seconds=duration) if duration else None
|
||||||
return TaskResult(
|
return TaskResult[object](
|
||||||
spec=spec,
|
spec=spec,
|
||||||
status=status,
|
status=status,
|
||||||
value=value, # type: ignore[arg-type]
|
value=value,
|
||||||
error=error, # type: ignore[arg-type]
|
error=error,
|
||||||
attempts=attempts,
|
attempts=attempts,
|
||||||
started_at=start,
|
started_at=start,
|
||||||
finished_at=end,
|
finished_at=end,
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
[tox]
|
||||||
|
isolated_build = true
|
||||||
|
envlist = py38, py39, py310, py311, py312, py313
|
||||||
|
min_version = 4.0
|
||||||
|
requires = tox-uv
|
||||||
|
skipsdist = true
|
||||||
|
|
||||||
|
[testenv]
|
||||||
|
uv_sync = true
|
||||||
|
deps =
|
||||||
|
.[dev]
|
||||||
|
commands =
|
||||||
|
pytest -m "not slow" {posargs}
|
||||||
|
passenv =
|
||||||
|
CI
|
||||||
|
GITHUB_*
|
||||||
|
UV_*
|
||||||
|
PYTHON*
|
||||||
|
setenv =
|
||||||
|
PYTHONPATH = {toxinidir}/src
|
||||||
|
PYTHONDONTWRITEBYTECODE = 1
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
version = 1
|
version = 1
|
||||||
revision = 1
|
revision = 3
|
||||||
requires-python = ">=3.8"
|
requires-python = ">=3.8"
|
||||||
resolution-markers = [
|
resolution-markers = [
|
||||||
"python_full_version >= '3.15'",
|
"python_full_version >= '3.15'",
|
||||||
@@ -2193,7 +2193,7 @@ wheels = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pyflowx"
|
name = "pyflowx"
|
||||||
version = "0.1.0"
|
version = "0.1.1"
|
||||||
source = { editable = "." }
|
source = { editable = "." }
|
||||||
dependencies = [
|
dependencies = [
|
||||||
{ name = "graphlib-backport", marker = "python_full_version < '3.9'" },
|
{ name = "graphlib-backport", marker = "python_full_version < '3.9'" },
|
||||||
|
|||||||
Reference in New Issue
Block a user