Commits

Armin Rigo committed 65001a8

Add a module 'numpy' which raises an ImportError giving a detailed
explanation. Tweak 'numpypy' to replace 'numpy' when imported.

Comments (0)

Files changed (3)

lib_pypy/numpy.py

+raise ImportError(
+    "The 'numpy' module of PyPy is in-development and not complete. "
+    "To try it out anyway, you can either import from 'numpypy', "
+    "or just write 'import numpypy' first in your program and then "
+    "import from 'numpy' as usual.")

lib_pypy/numpypy/__init__.py

 from _numpypy import *
 from .core import *
+
+import sys
+sys.modules.setdefault('numpy', sys.modules['numpypy'])

pypy/module/test_lib_pypy/numpypy/test_numpy.py

+from pypy.conftest import gettestobjspace
+
+class AppTestNumpy:
+    def setup_class(cls):
+        cls.space = gettestobjspace(usemodules=['micronumpy'])
+
+    def test_imports(self):
+        try:
+            import numpy   # fails if 'numpypy' was not imported so far
+        except ImportError:
+            pass
+        import numpypy
+        import numpy     # works after 'numpypy' has been imported