Add type hints#17
Merged
Merged
Conversation
henri-hulski
approved these changes
Jun 5, 2026
Member
henri-hulski
left a comment
There was a problem hiding this comment.
If you want to modernize importscan,feel free to go. I wasn't digging into it to much and I don't remember that there was any work done beside modernizing the workflow.
Other than Morepath or Reg.
So I think it can use some review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
These type hints I had to create from scratch, but were by far the most straightforward.
It is however worth noting that by adding the type hints, it came to light, that
scancurrently does not handleMetaPathFinderimporters, so we maybe should open an issue for that and try to add support for them in the future.I also noticed that there's some strange logic when it comes to packages vs. plain modules. Since
walk_packagesalways imports packages, we technically don't need to import them again inscan(even though going through__import__guarantees that the actual import only happens once). The other thing that's strange about that is that we use aimport_modulehelper function inscanto skip loading some modules, but we don't do that inwalk_packages, so the check only really works on plain modules, not packages. This might also be worth investigating and opening a ticket for.I also decided to get rid of the workarounds for old finders that only have a
find_module, but nofind_specmethod, since those have been deprecated since 3.4 and fully unsupported since 3.9, so those finders would not work with 3.10 anyways and importing the module would fail./cc @henri-hulski