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.11",
|
||||
"Programming Language :: Python :: 3.12",
|
||||
"Programming Language :: Python :: 3.13",
|
||||
"Programming Language :: Python :: 3.8",
|
||||
"Programming Language :: Python :: 3.9",
|
||||
"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."
|
||||
keywords = ["async", "dag", "scheduler", "task", "workflow"]
|
||||
license = { text = "MIT" }
|
||||
name = "pyflowx"
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.8"
|
||||
version = "0.1.1"
|
||||
# graphlib_backport only needed on Python 3.8 (stdlib graphlib exists in 3.9+)
|
||||
dependencies = ["graphlib_backport >= 1.0.0; python_version < '3.9'"]
|
||||
version = "0.1.2"
|
||||
|
||||
[project.scripts]
|
||||
pyflowx-demo = "pyflowx.__main__:main"
|
||||
|
||||
[project.optional-dependencies]
|
||||
dev = [
|
||||
@@ -74,11 +77,12 @@ dev = ["pyflowx[dev]"]
|
||||
[tool.coverage.run]
|
||||
branch = true
|
||||
concurrency = ["thread"]
|
||||
omit = ["src/pyflowx/examples/*", "tests/*"]
|
||||
source = ["pyflowx"]
|
||||
|
||||
[tool.coverage.report]
|
||||
exclude_lines = ["if TYPE_CHECKING:", "if __name__ == .__main__.:", "pragma: no cover", "raise NotImplementedError"]
|
||||
fail_under = 100
|
||||
fail_under = 95
|
||||
show_missing = true
|
||||
|
||||
[tool.pytest.ini_options]
|
||||
|
||||
@@ -43,7 +43,7 @@ from .report import RunReport
|
||||
from .storage import JSONBackend, MemoryBackend, StateBackend
|
||||
from .task import TaskEvent, TaskResult, TaskSpec, TaskStatus
|
||||
|
||||
__version__ = "0.1.1"
|
||||
__version__ = "0.1.2"
|
||||
|
||||
__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 datetime import datetime
|
||||
from typing import Optional
|
||||
|
||||
import pyflowx as px
|
||||
from pyflowx.task import TaskResult, TaskSpec, TaskStatus
|
||||
@@ -16,21 +17,21 @@ def _make_result(
|
||||
name: str = "a",
|
||||
status: TaskStatus = TaskStatus.SUCCESS,
|
||||
value: object = 42,
|
||||
error: object = None,
|
||||
error: Optional[object] = None,
|
||||
duration: float = 0.5,
|
||||
attempts: int = 1,
|
||||
) -> 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)
|
||||
# 用 timedelta 精确表达秒数,避免 int() 截断小数
|
||||
from datetime import timedelta
|
||||
|
||||
end = start + timedelta(seconds=duration) if duration else None
|
||||
return TaskResult(
|
||||
return TaskResult[object](
|
||||
spec=spec,
|
||||
status=status,
|
||||
value=value, # type: ignore[arg-type]
|
||||
error=error, # type: ignore[arg-type]
|
||||
value=value,
|
||||
error=error,
|
||||
attempts=attempts,
|
||||
started_at=start,
|
||||
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
|
||||
revision = 1
|
||||
revision = 3
|
||||
requires-python = ">=3.8"
|
||||
resolution-markers = [
|
||||
"python_full_version >= '3.15'",
|
||||
@@ -2193,7 +2193,7 @@ wheels = [
|
||||
|
||||
[[package]]
|
||||
name = "pyflowx"
|
||||
version = "0.1.0"
|
||||
version = "0.1.1"
|
||||
source = { editable = "." }
|
||||
dependencies = [
|
||||
{ name = "graphlib-backport", marker = "python_full_version < '3.9'" },
|
||||
|
||||
Reference in New Issue
Block a user