Title: Editable installs are not recognized as having typing when using py.typed (setuptools v64 issue) · Issue #13392 · python/mypy · GitHub
Open Graph Title: Editable installs are not recognized as having typing when using py.typed (setuptools v64 issue) · Issue #13392 · python/mypy
X Title: Editable installs are not recognized as having typing when using py.typed (setuptools v64 issue) · Issue #13392 · python/mypy
Description: Bug Report mypy does not recognize that libraries installed as editable using pip are fully typed even though the py.typed file is correctly included. To Reproduce Working script which installs a NON-editable version of library: # create...
Open Graph Description: Bug Report mypy does not recognize that libraries installed as editable using pip are fully typed even though the py.typed file is correctly included. To Reproduce Working script which installs a N...
X Description: Bug Report mypy does not recognize that libraries installed as editable using pip are fully typed even though the py.typed file is correctly included. To Reproduce Working script which installs a N...
Opengraph URL: https://github.com/python/mypy/issues/13392
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Editable installs are not recognized as having typing when using py.typed (setuptools v64 issue)","articleBody":"\u003c!--\r\n If you're new to mypy and you're not sure whether what you're experiencing is a mypy bug, please see the \"Question and Help\" form\r\n instead.\r\n Please also consider:\r\n\r\n - checking our common issues page: https://mypy.readthedocs.io/en/stable/common_issues.html\r\n - searching our issue tracker: https://github.com/python/mypy/issues to see if\r\n it's already been reported\r\n - asking on gitter chat: https://gitter.im/python/typing\r\n-->\r\n\r\n**Bug Report**\r\n\r\n\u003c!--\r\nNote: If the problem you are reporting is about a specific library function, then the typeshed tracker is better suited\r\nfor this report: https://github.com/python/typeshed/issues\r\n-->\r\n\r\nmypy does not recognize that libraries installed as editable using pip are fully typed even though the `py.typed` file is correctly included.\r\n\r\n**To Reproduce**\r\n\r\nWorking script which installs a NON-editable version of library:\r\n```\r\n# create python environment with pip\r\nrm -rf nionui\r\ngit clone https://github.com/nion-software/nionui.git\r\npushd nionui\r\ngit checkout 0.6.4\r\npython -m pip install mypy numpy imageio types-pytz types-tzlocal types-setuptools\r\n# the next line is the only change between these two scripts\r\npython -m pip install nionutils==0.4.4\r\nmypy --namespace-packages --ignore-missing-imports --follow-imports=silent --install-types --non-interactive --strict --no-warn-redundant-casts --no-warn-unused-ignores -p nion.ui -p nionui_app.nionui_examples\r\npopd\r\n# success\r\n```\r\n\r\nFailing version which installs an editable version of a library:\r\n```\r\n# create python environment with pip\r\nrm -rf nionui\r\ngit clone https://github.com/nion-software/nionui.git\r\npushd nionui\r\ngit checkout 0.6.4\r\npython -m pip install mypy numpy imageio types-pytz types-tzlocal types-setuptools nionutils\r\n# the next line is the only change between these two scripts\r\npython -m pip install -e git+https://github.com/nion-software/nionutils.git@0.4.4#egg=nionutils\r\nmypy --namespace-packages --ignore-missing-imports --follow-imports=silent --install-types --non-interactive --strict --no-warn-redundant-casts --no-warn-unused-ignores -p nion.ui -p nionui_app.nionui_examples\r\npopd\r\n# failure\r\n```\r\n\r\n\r\n**Expected Behavior**\r\n\r\n\u003c!--\r\n How did you expect your project to behave?\r\n It’s fine if you’re not sure your understanding is correct.\r\n Write down what you thought would happen. If you just expected no errors, you can delete this section.\r\n-->\r\n\r\nThese should work the same. The source client and underlying library are the same in both cases except one is installed as an editable install.\r\n\r\n**Actual Behavior**\r\n\r\nThe failing version gives type errors:\r\n\r\n```\r\nnion/ui/DrawingContext.py:790: error: Returning Any from function declared to return \"Optional[str]\"\r\nnion/ui/DrawingContext.py:794: error: Returning Any from function declared to return \"Optional[str]\"\r\nnion/ui/DrawingContext.py:798: error: Returning Any from function declared to return \"Optional[str]\"\r\nnion/ui/CanvasItem.py:2780: error: Class cannot subclass \"Observable\" (has type \"Any\")\r\nnion/ui/UserInterface.py:3217: error: Returning Any from function declared to return \"int\"\r\nnion/ui/UserInterface.py:3224: error: Returning Any from function declared to return \"int\"\r\nnion/ui/UserInterface.py:3620: error: Class cannot subclass value of type \"Any\"\r\nnion/ui/UserInterface.py:3634: error: Class cannot subclass value of type \"Any\"\r\nnion/ui/Widgets.py:382: error: Returning Any from function declared to return \"AbstractSet[int]\"\r\nnion/ui/Declarative.py:949: error: Class cannot subclass \"Observable\" (has type \"Any\")\r\nnion/ui/Declarative.py:1112: error: Class cannot subclass \"Observable\" (has type \"Any\")\r\nnion/ui/GridCanvasItem.py:256: error: Returning Any from function declared to return \"int\"\r\nFound 12 errors in 6 files (checked 51 source files)\r\n```\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.971\r\n- Mypy command-line flags: see script\r\n- Mypy configuration options from `mypy.ini` (and other config files): None\r\n- Python version used: Python 3.10.5\r\n- Operating system and version: macOS, Ubuntu 20, didn't try Windows yet\r\n\r\n\u003c!--\r\nYou can freely edit this text, please remove all the lines\r\nyou believe are unnecessary.\r\n-->\r\n\r\nAlso note: this behavior seems to have changed around 2022-08-10 to 2022-08-11. Something in the Python ecosystem seems to have changed. Nevertheless, this seems to be a bug in `mypy` since it is all about whether `py.typed` is found or not.","author":{"url":"https://github.com/cmeyer","@type":"Person","name":"cmeyer"},"datePublished":"2022-08-12T00:51:03Z","url":"https://github.com/python/mypy/issues/13392"}
| 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:f324835e-9d92-5ae6-7f28-55dae460d5f3 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C8EA:3FDF0C:48EA1E:617F0C:6B002CFB |
| html-safe-nonce | 369a26d43ea8aadc57222e151279fd9bc659a9ab9d4657f66c1c65fd3ad0ecf9 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDOEVBOjNGREYwQzo0OEVBMUU6NjE3RjBDOjZCMDAyQ0ZCIiwidmlzaXRvcl9pZCI6IjI5NjkzOTQzNjU2NTY0NzY5MjMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | e50947fe104b1d6e07657c80b4f0c859afd60a2fdd2b79fa05a3f2e9c8236c0c |
| hovercard-subject-tag | issue:1336631371 |
| 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/13392/issue_layout |
| twitter:image | https://opengraph.githubassets.com/f44ce7e521673b007ef33b1df81c421f5db63ca979b88320191afbb61658026c/python/mypy/issues/13392 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/f44ce7e521673b007ef33b1df81c421f5db63ca979b88320191afbb61658026c/python/mypy/issues/13392 |
| og:image:alt | Bug Report mypy does not recognize that libraries installed as editable using pip are fully typed even though the py.typed file is correctly included. To Reproduce Working script which installs a N... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | cmeyer |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7d0829bbde9e48b2486cb5dd6d147896eb01d32134627091f818958a935ef3f0 |
| 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 | f3f3a43ca095cdea3abbb394112e971f9fdb94fa |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width