uarray.py 773 B

12345678910111213141516171819202122232425262728293031
  1. """`uarray` provides functions for generating multimethods that dispatch to
  2. multiple different backends
  3. This should be imported, rather than `_uarray` so that an installed version could
  4. be used instead, if available. This means that users can call
  5. `uarray.set_backend` directly instead of going through SciPy.
  6. """
  7. # Prefer an installed version of uarray, if available
  8. try:
  9. import uarray as _uarray
  10. except ImportError:
  11. _has_uarray = False
  12. else:
  13. from scipy._lib._pep440 import Version as _Version
  14. _has_uarray = _Version(_uarray.__version__) >= _Version("0.8")
  15. del _uarray
  16. del _Version
  17. if _has_uarray:
  18. from uarray import *
  19. from uarray import _Function
  20. else:
  21. from ._uarray import *
  22. from ._uarray import _Function
  23. del _has_uarray