Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Split import-untyped into import-untyped and import-untyped-stubs-available #19101

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

Open
wants to merge 12 commits into
base: master
Choose a base branch
Loading
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add import-untyped-stubs-available, and docu (but not implementation)
  • Loading branch information
wyattscarpenter committed May 17, 2025
commit 050632b0abb22d1d8853b07ab250730f83c79af4
24 changes: 22 additions & 2 deletions 24 docs/source/error_code_list.rst
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,8 @@ Check for an issue with imports [import]
----------------------------------------

Mypy generates an error if it can't resolve an `import` statement.
This is a parent error code of `import-not-found` and `import-untyped`
This is a parent error code of `import-not-found`, `import-untyped`,
and `import-untyped-stubs-available`

See :ref:`ignore-missing-imports` for how to work around these errors.

Expand Down Expand Up @@ -673,14 +674,33 @@ Example:

.. code-block:: python

# Error: Library stubs not installed for "bs4" [import-untyped]
# Error: Library stubs not installed for "bs4" [import-untyped-stubs-available]
import bs4
# Error: Skipping analyzing "no_py_typed": module is installed, but missing library stubs or py.typed marker [import-untyped]
import no_py_typed

In some cases, these errors can be fixed by installing an appropriate
stub package. See :ref:`ignore-missing-imports` for more details.

Check that import target with known stubs can be found [import-untyped-stubs-available]
--------------------------------------------------------

Like :ref:`code-import-untyped`, but used when mypy knows there is an appropriate
type stub package corresponding to the library, which you could install.

Example:

.. code-block:: python

# Error: Library stubs not installed for "bs4" [import-untyped-stubs-available]
import bs4
# Error: Skipping analyzing "no_py_typed": module is installed, but missing library stubs or py.typed marker [import-untyped]
import no_py_typed

These errors can be fixed by installing the appropriate
stub package. See :ref:`ignore-missing-imports` for more details.


.. _code-no-redef:

Check that each name is defined once [no-redef]
Expand Down
3 changes: 3 additions & 0 deletions 3 mypy/errorcodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ def __hash__(self) -> int:
IMPORT_UNTYPED: Final = ErrorCode(
"import-untyped", "Require that imported module has stubs", "General", sub_code_of=IMPORT
)
IMPORT_UNTYPED_STUBS_AVAILABLE: Final = ErrorCode(
"import-untyped-stubs-available", "Require that imported module (with known stubs) has stubs", "General", sub_code_of=IMPORT
)
NO_REDEF: Final = ErrorCode("no-redef", "Check that each name is defined once", "General")
FUNC_RETURNS_VALUE: Final = ErrorCode(
"func-returns-value", "Check that called function returns a value in value context", "General"
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.