Skip to content

Conversation

@pelson
Copy link
Contributor

@pelson pelson commented Oct 15, 2025

Follows on from issues identified through #13599.

As before, intentionally targeting zero functional change.

@pelson pelson changed the title [Typing} Fix minor typing of pip._internal sub packages utils, exceptions, locations, self_outdated_check [typing] Fix minor typing of pip._internal sub packages utils, exceptions, locations, self_outdated_check Oct 15, 2025
@sepehr-rs
Copy link
Member

Hi @pelson, thanks again for your contribution to pip!
This PR appears to be mostly internal again, so I’ve added the 'skip news' label.
Since these typing improvements seem related, it might be worth considering grouping similar changes into a single PR in the future, which can sometimes make reviews a bit easier for maintainers.
In any case, thanks for working on improving the typing coverage here!

@sepehr-rs sepehr-rs added the skip news Does not need a NEWS file entry (eg: trivial changes) label Oct 15, 2025
Copy link
Member

@ichard26 ichard26 left a comment

Choose a reason for hiding this comment

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

Looks good other than the one rewrite you suggested and I prefer that we went with.

@pelson pelson force-pushed the typing/utils-typing branch from a9c0576 to 72554d7 Compare October 30, 2025 04:07
from distutils.dist import Distribution

cmd: Any = install(Distribution())
cmd: install = install(Distribution())
Copy link
Member

Choose a reason for hiding this comment

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

I’m just curious why this annotation is even needed. Shouldn’t the return type be inferred…?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, you are right. I checked with both our existing mypy calls and with the full mypy in #13599, and in both cases reveal_type correctly gives us the install command class as the type.

I've added a commit.

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

Labels

skip news Does not need a NEWS file entry (eg: trivial changes)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants