Title: ignore-missing-imports does not suppress missing imports from existing modules · Issue #4515 · python/mypy · GitHub
Open Graph Title: ignore-missing-imports does not suppress missing imports from existing modules · Issue #4515 · python/mypy
X Title: ignore-missing-imports does not suppress missing imports from existing modules · Issue #4515 · python/mypy
Description: Filed as follow-up to python/typeshed#1827. Given the following tree structure: . ├── real │ ├── __init__.py │ └── sub.py ├── stub │ ├── __init__.pyi │ └── sub.pyi └── test.py with all files empty except for test.py, which contains: from...
Open Graph Description: Filed as follow-up to python/typeshed#1827. Given the following tree structure: . ├── real │ ├── __init__.py │ └── sub.py ├── stub │ ├── __init__.pyi │ └── sub.pyi └── test.py with all files empty ...
X Description: Filed as follow-up to python/typeshed#1827. Given the following tree structure: . ├── real │ ├── __init__.py │ └── sub.py ├── stub │ ├── __init__.pyi │ └── sub.pyi └── test.py with all files empty ...
Opengraph URL: https://github.com/python/mypy/issues/4515
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"ignore-missing-imports does not suppress missing imports from existing modules","articleBody":"Filed as follow-up to https://github.com/python/typeshed/pull/1827.\r\n\r\nGiven the following tree structure:\r\n\r\n```\r\n.\r\n├── real\r\n│ ├── __init__.py\r\n│ └── sub.py\r\n├── stub\r\n│ ├── __init__.pyi\r\n│ └── sub.pyi\r\n└── test.py\r\n```\r\n\r\nwith all files empty except for `test.py`, which contains:\r\n\r\n```\r\nfrom stub import noexist1\r\nfrom stub.sub import noexist2\r\nfrom stub.noexist3 import noexist4\r\n\r\nfrom real import noexist5\r\nfrom real.sub import noexist6\r\nfrom real.noexist7 import noexist8\r\n\r\nfrom noexist9 import bar\r\nfrom noexist10 import baz\r\n```\r\n\r\nRunning `mypy --ignore-missing-imports test.py` results in:\r\n\r\n```\r\ntest.py:1: error: Module 'stub' has no attribute 'noexist1'\r\ntest.py:2: error: Module 'stub.sub' has no attribute 'noexist2'\r\ntest.py:5: error: Module 'real' has no attribute 'noexist5'\r\ntest.py:6: error: Module 'real.sub' has no attribute 'noexist6'\r\n```\r\n\r\nThat is, missing module errors are suppressed, but imports of missing attributes of existing modules are not suppressed.\r\n\r\nThis makes incomplete stubs more troublesome than they would otherwise be, because you can't suppress them globally with something like this in `mypy.ini`:\r\n\r\n```\r\n[mypy-stub.*]\r\nignore_missing_imports = True\r\n```\r\n\r\nThere is no option but to either extend the incomplete stub, or else apply individual `# type: ignore` to every single erroring import.\r\n\r\nIt seems to me that the name `ignore-missing-imports` implies that all errors due to importing something that doesn't exist should be suppressed; it shouldn't matter whether the thing that is missing is an entire module or an attribute of a module. So I think this is a bug.\r\n\r\nAll behaviors above checked on current mypy master, Python 3.6.","author":{"url":"https://github.com/carljm","@type":"Person","name":"carljm"},"datePublished":"2018-01-26T23:47:47Z","url":"https://github.com/python/mypy/issues/4515"}
| 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:01a8e744-bc17-ae6e-b498-12aed77751a5 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B568:5537E:1862BB6:2029A7E:6B001C22 |
| html-safe-nonce | a96a1867a20d54042bf8561facf44c56a910159842aa258749bfaec6fe1fdabf |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNTY4OjU1MzdFOjE4NjJCQjY6MjAyOUE3RTo2QjAwMUMyMiIsInZpc2l0b3JfaWQiOiIzMDIxMzM2MTYyNTM2MDA0NjQyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 2c7d29a4e983d90d42cc9c1f0b75dd9d03a0071462a6a20ecf85ee4d3e075438 |
| hovercard-subject-tag | issue:292065407 |
| 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/4515/issue_layout |
| twitter:image | https://opengraph.githubassets.com/63d73b351e2592059fc1db89a3bb313b7c53914bf6218d41e7512cbf04a2a3ae/python/mypy/issues/4515 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/63d73b351e2592059fc1db89a3bb313b7c53914bf6218d41e7512cbf04a2a3ae/python/mypy/issues/4515 |
| og:image:alt | Filed as follow-up to python/typeshed#1827. Given the following tree structure: . ├── real │ ├── __init__.py │ └── sub.py ├── stub │ ├── __init__.pyi │ └── sub.pyi └── test.py with all files empty ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | carljm |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4eb4cba0d69f045374ac15de9666d22b0961e1d555cc3824f36b7734c00c78e0 |
| 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 | 44c658b24abf00491fb7ae5f56d42c9f38cbeab2 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width