SPEC 2 — API Dispatch


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.


On this page