Title: Mypy report missing type stub in third-party library when uninstalling a library · Issue #17049 · python/mypy · GitHub
Open Graph Title: Mypy report missing type stub in third-party library when uninstalling a library · Issue #17049 · python/mypy
X Title: Mypy report missing type stub in third-party library when uninstalling a library · Issue #17049 · python/mypy
Description: Bug Report Mypy reports a missing type stub library from a third-party module in some case. In some case I will get error such as venv/lib/python3.11/site-packages/opensearchpy/connection/base.py:38: error: Library stubs not installed fo...
Open Graph Description: Bug Report Mypy reports a missing type stub library from a third-party module in some case. In some case I will get error such as venv/lib/python3.11/site-packages/opensearchpy/connection/base.py:3...
X Description: Bug Report Mypy reports a missing type stub library from a third-party module in some case. In some case I will get error such as venv/lib/python3.11/site-packages/opensearchpy/connection/base.py:3...
Opengraph URL: https://github.com/python/mypy/issues/17049
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Mypy report missing type stub in third-party library when uninstalling a library","articleBody":"**Bug Report**\r\n\r\nMypy reports a missing type stub library from a third-party module in some case.\r\n\r\nIn some case I will get error such as\r\n\r\n```\r\nvenv/lib/python3.11/site-packages/opensearchpy/connection/base.py:38: error: Library stubs not installed for \"simplejson\" [import-untyped]\r\nvenv/lib/python3.11/site-packages/opensearchpy/serializer.py:32: error: Library stubs not installed for \"simplejson\" [import-untyped]\r\nvenv/lib/python3.11/site-packages/opensearchpy/serializer.py:32: note: Hint: \"python3 -m pip install types-simplejson\"\r\nvenv/lib/python3.11/site-packages/opensearchpy/serializer.py:32: note: (or run \"mypy --install-types\" to install all missing stub packages)\r\nvenv/lib/python3.11/site-packages/opensearchpy/serializer.py:32: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports\r\n```\r\n\r\nNote that this error is coming from `site-packages`.\r\n\r\n(A clear and concise description of what the bug is.)\r\n\r\n**To Reproduce**\r\n\r\n```python\r\necho \"import opensearchpy\" > foo.py\r\npip install opensearch-py\r\nmypy foo.py\r\npip install types-simplejson\r\nmypy foo.py\r\npip uninstall types-simplejson\r\nmypy foo.py # Fail with the error above!\r\n```\r\n\r\n**Expected Behavior**\r\n\r\nI would expect the `mypy` following the uninstall to give the same result as the first `mypy` call before the install.\r\n\r\nDeleting the cache in between command does not result in an error.\r\n\r\n**Actual Behavior**\r\n\r\nIt seems like the mypy cache change the behavior and expect the types library to be present.\r\n\r\n**Your Environment**\r\n\r\n```\r\n$ mypy --version\r\nmypy 1.9.0 (compiled: yes)\r\n$ python --version\r\nPython 3.11.3\r\n```\r\n\r\nNo `mypy.ini` set.\r\n\r\nWhile this bug seems to be niche, it's making our CI flaky when we share cache between jobs that might not have the same dependency set. For example, someone adding a new dependency in a branch that runs a job sharing the mypy cache will make all the project other branches fail until all code rebase on this commit to include the new dependency.\r\n\r\nOther people seems to have similar issues here: https://github.com/pantsbuild/pants/issues/18519\r\n\r\n","author":{"url":"https://github.com/leameow","@type":"Person","name":"leameow"},"datePublished":"2024-03-19T23:29:57Z","url":"https://github.com/python/mypy/issues/17049"}
| 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:1acbfa0a-a979-6ade-c550-2c6ce78a7594 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A46C:1B3067:383507:4ED575:6B005E4F |
| html-safe-nonce | 802392fa0754967e9c1f90ff1b52bfd7ab588e4186c663159a02f7d04afb7a51 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNDZDOjFCMzA2NzozODM1MDc6NEVENTc1OjZCMDA1RTRGIiwidmlzaXRvcl9pZCI6IjE4MTIxMDUzMDAyMTY0MDU1ODMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 7897f0feb919e5f56f6de474541d93b22a78c0846f0e8d27a140b225b228df97 |
| hovercard-subject-tag | issue:2196233189 |
| 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/17049/issue_layout |
| twitter:image | https://opengraph.githubassets.com/b4b84e08684de92b5c6fbfdcba4e692e1ce904e01eb228a0c5dac07750a6afdd/python/mypy/issues/17049 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/b4b84e08684de92b5c6fbfdcba4e692e1ce904e01eb228a0c5dac07750a6afdd/python/mypy/issues/17049 |
| og:image:alt | Bug Report Mypy reports a missing type stub library from a third-party module in some case. In some case I will get error such as venv/lib/python3.11/site-packages/opensearchpy/connection/base.py:3... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | leameow |
| hostname | github.com |
| expected-hostname | github.com |
| None | 29be975efff6507a5d135de9c7d634cf7ff8f0c55222a64386ab3202209aaf73 |
| 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 | eacd927ba6112e3b01ba99c762bd699a4a4f5df7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width