Title: stubtest reports imported name as not present at runtime even though it's not reexported · Issue #8649 · python/mypy · GitHub
Open Graph Title: stubtest reports imported name as not present at runtime even though it's not reexported · Issue #8649 · python/mypy
X Title: stubtest reports imported name as not present at runtime even though it's not reexported · Issue #8649 · python/mypy
Description: Are you reporting a bug, or opening a feature request? A bug, unless this is somehow intended behavior. Please insert below the code you are checking with mypy, or a mock-up repro if the source is private. We would appreciate if you try ...
Open Graph Description: Are you reporting a bug, or opening a feature request? A bug, unless this is somehow intended behavior. Please insert below the code you are checking with mypy, or a mock-up repro if the source is ...
X Description: Are you reporting a bug, or opening a feature request? A bug, unless this is somehow intended behavior. Please insert below the code you are checking with mypy, or a mock-up repro if the source is ...
Opengraph URL: https://github.com/python/mypy/issues/8649
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"stubtest reports imported name as not present at runtime even though it's not reexported","articleBody":"* Are you reporting a bug, or opening a feature request?\r\n\r\nA bug, unless this is somehow intended behavior.\r\n* Please insert below the code you are checking with mypy,\r\n or a mock-up repro if the source is private. We would appreciate\r\n if you try to simplify your case to a minimal repro.\r\n\r\nhttps://github.com/henribru/stubtest-bug\r\n* What is the actual behavior/output?\r\n\r\n```\r\nerror: stubtest_bug.foo.Bar is not present at runtime\r\nStub: at line -1\r\nAny\r\nRuntime:\r\nMISSING\r\n\r\nerror: stubtest_bug.foo.Baz is not present at runtime\r\nStub: at line -1\r\nAny\r\nRuntime:\r\nMISSING\r\n```\r\n* What is the behavior/output you expect?\r\n\r\nGiven that Baz is reexported while Bar isn't, I would only expect an error for Baz. Importing a name that's not present at runtime in the stub to use in type annotations is a common use case and shouldn't produce errors, since Mypy won't let you import that name anyway without it being reexported.\r\n\r\nNote that this seems to work as expected if there are annotations for the module you import from. The error only occurs if you import from a module without annotations and stick a type ignore comment at the import (the latter is needed to make stubtest run at all).\r\n* What are the versions of mypy and Python you are using?\r\n Do you see the same issue after installing mypy from Git master?\r\n\r\nPython 3.7.3 and Mypy 0.770. I haven't tested master, but seems like there haven't been any changes to stubtest since 0.770 anyway.\r\n","author":{"url":"https://github.com/henribru","@type":"Person","name":"henribru"},"datePublished":"2020-04-08T16:11:37Z","url":"https://github.com/python/mypy/issues/8649"}
| 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:b1e6a5cf-a8b2-e1aa-a830-a6441336faef |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D790:172DDC:1146DD:175BDD:6B0063CA |
| html-safe-nonce | 44689c8c8fcf9ae81870761d98652846757bdc15cfd0e8709fd1886f23ca08c1 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENzkwOjE3MkREQzoxMTQ2REQ6MTc1QkREOjZCMDA2M0NBIiwidmlzaXRvcl9pZCI6Ijc3NDYwMjg2Njc1MTEyNjgyOTgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 9dd8fb927f683ccbc231c392be16a6817eebfeb49ade0e5151fde1bb45aa7af7 |
| hovercard-subject-tag | issue:596695425 |
| 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/8649/issue_layout |
| twitter:image | https://opengraph.githubassets.com/0ebe8e685d6f80c9f43d89b8f0198977cb771158111709031a3d9f002f829823/python/mypy/issues/8649 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/0ebe8e685d6f80c9f43d89b8f0198977cb771158111709031a3d9f002f829823/python/mypy/issues/8649 |
| og:image:alt | Are you reporting a bug, or opening a feature request? A bug, unless this is somehow intended behavior. Please insert below the code you are checking with mypy, or a mock-up repro if the source is ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | henribru |
| hostname | github.com |
| expected-hostname | github.com |
| None | 25854482a1773a7c1ebb8be3d2bc1c6e61d82d78126be63b5044474a86d44d9e |
| 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 | e4f5c239e31f1f680e6bbc419ff92d774da616ec |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width