Skip to content

textual.work

A decorator used to create workers.

Parameters:

Name Type Description Default

method

Callable[FactoryParamSpec, ReturnType] | Callable[FactoryParamSpec, Coroutine[None, None, ReturnType]] | None

A function or coroutine.

None

name

str

A short string to identify the worker (in logs and debugging).

''

group

str

A short string to identify a group of workers.

'default'

exit_on_error

bool

Exit the app if the worker raises an error. Set to False to suppress exceptions.

True

exclusive

bool

Cancel all workers in the same group.

False

description

str | None

Readable description of the worker for debugging purposes. By default, it uses a string representation of the decorated method and its arguments.

None

thread

bool

Mark the method as a thread worker.

False