Shortcuts

SPEC 2 โ€” API Dispatch

๐Ÿ›ˆ  Warning
This is a draft document.

Description

We propose mechanisms for:

(a) wholesale reimplementations of library functions, and (b) function dispatch based on foreign data structures.

This would allow groups outside of, say, scipy to (a) provide new functions to replace parts of SciPy, or (b) provide data structures that can pass through SciPy’s existing computational pipelines.

Concretely, (a) is akin to monkey-patching, but with the advantage that libraries can coordinate dispatching and report which backend is being used. And (b) is similar to using the Array API standard, so that pure-Python algorithm implementations can operate on foreign array types without rewriting code.

This SPEC focuses on the rationale for these mechanisms, and provides links to implementations related technical discussions.

Implementation

A full description of the implementation is being written up at https://github.com/scientific-python/api-dispatch. You can also view a rendered version of that documentation.

Core Project Endorsement

Ecosystem Adoption

Notes