Repository navigation
Conversation
Annotates ParallelSSHClient (native and ssh), BaseParallelSSHClient, HostOutput and HostConfig, and ships a py.typed marker so type checkers use the hints. First step for ParallelSSH#370.
Codecov Reportβ
All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #433 +/- ##
==========================================
- Coverage 99.47% 99.36% -0.12%
==========================================
Files 18 18
Lines 1708 1720 +12
==========================================
+ Hits 1699 1709 +10
- Misses 9 11 +2 β View full report in Codecov by Harness. π New features to boost your workflow:
|
|
On the two red Codecov checks: the lines it reports as uncovered are the |
First step for #370.
This adds type hints to the parts of the API most users touch, and ships a
py.typedmarker (PEP 561) so mypy and other type checkers pick them up:pssh.clients.ParallelSSHClient(native) andpssh.clients.ssh.ParallelSSHClient:__init__,run_command,copy_file,copy_remote_file,scp_send,scp_recvBaseParallelSSHClient:hosts,open_shell,run_shell_commands,join_shells,get_last_output,connect_auth,join,finished,copy_fileHostOutput(includingstdout,stderr,exit_code),HostOutputBuffers,BufferData,HostConfigNotes:
from __future__ import annotationsandtyping.Optional/Listetc., so it stays compatible with Python 3.8. No runtime behaviour changes.py.typedis added topackage_dataandMANIFEST.in; I checked it ends up in the built wheel.run_command/ nativecopy_remote_filetake an extrasudo/encodingargument compared to the base class, which mypy reports as an incompatible override. I left those signatures alone and added# type: ignore[override]on the three subclass methods, and left the baserun_command/copy_remote_fileunannotated.return NoneinHostOutputproperties,HostOutput.stdout/stderralso returnNonewhen there are no buffers,{fully_qualified_command!r}in__repr__(same output for bytes), and afinishedstub onBaseSSHClientnext toget_exit_status.mypyis clean on the changed modules, flake8 is clean, unit tests pass, and the libssh2/libssh parallel integration tests give the same results as master in my environment. A quick downstream check now catches e.g.client.run_command(123)andexit_codebeingOptional[int].If this direction looks good, I can follow up with the single clients (
SSHClient) and the remaining modules.