Title: Cannot get type hints from python 2 packages · Issue #5620 · python/mypy · GitHub
Open Graph Title: Cannot get type hints from python 2 packages · Issue #5620 · python/mypy
X Title: Cannot get type hints from python 2 packages · Issue #5620 · python/mypy
Description: In mypy 0.620, there appears to be inconsistent type checking behaviour depending on how you specify the python version. This exists for handling -2 and --python-version 2 arguments and is explained well in issue #5576 and addressed by p...
Open Graph Description: In mypy 0.620, there appears to be inconsistent type checking behaviour depending on how you specify the python version. This exists for handling -2 and --python-version 2 arguments and is explaine...
X Description: In mypy 0.620, there appears to be inconsistent type checking behaviour depending on how you specify the python version. This exists for handling -2 and --python-version 2 arguments and is explaine...
Opengraph URL: https://github.com/python/mypy/issues/5620
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Cannot get type hints from python 2 packages","articleBody":"In mypy 0.620, there appears to be inconsistent type checking behaviour depending on how you specify the python version. This exists for handling `-2` and `--python-version 2` arguments and is explained well in [issue #5576](https://github.com/python/mypy/issues/5576#issuecomment-418872062) and addressed by pull request #5619. However, this inconsistency also occurs with specifying the python version in the a mypy.ini configuration file.\r\n\r\n```\r\n$ mypy --python-version 2.7 pkgb\r\npkgb/__main__.py:7: error: Argument 1 to \"this_is_a_typed_function\" has incompatible type \"int\"; expected \"unicode\"\r\n```\r\nThat above is expected, but when specifying the version in a config file.\r\n```\r\n$ echo -e \"[mypy]\\npython_version: 2.7\" | mypy --config-file /dev/stdin pkgb\r\npkgb/__main__.py:1: error: Cannot find module named 'pkga'\r\n```\r\n\r\nFor good measure, I included a python 2 print statement in the test package to ensure it is actually is running under python 2 mode ... [The example is included here](https://github.com/python/mypy/files/2383934/mypy5576.tar.gz). Extract the archive; in a Python 2 virtualenv, install the package in the `a` directory with `pip -e a`; run mypy on `pkgb`.\r\n\r\n---\r\n\r\nThe behaviour seems to come from looking for typing information in different site-packages between the two cases. With `--python-version 2.7`, a Python 2 interpreter's site-packages are used. With the configuration file, the current interpreter's site-packages are used.\r\n\r\nThe pull request #5578 was an attempt to resolve this inconsistency by using the Python 2 site-packages in both configurations, but it seems like this broke some things for some folks.","author":{"url":"https://github.com/sqwishy","@type":"Person","name":"sqwishy"},"datePublished":"2018-09-14T15:55:44Z","url":"https://github.com/python/mypy/issues/5620"}
| 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:27606687-a918-04d8-3a57-c7e013ce0994 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 862E:1CF166:2191D97:2DA47DB:6B00256F |
| html-safe-nonce | 995bc4ee182ce0a01c3bcc31bad8c9fd3151d97b96ad4b1b4731a57c481b2947 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NjJFOjFDRjE2NjoyMTkxRDk3OjJEQTQ3REI6NkIwMDI1NkYiLCJ2aXNpdG9yX2lkIjoiNTk5Mzk3NjY4NDE1NDQ2MzU5OSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 4de8296483fd13cfa271560d9bf324845a96fb7d128d29081bebd5bc169e2a9c |
| hovercard-subject-tag | issue:360361945 |
| 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/5620/issue_layout |
| twitter:image | https://opengraph.githubassets.com/4b114faeaa34192aac5af62b752d5da8a175213e27aa4cf75a13d9de33eb9344/python/mypy/issues/5620 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/4b114faeaa34192aac5af62b752d5da8a175213e27aa4cf75a13d9de33eb9344/python/mypy/issues/5620 |
| og:image:alt | In mypy 0.620, there appears to be inconsistent type checking behaviour depending on how you specify the python version. This exists for handling -2 and --python-version 2 arguments and is explaine... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | sqwishy |
| 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