Title: Mypy daemon + `--namespace-packages` mishandles deletion of `__init__.py` · Issue #11322 · python/mypy · GitHub
Open Graph Title: Mypy daemon + `--namespace-packages` mishandles deletion of `__init__.py` · Issue #11322 · python/mypy
X Title: Mypy daemon + `--namespace-packages` mishandles deletion of `__init__.py` · Issue #11322 · python/mypy
Description: Bug Report Run mypy with --namespace-packages flag. If daemon is initially run with p/__init__.py p/a.py Then delete p/__init__.py We expect p to become a namespace package and p.a to be resolvable still. This does not happen. The issue ...
Open Graph Description: Bug Report Run mypy with --namespace-packages flag. If daemon is initially run with p/__init__.py p/a.py Then delete p/__init__.py We expect p to become a namespace package and p.a to be resolvable...
X Description: Bug Report Run mypy with --namespace-packages flag. If daemon is initially run with p/__init__.py p/a.py Then delete p/__init__.py We expect p to become a namespace package and p.a to be resolvable...
Opengraph URL: https://github.com/python/mypy/issues/11322
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Mypy daemon + `--namespace-packages` mishandles deletion of `__init__.py`","articleBody":"**Bug Report**\r\n\r\nRun mypy with `--namespace-packages` flag.\r\n\r\nIf daemon is initially run with\r\n```\r\np/__init__.py\r\np/a.py\r\n```\r\n\r\nThen delete `p/__init__.py`\r\nWe expect `p` to become a namespace package and `p.a` to be resolvable still. This does not happen.\r\n\r\nThe issue exists within the daemon update logic (update.py).\r\nIf we initialize the daemon with only\r\n```\r\np/a.py\r\n```\r\nthings work ok.\r\n\r\nIssue was discovered via #11259 and #9636 for context\r\n\r\n**To Reproduce**\r\n\r\nIn `test-data/unit/fine-grained-modules.test`, add to the first line of the following tests `testDeletePackage4`, `testDeletePackage5`, and `testDeletePackage6`\r\n```\r\n# flags: --namespace-packages\r\n```\r\n\r\nCan run the test with\r\n```\r\nsource .tox/py37/bin/activate\r\npytest mypy/test/testfinegrained.py -k testDeletePackage4 -n0\r\n````\r\n\r\n**Expected Behavior**\r\n\r\nfor testDeletePackage4\r\n```\r\n main:3: error: Argument 1 to \"f\" has incompatible type \"int\"; expected \"str...\r\n ==\r\n main:3: error: Argument 1 to \"f\" has incompatible type \"int\"; expected \"str...\r\n == (diff)\r\n main:2: error: Cannot find implementation or library stub for module named \"p.a\" (diff)\r\n main:2: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports (diff)\r\n main:2: error: Cannot find implementation or library stub for module named \"p\" (diff)\r\n```\r\n\r\n\r\n**Actual Behavior**\r\n\r\nfor testDeletePackage4\r\n```\r\n main:3: error: Argument 1 to \"f\" has incompatible type \"int\"; expected \"str...\r\n ==\r\n main:2: error: Import of \"p.a\" ignored (diff)\r\n main:2: note: (Using --follow-imports=error, module not passed on command line) (diff)\r\n == (diff)\r\n main:2: error: Cannot find implementation or library stub for module named \"p.a\" (diff)\r\n main:2: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports (diff)\r\n main:2: error: Cannot find implementation or library stub for module named \"p\" (diff)\r\n```\r\n\r\n\r\nIdeally when fixing this task - we should convert the three aformentioned tests to use `--namespace-packages`","author":{"url":"https://github.com/nipunn1313","@type":"Person","name":"nipunn1313"},"datePublished":"2021-10-12T22:53:23Z","url":"https://github.com/python/mypy/issues/11322"}
| 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:756330d4-667f-5dd7-a66c-349a45bc8455 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9C42:07D0:24653A2:3055B3F:6B005E07 |
| html-safe-nonce | d3134c98f6fbb9304fbe8f3540b99a2f8fe69e4d5f794be8efc4a0f81202c376 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5QzQyOjA3RDA6MjQ2NTNBMjozMDU1QjNGOjZCMDA1RTA3IiwidmlzaXRvcl9pZCI6IjU5NDM1MTYwMDI0NTIwMDQzNTkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 0e5da5bf649fd5a8fc4ddd1f0ed7d02de794922c1b5147e26e1dd88aca003fa0 |
| hovercard-subject-tag | issue:1024558576 |
| 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/11322/issue_layout |
| twitter:image | https://opengraph.githubassets.com/b9332e29b2a758c8ef191af25e17ba883c0b5fbb9aaca841d9d43b244c7fab92/python/mypy/issues/11322 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/b9332e29b2a758c8ef191af25e17ba883c0b5fbb9aaca841d9d43b244c7fab92/python/mypy/issues/11322 |
| og:image:alt | Bug Report Run mypy with --namespace-packages flag. If daemon is initially run with p/__init__.py p/a.py Then delete p/__init__.py We expect p to become a namespace package and p.a to be resolvable... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | nipunn1313 |
| 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