diff options
author | Thomas Viehmann <tv@beamnet.de> | 2019-01-29 11:19:51 -0800 |
---|---|---|
committer | Facebook Github Bot <facebook-github-bot@users.noreply.github.com> | 2019-01-29 12:14:17 -0800 |
commit | 6a6983ed7f14f8335a5b5614928713cb79658281 (patch) | |
tree | dd24a3d02312c12a62db4dd14dcb59efc077d244 /setup.py | |
parent | 3b337e7892a7b54758f273477aa092053f02b410 (diff) | |
download | pytorch-6a6983ed7f14f8335a5b5614928713cb79658281.tar.gz pytorch-6a6983ed7f14f8335a5b5614928713cb79658281.tar.bz2 pytorch-6a6983ed7f14f8335a5b5614928713cb79658281.zip |
create type hint stub files for module torch (#12500)
Summary:
We have:
- This is an initial stab at creating a type stub `torch/__init__.pyi` .
- This is only tested on Python 3, since that's the only Python version mypy
works on.
- So far, we only aim at doing this for torch functions and torch.Tensor.
- Quite a few methods and functions have to be typed manually. These are
done in `torch/__init__.pyi.in`
For me, PyCharm (the non-paid one) didn't seem to indicate errors in the .pyi when opening and seemed to be able to get the type hint for the few functions I tried, but I don't use PyCharm for my usual PyTorch activities, so I didn't extensively try this out.
An example of a generated PYI is at [this gist](https://gist.github.com/ezyang/bf9b6a5fa8827c52152858169bcb61b1).
Pull Request resolved: https://github.com/pytorch/pytorch/pull/12500
Differential Revision: D13695553
Pulled By: ezyang
fbshipit-source-id: 4566c71913ede4e4c23ebc4a72c17151f94e8e21
Diffstat (limited to 'setup.py')
-rw-r--r-- | setup.py | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -731,6 +731,7 @@ if __name__ == '__main__': entry_points=entry_points, package_data={ 'torch': [ + '__init__.pyi', 'lib/*.so*', 'lib/*.dylib*', 'lib/*.dll', |