Title: Split `import-untyped` into two different error codes depending on whether stubs are available to install · Issue #18661 · python/mypy · GitHub
Open Graph Title: Split `import-untyped` into two different error codes depending on whether stubs are available to install · Issue #18661 · python/mypy
X Title: Split `import-untyped` into two different error codes depending on whether stubs are available to install · Issue #18661 · python/mypy
Description: Feature Implement separate error codes for (1) untyped imports without stubs available and (2) untyped imports with stubs available. Pitch As explained under Missing imports in the docs, there are two different categories of untyped impo...
Open Graph Description: Feature Implement separate error codes for (1) untyped imports without stubs available and (2) untyped imports with stubs available. Pitch As explained under Missing imports in the docs, there are ...
X Description: Feature Implement separate error codes for (1) untyped imports without stubs available and (2) untyped imports with stubs available. Pitch As explained under Missing imports in the docs, there are ...
Opengraph URL: https://github.com/python/mypy/issues/18661
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Split `import-untyped` into two different error codes depending on whether stubs are available to install","articleBody":"**Feature**\n\nImplement separate error codes for (1) untyped imports *without* stubs available and (2) untyped imports *with* stubs available.\n\n**Pitch**\n\nAs explained under [Missing imports](https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports) in the docs, there are two different categories of untyped imports. Currently, both of these categories are grouped under the `import-untyped` error code. For example:\n\n1. No stubs available (documented [here](https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-library-stubs-or-py-typed-marker)):\n \n ```\n error: Skipping analyzing \"boto3\": module is installed, but missing library stubs or py.typed marker [import-untyped]\n ```\n\n2. Stubs available (documented [here](https://mypy.readthedocs.io/en/stable/running_mypy.html#library-stubs-not-installed)):\n\n ```\n error: Library stubs not installed for \"requests\" [import-untyped]\n note: Hint: \"python3 -m pip install types-requests\"\n ```\n\nI propose that these categories should fall under different error codes, either by changing the error code for both of these categories (and removing the `import-untyped` error code) or by changing the error code for only one of the categories, and leaving the other as `import-untyped`. For example, the second category could fall under a new `import-untyped-stubs-available` code.\n\nThis would allow configuring mypy to handle these two categories differently. For example, I would like to always ignore errors for untyped third-party libraries *without* stubs available, but always show errors for libraries *with* stubs available, so that I know which stub packages I should add to my project dependencies. The available solutions for achieving this all have drawbacks:\n\n- Using `disable_error_code = import-untyped` ignores *both* of the above categories, so you won't be notified about libraries with available stubs.\n- Using the `--install-types` option as part of CICD workflows is brittle and not recommended (see \u003chttps://github.com/python/mypy/issues/17852>), so doesn't scale well when maintaining many different repositories where running `--install-types` locally for every project on a regular basis is not feasible.\n- Ignoring the `import-untyped` error code for individual imports is again inconvenient when managing many different projects with many third-party dependencies. Also, if you ignore the `import-untyped` error code for a particular import and then the library later adds type stubs, mypy won't notify you that there is a stub package available to install.","author":{"url":"https://github.com/jtherrmann","@type":"Person","name":"jtherrmann"},"datePublished":"2025-02-11T19:18:47Z","url":"https://github.com/python/mypy/issues/18661"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:49cac5be-f574-fb0f-599e-f165b0adf326 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E9A4:2B9B04:310D7AB:40FC83A:6B003363 |
| html-safe-nonce | b85d62c683811e9ddd1317a5da299039da32a2e9af00f67bcf4de8b15790e5ad |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFOUE0OjJCOUIwNDozMTBEN0FCOjQwRkM4M0E6NkIwMDMzNjMiLCJ2aXNpdG9yX2lkIjoiNTE5NDEwODQ3NDg5NTY0MzQ5MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 2513c008180afb303eb87f70973453e04bdb844774f34baf38f68f6875414a01 |
| hovercard-subject-tag | issue:2846289392 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/mypy/18661/issue_layout |
| twitter:image | https://opengraph.githubassets.com/481431ab83cf960480ff66443e06c6aa7166f22bd668d1f940ec808ca293380d/python/mypy/issues/18661 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/481431ab83cf960480ff66443e06c6aa7166f22bd668d1f940ec808ca293380d/python/mypy/issues/18661 |
| og:image:alt | Feature Implement separate error codes for (1) untyped imports without stubs available and (2) untyped imports with stubs available. Pitch As explained under Missing imports in the docs, there are ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jtherrmann |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7d0829bbde9e48b2486cb5dd6d147896eb01d32134627091f818958a935ef3f0 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/mypy git https://github.com/python/mypy.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 7053637 |
| octolytics-dimension-repository_nwo | python/mypy |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 7053637 |
| octolytics-dimension-repository_network_root_nwo | python/mypy |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | f3f3a43ca095cdea3abbb394112e971f9fdb94fa |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width