[pytest-dev] pyi stubs (PEP 561/ PEP-484) for pytest

Florian Bruhin me at the-compiler.org
Wed Nov 14 01:01:01 EST 2018


Hey Ilya,

On Wed, Nov 14, 2018 at 01:19:25AM +0300, Ilya Kazakevich wrote:
> My name is Ilya, I develop pytest integration in PyCharm IDE.

Yay, thanks for that! \o/

> There is a PEP-484 that covers optional type hinting for Python an
> PEP-561 that describes how to distribute this information as separate
> package with .pyi files (also called stubs).
> 
> Type hinting is huge benefit for any static analysis tool. At this moment
> it is suported by mypy (http://mypy-lang.org/) and PyCharm.
> 
> My question is do you have any plans to create pyi stubs for pytest?
> .pyi will improve code insight / code completion in PyCharm and give
> users ability to validate their code with mypy.

There's an issue about it with some discussion here:
https://github.com/pytest-dev/pytest/issues/3342

> We can create this package by ourselves (physically we create
> pytest-subs package on pypi, see PEP-561) but at least we need
> approvement from pytest devs, and any contributions are welcome)
> 
> Creating pyi files is not hard, and they could be used by any PEP-561
> compatible project.

As usual for volunteer-driven projects, it's hard to find the time to do
things if nobody feels like picking it up ;-)

I think contributions would definitely be welcome, though it probably
needs some coordination with pytest's core, as some classes you'd
probably want to use in annotations aren't exposed publicly.

Another possibility, if JetBrains is open to that kind of thing, is
contracting a pytest core developer to work on type annotations
specificially via merlinux: https://merlinux.eu/

FWIW, as for me personally, I'm currently quite busy with study-related
work[1], so I'm not doing much pytest-related work at the moment.

Florian

[1] https://lists.schokokeks.org/pipermail/qutebrowser-announce/2018-September/000051.html

-- 
https://www.qutebrowser.org | me at the-compiler.org (Mail/XMPP)
   GPG: 916E B0C8 FD55 A072 | https://the-compiler.org/pubkey.asc
         I love long mails! | https://email.is-not-s.ms/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/pytest-dev/attachments/20181114/70d32388/attachment.sig>


More information about the pytest-dev mailing list