Skip to content

Repository files navigation

scverse-backends

pre-commit.ci status codecov Documentation Status

⚠️ Under active development. APIs may shift.

The default plugin and dispatch mechanism for scverse. Host libraries mark public functions with @backend_dispatch or replaceable classes with @backend_class. GPU, distributed, JAX, PyTorch, and other backends plug in through Python entry points and are discovered automatically.

Want to add a PyTorch backend, a JAX backend, your own custom one? You don't need a PR against the host. Ship a package that exposes a module or object with name, aliases, and host-named functions or classes, register it as an entry point, and users install it next to the host.

Install

pip install scverse-backends

At a glance

import example_host as eh

# One function call
eh.some_function(data, backend="accelerated")

# A complete backend-provided class
model = eh.SomeModel(data, backend="accelerated")

# A scoped default for functions and classes
with eh.settings.use_backend("accelerated"):
    eh.some_function(data)
    model = eh.SomeModel(data)

Status

  • Built from backend-dispatch prototypes in scverse host integrations.
  • Concrete backend aliases belong in host integrations, not in this infrastructure package.
  • Goal: host libraries depend on this package and stop re-rolling their own dispatch.

Docs

Full docs at scverse-backends.readthedocs.io.

About

The default plugin and dispatch mechanism for scverse. Host libraries mark public functions with @backend_dispatch or replaceable classes with @backend_class.

Resources

Code of conduct

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages