diff --git a/numpy/__init__.pyi b/numpy/__init__.pyi new file mode 100644 index 0000000..998897e --- /dev/null +++ b/numpy/__init__.pyi @@ -0,0 +1,12 @@ +# very simple, just enough to start running tests + +class ndarray: pass + +class dtype: pass + +def array( + object : object, + dtype : dtype = ..., + copy : bool = ..., + subok : bool = ..., + ndmin : int = ...) -> ndarray: ... diff --git a/numpy/py.typed b/numpy/py.typed new file mode 100644 index 0000000..e69de29 diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..d3ce124 --- /dev/null +++ b/setup.py @@ -0,0 +1,18 @@ +from setuptools import setup, find_packages + +setup( + name='numpy_stubs', + maintainer="NumPy Developers", + maintainer_email="numpy-discussion@python.org", + description="PEP 561 type stubs for numpy", + url="http://www.numpy.org", + license='BSD', + version="0.0.1", + packages=find_packages(), + + # PEP 561 requires these + install_requires=['numpy~=1.13.0'], + package_data={ + 'numpy': 'py.typed' + }, +) diff --git a/tests/README.md b/tests/README.md new file mode 100644 index 0000000..0067c9a --- /dev/null +++ b/tests/README.md @@ -0,0 +1,9 @@ +Testing +======= + +To run these tests: + + export MYPYPATH='..' + mypy test_simple.py + +In future, this should change to use the test framework used by mypy. diff --git a/tests/test_simple.py b/tests/test_simple.py new file mode 100644 index 0000000..53026e6 --- /dev/null +++ b/tests/test_simple.py @@ -0,0 +1,5 @@ +import numpy as np + +def foo(a : np.ndarray): pass + +foo(np.array(1))