This repository was archived by the owner on Jun 10, 2020. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 31
Add basic scaffolding for distributing the package #4
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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: ... |
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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' | ||
}, | ||
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import numpy as np | ||
|
||
def foo(a: np.ndarray): pass | ||
|
||
foo(np.array(1)) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should add annotations
def __getattr__(name) -> Any: ...
to the module anddef __getattr__(self, name) -> Any: ...
tondarray
/dtype
to mark them as flexibly typed.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what you mean about adding it to the module. Is that supported in type stubs? It's certain not supported in normal python,
I think best to leave them absent anyway, so that adding tests forces us to define the missing fields, rather than things passing silently
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, OK, we can leave it out for now. It is indeed valid in stub files (only).