andrewschenck / paramiko-jump

Enables MFA/2FA and SSH proxying on top of Paramiko SSH.
Other
32 stars 9 forks source link

Inherited Import Causing Typing and Validation Errors #17

Closed prokopto-dev closed 4 months ago

prokopto-dev commented 4 months ago

Hey all;

Just a small nit-pick, but when using packages like mypy, pylance, and pyright, the SSH_PORT variable grabbed from paramiko.client throws an error.

Line in question is here:

from paramiko.client import SSH_PORT, SSHClient

The resolution is basically just to throw in another import line from the original source within paramiko.config:

from paramiko.client import SSHClient
from paramiko.config import SSH_PORT

Will attach a PR to this for the resolution.

andrewschenck commented 4 months ago

Gotcha. Makes sense, though I never encountered that myself. I merged your PR. Andrew On May 17, 2024, at 13:17, Courtney Caldwell @.***> wrote: Hey all; Just a small nit-pick, but when using packages like mypy, pylance, and pyright, the SSH_PORT variable grabbed from paramiko.client throws an error. Line in question is here: from paramiko.client import SSH_PORT, SSHClient The resolution is basically just to throw in another import line from the original source within paramiko.config: from paramiko.client import SSHClient from paramiko.config import SSH_PORT

Will attach a PR to this for the resolution.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: @.***>

prokopto-dev commented 4 months ago

Appreciated, @andrewschenck ! It's because sometimes those tools don't follow non-definition imports in submodules, so since SSH_PORT is defined in the Config submodule but imported into the Client submodule, some tools throw the error. More permissive typing implementations are perfectly fine with it, and sometimes there's config to allow it too;