Title: Incremental parsing issue with namespace packages · Issue #12664 · python/mypy · GitHub
Open Graph Title: Incremental parsing issue with namespace packages · Issue #12664 · python/mypy
X Title: Incremental parsing issue with namespace packages · Issue #12664 · python/mypy
Description: Given a local file which uses something which is a namespace package and then another local file which uses the first one, there's an intermittent bug where the namespace packaged module's types aren't found. This seems likely similar to...
Open Graph Description: Given a local file which uses something which is a namespace package and then another local file which uses the first one, there's an intermittent bug where the namespace packaged module's types ar...
X Description: Given a local file which uses something which is a namespace package and then another local file which uses the first one, there's an intermittent bug where the namespace packaged module's ...
Opengraph URL: https://github.com/python/mypy/issues/12664
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Incremental parsing issue with namespace packages","articleBody":"Given a local file which uses something which is a namespace package and then another local file which uses the first one, there's an intermittent bug where the namespace packaged module's types aren't found.\r\nThis seems likely similar to https://github.com/python/mypy/issues/7276, however even with https://github.com/python/mypy/pull/10937 in place (i.e: on a more recent mypy release) the issue remains.\r\n\r\n**To Reproduce**\r\n\r\n``` shell\r\n$ mkdir demo\r\n$ echo 'import ruamel.yaml' > demo/wrapper.py \r\n$ echo 'import wrapper' > demo/consumer.py\r\n```\r\n``` shell\r\n$ mypy demo # first run\r\nSuccess: no issues found in 2 source files\r\n```\r\n``` shell\r\n$ mypy demo # second run\r\ndemo/wrapper.py:1: error: Skipping analyzing \"ruamel\": module is installed, but missing library stubs or py.typed marker\r\ndemo/consumer.py:1: error: Skipping analyzing \"ruamel\": module is installed, but missing library stubs or py.typed marker\r\ndemo/consumer.py:1: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports\r\nFound 2 errors in 2 files (checked 2 source files)\r\n```\r\n\r\nSubsequent runs will alternate between success and failure. Any additional source files in the project (whether they import the `wrapper` or not) will also have the error message applied to them, which makes failing runs vastly less useful.\r\n\r\nRunning with `--no-incremental` appears to avoid the issue; I can run several times in a row with `--no-incremental` without encountering the failure mode (and have not seen it with that flag enabled).\r\n\r\nRunning with `--namespace-packages` appears to have no effect.\r\n\r\nUnfortunately as `ruamel.yaml` is a typed library, ignoring the imports with `type: ignore[import]` ends up generating more errors as the ignores appear unused on a \"successful\" run (and you have `warn_unused_ignores` enabled).\r\n\r\n\u003cdetails>\r\n\u003csummary>Setup & versions\u003c/summary>\r\n\r\n``` shell\r\npython3.9 -m venv venv\r\n. venv/bin/activate\r\npip install -U pip setuptools wheel\r\npip install mypy ruamel.yaml\r\n```\r\n``` shell\r\n$ pip list\r\nPackage Version\r\n----------------- -------\r\nmypy 0.942\r\nmypy-extensions 0.4.3\r\npip 22.0.4\r\nruamel.yaml 0.17.21\r\nruamel.yaml.clib 0.2.6\r\nsetuptools 62.1.0\r\ntomli 2.0.1\r\ntyping_extensions 4.2.0\r\nwheel 0.37.1\r\n```\r\n\r\n\u003c/details>\r\n\r\n**Your Environment**\r\n\r\n\u003c!-- Include as many relevant details about the environment you experienced the bug in -->\r\n\r\n- Mypy version used: 0.942\r\n- Mypy command-line flags: see above\r\n- Mypy configuration options from `mypy.ini` (and other config files): none\r\n- Python version used: 3.9 (though similar behaviour observed on other versions; at least on 3.8)\r\n- Operating system and version: Ubuntu 20.04 LTS\r\n","author":{"url":"https://github.com/PeterJCLaw","@type":"Person","name":"PeterJCLaw"},"datePublished":"2022-04-23T21:43:27Z","url":"https://github.com/python/mypy/issues/12664"}
| 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:af83cff4-7468-6ed8-d592-c5da21dcd90a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EAA8:142FA7:E5BFB:135744:6B001D3D |
| html-safe-nonce | dcd87aaded43ea46cafb36647fda44922391d06db61034a7587e3057882600fb |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQUE4OjE0MkZBNzpFNUJGQjoxMzU3NDQ6NkIwMDFEM0QiLCJ2aXNpdG9yX2lkIjoiMzk2NzA4MzcwNDgwMjYxNDU4OSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 028e53d82bb6348e74c10cae7f80a4aa18a7983ff71492c97eb106276155f7dc |
| hovercard-subject-tag | issue:1213460893 |
| 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/12664/issue_layout |
| twitter:image | https://opengraph.githubassets.com/de37800a6486eac6da85f31436ba459ec93b907ab33157e37bce7a7c418d651e/python/mypy/issues/12664 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/de37800a6486eac6da85f31436ba459ec93b907ab33157e37bce7a7c418d651e/python/mypy/issues/12664 |
| og:image:alt | Given a local file which uses something which is a namespace package and then another local file which uses the first one, there's an intermittent bug where the namespace packaged module's types ar... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | PeterJCLaw |
| 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