KEMBAR78
Better error for `mypy -p package` without py.typed by jogo-openai · Pull Request #17908 · python/mypy · GitHub
Skip to content

Conversation

jogo-openai
Copy link
Contributor

@jogo-openai jogo-openai commented Oct 9, 2024

Improve the error message when running mypy -p packagename with a
package that doesn't have py.typed set.

package 'example' is skipping due to missing py.typed marker. See https://mypy.readthedocs.io/en/stable/installed_packages.html for more details

Fix #17048

@github-actions

This comment has been minimized.

Copy link
Collaborator

@hauntsaninja hauntsaninja left a comment

Choose a reason for hiding this comment

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

Nice! Looking at find_modules_recursive, I think we can be a little more helpful. if not p_targets, let's call find_module directly, if the module not found reason is found without type hints, we can confidently say py.typed is missing (and otherwise we can fail with the existing message)

@github-actions

This comment has been minimized.

@hauntsaninja hauntsaninja changed the title Fix #17048 Better error for mypy -p package without py.typed Oct 10, 2024
@jogo-openai
Copy link
Contributor Author

test failure seems to be unrelated and not sure how to retry it

@hauntsaninja
Copy link
Collaborator

Don't worry about it, I'll take care of that :-)

Thanks again for the improvement!

@github-actions
Copy link
Contributor

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

@hauntsaninja hauntsaninja merged commit 33717e5 into python:master Oct 10, 2024
18 of 19 checks passed
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.

"Can't find package" error when package is installed but missing a py.typed file

2 participants