Skip to content

[paramiko] Update to 5.0.0#15907

Open
srittau wants to merge 3 commits into
python:mainfrom
srittau:paramiko-5.0.0
Open

[paramiko] Update to 5.0.0#15907
srittau wants to merge 3 commits into
python:mainfrom
srittau:paramiko-5.0.0

Conversation

@srittau

@srittau srittau commented Jun 13, 2026

Copy link
Copy Markdown
Collaborator

Closes: #15749

@github-actions

Copy link
Copy Markdown
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@AlexWaygood AlexWaygood left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Partial review, I haven't reviewed stubs/paramiko/paramiko/pkey.pyi and onwards yet

Comment on lines +20 to +21
def from_file(cls, flo: Iterable[str]) -> Self: ...
def parse(self, file_obj: Iterable[str]) -> None: ...

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

while it's true that any iterable of strings will work at runtime, the docstrings say that a file-like object is expected, and IO[str] does express that it should be an iterable of lines (rather than an iterable of words or characters).

I know you're generally opposed to using IO, though, and I share your philosophy there... not sure if there's a protocol that could also express "this needs to be an iterable of lines of source code" in the same way...

def write_private_key_file(self, filename: FileDescriptorOrPath, password: str | None = None) -> None: ...
def write_private_key(self, file_obj: IO[str], password: str | None = None) -> None: ...
@property
def private_key(self) -> EllipticCurvePrivateKey: ...

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this property is annotated with Optional[EllipticCurvePrivateKey] upstream. At first glance, that looks right (and I think the signing_key instance attribute should be EllipticCurvePrivateKey | None as well)

Suggested change
def private_key(self) -> EllipticCurvePrivateKey: ...
def private_key(self) -> EllipticCurvePrivateKey | None: ...

from paramiko.pkey import PKey
from paramiko.pkey import PKey, _HasReadlines

_VerifyKey: TypeAlias = Any # actually nacl.signing.VerifyKey

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pynacl looks to be fully typed and has a py.typed file. We could consider adding it to the stub_uploader allowlist and then adding it as a dependency of these stubs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants