Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better error for mypy -p package without py.typed #17908

Merged
merged 4 commits into from
Oct 10, 2024

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

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)

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

mypy/main.py Outdated Show resolved Hide resolved
@hauntsaninja
Copy link
Collaborator

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

Thanks again for the improvement!

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