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.
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
- A vision for extensibility to GPU & distributed support for SciPy, scikit-learn, scikit-image and beyond
- A proposed design for supporting multiple array types across SciPy, scikit-learn, scikit-image and beyond
- Support for array types other than NumPy
- Default dispatching behavior for supporting multiple array types across SciPy, scikit-learn, scikit-image
- Requirements and discussion of a type dispatcher for the ecosystem