Title: Circular import + reexport = "error: Module '...' has no attribute '..."? · Issue #4049 · python/mypy · GitHub
Open Graph Title: Circular import + reexport = "error: Module '...' has no attribute '..."? · Issue #4049 · python/mypy
X Title: Circular import + reexport = "error: Module '...' has no attribute '..."? · Issue #4049 · python/mypy
Description: This is a minimal test case replicating what I'm experiencing in a larger project: % tree . └── asd ├── __init__.py ├── one.py └── two.py 2 directories, 6 files % cat asd/__init__.py from asd.one import One from asd.two import Two % cat ...
Open Graph Description: This is a minimal test case replicating what I'm experiencing in a larger project: % tree . └── asd ├── __init__.py ├── one.py └── two.py 2 directories, 6 files % cat asd/__init__.py from asd.one i...
X Description: This is a minimal test case replicating what I'm experiencing in a larger project: % tree . └── asd ├── __init__.py ├── one.py └── two.py 2 directories, 6 files % cat asd/__init__.py from asd.o...
Opengraph URL: https://github.com/python/mypy/issues/4049
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Circular import + reexport = \"error: Module '...' has no attribute '...\"?","articleBody":"This is a minimal test case replicating what I'm experiencing in a larger project:\r\n\r\n```\r\n% tree\r\n.\r\n└── asd\r\n ├── __init__.py\r\n ├── one.py\r\n └── two.py\r\n\r\n2 directories, 6 files\r\n\r\n% cat asd/__init__.py \r\nfrom asd.one import One\r\nfrom asd.two import Two\r\n\r\n% cat asd/one.py \r\nclass One:\r\n pass\r\n\r\n% cat asd/two.py \r\nfrom asd import One\r\n\r\nclass Two:\r\n pass\r\n```\r\n\r\nPython can work with it:\r\n\r\n```\r\n% python -c 'from asd import Two; print(Two)'\r\n\u003cclass 'asd.two.Two'>\r\n```\r\n\r\nmypy, however, doesn't like it:\r\n\r\n```\r\n% mypy .\r\nasd/two.py:1: error: Module 'asd' has no attribute 'One'\r\n```\r\n\r\nIt fails all the same when I change ``__init__.py`` to use ``import .. as ..`` (I saw this pattern mentioned in https://github.com/python/mypy/issues/3981):\r\n\r\n```\r\n% cat asd/__init__.py \r\nfrom asd.one import One as One\r\nfrom asd.two import Two as Two\r\n```\r\n\r\nApologies if there's already an issue filled for this, I searched for one briefly and haven't found any.\r\n\r\nmypy 0.521, CPython 3.6.2","author":{"url":"https://github.com/jstasiak","@type":"Person","name":"jstasiak"},"datePublished":"2017-10-03T12:27:59Z","url":"https://github.com/python/mypy/issues/4049"}
| 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:154f8830-08ac-b22f-7802-2d24c4d37567 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B692:25F127:2E4854:3F1D91:6B006A41 |
| html-safe-nonce | abcfc21ad782bf3295defe18055dbdb6c32204ab73b02347a5a500f560a6e4c2 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNjkyOjI1RjEyNzoyRTQ4NTQ6M0YxRDkxOjZCMDA2QTQxIiwidmlzaXRvcl9pZCI6IjMyMDAwMDIxODkyNTQ3NDg3MzgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 73af4e6364b1c4490b0b26d97d5c012efe0a6b6dca6edd144bbb3017cf789de0 |
| hovercard-subject-tag | issue:262408306 |
| 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/4049/issue_layout |
| twitter:image | https://opengraph.githubassets.com/6fd8d5b34e9f809d4cad56d2b064b3caf757f5fbffbd009c5f76be0e1abe4a5e/python/mypy/issues/4049 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/6fd8d5b34e9f809d4cad56d2b064b3caf757f5fbffbd009c5f76be0e1abe4a5e/python/mypy/issues/4049 |
| og:image:alt | This is a minimal test case replicating what I'm experiencing in a larger project: % tree . └── asd ├── __init__.py ├── one.py └── two.py 2 directories, 6 files % cat asd/__init__.py from asd.one i... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jstasiak |
| hostname | github.com |
| expected-hostname | github.com |
| None | 6527e91c60c0b29d16606ff32ac5df8ecdc37a2a62205ea057a14d7762c870fa |
| 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 | 46f1cd2ae3cd8ae1a81019b5d619742e76f13bbd |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width