Title: Namespace packages and __init__ imports · Issue #9716 · python/mypy · GitHub
Open Graph Title: Namespace packages and __init__ imports · Issue #9716 · python/mypy
X Title: Namespace packages and __init__ imports · Issue #9716 · python/mypy
Description: --namespace-packages runs into an issue if we import from __init__.py explicitly. For instance, given: . └── proj ├── __init__.py └── a.py $ cat proj/__init__.py x: int $ cat proj/a.py from .__init__ import x $ cat proj/b.py from proj.__...
Open Graph Description: --namespace-packages runs into an issue if we import from __init__.py explicitly. For instance, given: . └── proj ├── __init__.py └── a.py $ cat proj/__init__.py x: int $ cat proj/a.py from .__init...
X Description: --namespace-packages runs into an issue if we import from __init__.py explicitly. For instance, given: . └── proj ├── __init__.py └── a.py $ cat proj/__init__.py x: int $ cat proj/a.py from .__init...
Opengraph URL: https://github.com/python/mypy/issues/9716
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Namespace packages and __init__ imports","articleBody":"`--namespace-packages` runs into an issue if we import from `__init__.py` explicitly.\r\n\r\nFor instance, given:\r\n```\r\n.\r\n└── proj\r\n ├── __init__.py\r\n └── a.py\r\n\r\n$ cat proj/__init__.py \r\nx: int\r\n\r\n$ cat proj/a.py \r\nfrom .__init__ import x\r\n\r\n$ cat proj/b.py\r\nfrom proj.__init__ import x\r\n```\r\nrunning mypy will result in:\r\n```\r\n$ mypy proj --namespace-packages\r\nproj/__init__.py: error: Source file found twice under different module names: 'proj' and 'proj.__init__'\r\n```\r\n\r\nThis issue comes up at least twice in mypy_primer's corpus.\r\n\r\nThis is correct in that you do get two entries in sys.modules, but undesirable for this to block type checking","author":{"url":"https://github.com/hauntsaninja","@type":"Person","name":"hauntsaninja"},"datePublished":"2020-11-12T09:43:10Z","url":"https://github.com/python/mypy/issues/9716"}
| 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:177339bc-b0c7-38aa-eb71-32894e5c79f5 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B54E:D064:220D4CC:2E39648:6B0023FC |
| html-safe-nonce | 945f0498163ff50e9310d1371bca0d5d2d736f2929c17d057429c4231aa866d7 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNTRFOkQwNjQ6MjIwRDRDQzoyRTM5NjQ4OjZCMDAyM0ZDIiwidmlzaXRvcl9pZCI6IjE3NTkyMDQ3MDc3MjI2MDE0NjgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 3cf6de6178235c27a785205592810125a2c2dbec316f733f627235a0ee82f82f |
| hovercard-subject-tag | issue:741443415 |
| 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/9716/issue_layout |
| twitter:image | https://opengraph.githubassets.com/11f09ea57f88eb44d25c71c6c4cd6d1146a732b04c126c4445c7b2223ec3fe52/python/mypy/issues/9716 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/11f09ea57f88eb44d25c71c6c4cd6d1146a732b04c126c4445c7b2223ec3fe52/python/mypy/issues/9716 |
| og:image:alt | --namespace-packages runs into an issue if we import from __init__.py explicitly. For instance, given: . └── proj ├── __init__.py └── a.py $ cat proj/__init__.py x: int $ cat proj/a.py from .__init... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | hauntsaninja |
| 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