[PyQt] Help with PEP 484 Type Hint Stub Files

Phil Thompson phil at riverbankcomputing.com
Fri Feb 5 17:05:40 GMT 2016


On 30 Jan 2016, at 6:39 pm, Damon Lynch <damonlynch at gmail.com> wrote:
> 
> 
> On Sat, Jan 30, 2016 at 10:59 PM, Phil Thompson <phil at riverbankcomputing.com> wrote:
> 
> However, I'm having trouble testing all this. Can anybody recommend a tool that has reasonable support for PEP 484 stub files? PyCharm? pytype? mypy?
> 
> 
> Hi Phil,
> 
> That's wonderful news! Personally I find the type annotations to be very useful indeed. 
> 
> For your testing, PyCharm might be just the ticket: http://blog.jetbrains.com/pycharm/2015/11/python-3-5-type-hinting-in-pycharm-5/#stub-files
> 
> I've not tested PyCharm with stub files myself, but with respect to in-script type annotating, PyCharm is off to a pretty good start. For instance it handles this:
> 
> self.devices = {}  # type: Dict[int, Device]
> 
> but not this, where multiple types are specified:
> 
> device, storage_space = index.data(Roles.storage)  # type: Device, StorageSpace

Would you be able to test it if I sent you some stub files?

Phil


More information about the PyQt mailing list