scverse_backends.Settings#
- class scverse_backends.Settings(registry)[source]#
Bases:
objectPer-host settings exposing
.backendand.use_backend().Each
BackendDispatcherowns one_Settingswith its ownContextVarso host libraries’ active backends are isolated.- Parameters:
- registry
_Registry
- registry
Methods
__init__(registry)Return canonical names of all discovered backends.
get_backend(name)Look up a backend by name or alias.
use_backend(backend)Temporarily set the backend within a context.
Attributes
The active backend name (default
'cpu').- property backend: str#
The active backend name (default
'cpu').Set to a registered backend name or alias (e.g.
'cuda'). Aliases are resolved to the canonical name on assignment.
- use_backend(backend)[source]#
Temporarily set the backend within a context.
Examples
>>> with settings.use_backend("cuda"): ... ...