Support MyPy
See original GitHub issueWhen I import a module I get a MyPy error from this library, e.g.
Cannot find module named google.ads.google_ads.client
Possible solutions:
- Add typing to the client library
- Generate MyPy stub files
Can these be autogenerated easily? I’d be happy to help set this up if not.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:17 (2 by maintainers)
Top Results From Across the Web
mypy 0.991 documentation
Mypy has a powerful and easy-to-use type system, supporting features such as type inference, generics, callable types, tuple types, union types, structural ...
Read more >mypy - Optional Static Typing for Python
Mypy is an optional static type checker for Python. ... The aim is to support almost all Python language constructs in mypy.
Read more >Mypy: Static Typing for Python - GitHub
Mypy is a static type checker for Python. Type checkers help ensure that you're using variables and functions in your code correctly. With...
Read more >Type Checking With Mypy - Real Python
In this lesson, you'll explore how to use Mypy to do type checking on your Python code. Mypy is the most common tool...
Read more >Mypy Documentation - Read the Docs
Mypy is a static type checker for Python. Type checkers help ensure that you're using variables and functions in your code correctly.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Well, since I didn’t get a reply I just went ahead and published a stub package: https://pypi.org/project/google-ads-stubs/
Sadly inference from
get_type
andget_service
isn’t working (read the caveats section). It still gives you autocomplete and type checking if you explicitly state the types though. It should also fix the problem with imports that was the original reason for this issue.Since a lot of things in this repository are generated from protocol buffers, this is pretty closely related to https://github.com/protocolbuffers/protobuf/issues/2638. There’s actually a tip there about https://github.com/dropbox/mypy-protobuf, which allows you to create type stubs from the protobuf definitions.
This will actually be possible in Python 3.8 using literal types. https://www.python.org/dev/peps/pep-0586/