-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to provide stubs to be used by global_annotations_decorator? #78
Comments
I never found time to deal with |
Problem with But the problem I hit was with file locations, not content. For example, I have a
So it seems there's a need for some reasonable logic for looking for stubs, something that could handle:
Probably the logic |
Interesting. Do you have an idea where this string comes from? Is a C-extension involved? Pytypes locates the stubfile based on the See these functions: Can you spot anything that causes |
It probably comes from $ python3
Python 3.6.8 (default, Jan 14 2019, 11:02:34)
[GCC 8.0.1 20180414 (experimental) [trunk revision 259383]] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import netifaces
>>> netifaces.__file__
'/usr/lib/python3/dist-packages/netifaces.cpython-36m-x86_64-linux-gnu.so' |
Okay, perfect. Then we need better code to clean the filename, right? |
Probably bn = os.path.basename(module.__file__).partition('.')[0] instead of |
I wonder why I used Otherwise I can add this fix. However, I am currently working on another step towards 3.7 support. I prefer not to mix up work between distinct issues in my local branch, so I would fix this only after committing my current bunch of work. This might take until end of next week. |
I wonder why use |
I remember there were issues with |
I wonder how C:\>python3
Python 3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:54:40) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import os.path
>>> os.path.__name__
'ntpath'
>>> os.path.__file__
'C:\\Python36\\lib\\ntpath.py' and on Ubuntu: $ python3
Python 3.6.8 (default, Jan 14 2019, 11:02:34)
[GCC 8.0.1 20180414 (experimental) [trunk revision 259383]] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import os.path
>>> os.path.__name__
'posixpath'
>>> os.path.__file__
'/usr/lib/python3.6/posixpath.py' In other words, it seems that the name used to import a module can be different from the name visible through |
Maybe in |
I committed the change you suggest in #78 (comment). Does it fix that particular aspect of this issue for you? |
Yep, thanks. |
For example, I have
typeshed
, a project containing stubs for Python standard library.And I'd like
pytypes
to check that my code calls standard library functions according to their annotations.How do I configure
pytypes
to use the annotations intypeshed
?Whatever I tried didn't work.
The text was updated successfully, but these errors were encountered: