Title: Mypy does not recheck files when follow_imports changes for dependencies · Issue #7777 · python/mypy · GitHub
Open Graph Title: Mypy does not recheck files when follow_imports changes for dependencies · Issue #7777 · python/mypy
X Title: Mypy does not recheck files when follow_imports changes for dependencies · Issue #7777 · python/mypy
Description: Steps to reproduce Create module test.py with import from nonexistent module: from foo import bar Create mypy.ini file: [mypy] [mypy-foo] ignore_missing_imports = True Run mypy $ mypy test.py Success: no issues found in 1 source file Com...
Open Graph Description: Steps to reproduce Create module test.py with import from nonexistent module: from foo import bar Create mypy.ini file: [mypy] [mypy-foo] ignore_missing_imports = True Run mypy $ mypy test.py Succe...
X Description: Steps to reproduce Create module test.py with import from nonexistent module: from foo import bar Create mypy.ini file: [mypy] [mypy-foo] ignore_missing_imports = True Run mypy $ mypy test.py Succe...
Opengraph URL: https://github.com/python/mypy/issues/7777
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Mypy does not recheck files when follow_imports changes for dependencies","articleBody":"### Steps to reproduce\r\n\r\n1. Create module *test.py* with import from nonexistent module:\r\n```\r\nfrom foo import bar\r\n```\r\n\r\n2. Create *mypy.ini* file:\r\n```\r\n[mypy]\r\n\r\n[mypy-foo]\r\nignore_missing_imports = True \r\n```\r\n\r\n3. Run `mypy`\r\n```\r\n$ mypy test.py \r\nSuccess: no issues found in 1 source file\r\n```\r\n\r\n4. Comment out `[mypy-foo]` section in *mypy.ini*\r\n```\r\n[mypy]\r\n\r\n# [mypy-foo]\r\n# ignore_missing_imports = True \r\n```\r\n\r\n5. Run `mypy`\r\n```\r\n$ mypy test.py \r\nSuccess: no issues found in 1 source file\r\n```\r\n\r\n### Expected result\r\nAfter step 4, mypy should detect config change and (partially?) invalidate cache, leading to a type error.\r\n```\r\n$ mypy test.py \r\ntest.py:1: error: Cannot find module named 'foo'\r\ntest.py:1: note: See https://mypy.readthedocs.io/en/latest/running_mypy.html#missing-imports\r\nFound 1 error in 1 file (checked 1 source file)\r\n```\r\n\r\n### Notes\r\n* Deleting `.mypy_cache/` and re-running `mypy` fixes the issue.\r\n* Adding/removing `ignore_missing_imports` in the main `[mypy]` section *does* seem to invalidate the cache as expected. So this issue only seems to apply to `[mypy-PATTERN]` sections.\r\n\r\n### Versions\r\n```\r\n$ python --version\r\nPython 3.7.3\r\n```\r\n```\r\n$ mypy --version\r\nmypy 0.740\r\n```","author":{"url":"https://github.com/nickgaya","@type":"Person","name":"nickgaya"},"datePublished":"2019-10-22T08:37:37Z","url":"https://github.com/python/mypy/issues/7777"}
| 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:154728b2-e280-9bd3-dfbd-8c5a285d09a3 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A4A0:22E601:4E70B6:69855F:6B002F52 |
| html-safe-nonce | f04c5f986a045010afdce9a2bfa5cadfc50fbc1c79890278609554a477f25378 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNEEwOjIyRTYwMTo0RTcwQjY6Njk4NTVGOjZCMDAyRjUyIiwidmlzaXRvcl9pZCI6Ijc1NDE1MzYwMDE3MTQzMDI4MDIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 6f05a84e802d116d52e38af3b23ead86a7c01d0f4e2a9924a8bfe0be562432d0 |
| hovercard-subject-tag | issue:510508128 |
| 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/7777/issue_layout |
| twitter:image | https://opengraph.githubassets.com/1fd56b06b9c35ab66abb39fd0b6f61f943d173e40523315e657723af674f9e0c/python/mypy/issues/7777 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/1fd56b06b9c35ab66abb39fd0b6f61f943d173e40523315e657723af674f9e0c/python/mypy/issues/7777 |
| og:image:alt | Steps to reproduce Create module test.py with import from nonexistent module: from foo import bar Create mypy.ini file: [mypy] [mypy-foo] ignore_missing_imports = True Run mypy $ mypy test.py Succe... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | nickgaya |
| 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