Skip to content

docs: Put specific ignore comment for missing types#20118

Closed
yedayak wants to merge 1 commit into
python:masterfrom
yedayak:patch-1
Closed

docs: Put specific ignore comment for missing types#20118
yedayak wants to merge 1 commit into
python:masterfrom
yedayak:patch-1

Conversation

@yedayak

@yedayak yedayak commented Oct 25, 2025

Copy link
Copy Markdown

The docs for "Missing library stubs or py.typed marker" give you an option to ignore the error, but its not complete. Copying it verbatim into your code results in this error:

error: "type: ignore" comment without error code (consider "type: ignore[import-not-found]" instead)  [ignore-without-code]

The error is helpful, but just having it work right away will be better :)

@wyattscarpenter

wyattscarpenter commented Oct 25, 2025

Copy link
Copy Markdown
Contributor

This only happens because you have ignore-without-code enabled; presumably from running mypy in strict mode.

It seems fine and better to specify the exact ignore code here, though.

@hauntsaninja

Copy link
Copy Markdown
Collaborator

Thanks for the PR! ignore-without-code is disabled by default and not part of --strict, so this is only useful for a small and sophisticated part of the user base. Moreover, it is only sometimes right — the advice in this section also applies to cases where the error code would be import-untyped

@hauntsaninja hauntsaninja added the pending Issues that may be closed label Nov 2, 2025
@sterliakov

Copy link
Copy Markdown
Collaborator

I'd be in favor of adding the error code, but as @hauntsaninja noted we can't do that here. Depending on the failure reason it could be import-not-found or import-untyped, and providing either one will be confusing for users encountering the other. Using both is never correct and will report unused-ignore. So I agree it's better to avoid specifying the error code here.

@yedayak

yedayak commented Nov 2, 2025

Copy link
Copy Markdown
Author

OK, thanks all for the feedback! What you say makes sense, I will close the PR.

@yedayak yedayak closed this Nov 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pending Issues that may be closed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants