Taskflow is a Python 3.10+ library for structured state management, task orchestration, and error handling in complex asynchronous workflows. It enables defining tasks and flows using decorators or classes, facilitating robust and scalable application development. The current version is 6.2.0, with an active development cadence that includes significant API changes in major releases.
pip install taskflowVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates defining and executing a simple asynchronous task and flow using Taskflow's decorator API. It showcases the basic structure for creating a workflow and running it with asyncio.
Update task and flow decorators/constructors to use `inputs` and `outputs` parameters as dictionaries, mapping argument names to types.
Remove references to the deprecated executors. If non-asyncio concurrency is needed, consider integrating external solutions or implement a custom executor that wraps `AsyncIOExecutor`.
When instantiating `Flow` or `Task` classes, pass a `config` object (e.g., `Flow(config=FlowConfig(max_concurrency=5))`). For decorators, use `flow(config=FlowConfig(...))`.
Migrate custom flow and task implementations to directly inherit from `taskflow.Flow` and `taskflow.Task` respectively.
Ensure all type annotations in task and flow definitions are accurate and consistent with the data types being passed and returned. Validate data types at runtime if external inputs are untrusted.
Declare inputs using the `inputs` dictionary parameter: `@task(inputs={'my_input': str})`.The `LocalThreadPoolExecutor` and `ProcessThreadPoolExecutor` were removed. Use the `AsyncIOExecutor` (default) or implement a custom one. For general config, pass a `FlowConfig` instance.
Install the library using pip: `pip install taskflow`. Ensure your virtual environment is activated if you are using one.
Pass configuration parameters via a `FlowConfig` object: `my_flow = Flow(config=FlowConfig(max_concurrency=5))`.
No dependency data recorded yet.