ParallelSSH / ssh2-python

Python bindings for libssh2 C library.
https://parallel-ssh.org
GNU Lesser General Public License v2.1
229 stars 73 forks source link

mypy type stubs #35

Closed mbarkhau closed 3 years ago

mbarkhau commented 6 years ago

Are there any .pyi files available already?

mbarkhau commented 6 years ago

I've generated some sub files using stubgen but they're pretty incomplete. Lots of typing.Any and no return types. Unless there is something better to start with I would continue to refine these.

pkittenis commented 6 years ago

What would mypy do for cython source code? There is no pure python code in this project to be typed.

mbarkhau commented 6 years ago

It doesn't do anything for cython source code. It does something for the code that uses the cython source code. For example, stubs would allow mypy and pycharm to see that there is a Session class in the ssh2.session module, which has a handshake function, which expects an instance of socket.socket as a parameter.

pkittenis commented 6 years ago

I see, so for static code analysis of python code using the module. IMO the usefulness of that is pretty niche - Python 3.5+ with IDE or other tools that do static type checking - but useful none the less.

A PR is welcome as long as maintenance can also be provided moving forward. I personally have no interest or bandwidth for maintaining these interface files for future changes/additions.

mbarkhau commented 6 years ago

Perhaps there is a way to generate them from the .pyx or pxd files, I'll look into it. If that doesn't work I'll just link the stub files I'm using in case anybody finds this on google.

pkittenis commented 6 years ago

Sounds good, thanks for considering to contribute.

dset0x commented 5 years ago

I have created https://github.com/dset0x/ssh2-stubs

For now, I have only gone through exceptions, channel and session. From these, I have only actually tested the most common functions with mypy.

Everything else needs to be worked on and I hope to resume work on it soon.

If you want to send patches, all you need is:

pkittenis commented 3 years ago

Looks like no interest to complete this from anyone - closing.