Title: Please revert new source finding behaviour or add some way to exclude paths · Issue #9981 · python/mypy · GitHub
Open Graph Title: Please revert new source finding behaviour or add some way to exclude paths · Issue #9981 · python/mypy
X Title: Please revert new source finding behaviour or add some way to exclude paths · Issue #9981 · python/mypy
Description: Bug Report I think the PR "find_sources: find build sources recursively" #9614 is a good and worthwhile change. But in practice it causes surprising regressions for many users. It's not just spurious warnings, mypy often refuses to run e...
Open Graph Description: Bug Report I think the PR "find_sources: find build sources recursively" #9614 is a good and worthwhile change. But in practice it causes surprising regressions for many users. It's not just spurio...
X Description: Bug Report I think the PR "find_sources: find build sources recursively" #9614 is a good and worthwhile change. But in practice it causes surprising regressions for many users. It's n...
Opengraph URL: https://github.com/python/mypy/issues/9981
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Please revert new source finding behaviour or add some way to exclude paths","articleBody":"**Bug Report**\r\n\r\nI think the PR \"find_sources: find build sources recursively\" #9614 is a good and worthwhile change. But in practice it causes surprising regressions for many users. It's not just spurious warnings, mypy often refuses to run entirely (\"*Found 1 error in 1 file (errors prevented further checking)*\").\r\n\r\nIn many cases, there aren't good work-arounds, short of restructuring one's project directory tree.\r\n\r\nI think the magnitude of this issue is large enough that the best course of action is to revert the change and issue a hotfix release, until some work-around for those cases is created.\r\n\r\nThere are many examples of common things that throw off mypy:\r\n1. Creating even an empty virtualenv causes mypy to fail to run.\r\n2. Having `__init__.py` files under any directory that's not a valid Python module name.\r\n3. Many npm packages include .py files, which get installed in `node_modules` directory, some of which may have Python 2.7 code that causes syntax errors.\r\n4. Having copies of directories or files with same `.py` file names.\r\n\r\nSome more examples in comments here: https://github.com/python/mypy/issues/4675#issuecomment-765586163\r\n\r\n**To Reproduce**\r\n\r\n```\r\n% mkdir test1\r\n% cd test1\r\n% echo 'a: str = 10' > test.py\r\n% mkdir -p test/invalid-module\r\n% touch test/invalid-module/__init__.py\r\n% mypy .\r\ninvalid-module is not a valid Python package name\r\n```\r\n\r\n```\r\n% mkdir test2\r\n% cd test2\r\n% python3 -m venv ./venv\r\n% echo 'a: str = 10' > test.py\r\n% mypy .\r\nvenv/lib/python3.9/site-packages/setuptools/_distutils/command/bdist_msi.py:355: error: expected an indented block\r\nFound 1 error in 1 file (errors prevented further checking)\r\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n```\r\n\r\n```\r\n% mkdir test3\r\n% cd test3\r\n% echo 'a: str = 10' > test.py\r\n% npm install gulp-sass\r\n% mypy .\r\nnode_modules/node-sass/node_modules/node-gyp/gyp/pylib/gyp/__init__.py:37: error: invalid syntax\r\nFound 1 error in 1 file (errors prevented further checking)\r\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n```\r\n\r\n```\r\n% mkdir test4\r\n% cd test4\r\n% echo 'a: str = 10' > test.py\r\n% mkdir backup\r\n% cp test.py backup/\r\n% mypy .\r\ntest.py: error: Duplicate module named 'test' (also at './backup/test.py')\r\ntest.py: error: Are you missing an __init__.py?\r\nFound 2 errors in 1 file (errors prevented further checking)\r\n```\r\n\r\n**Your Environment**\r\n\r\n- Mypy version used: 0.800\r\n- Mypy command-line flags: none\r\n- Mypy configuration options from `mypy.ini` (and other config files): none\r\n- Python version used: 3.9\r\n- Operating system and version: macOS 10.15\r\n","author":{"url":"https://github.com/intgr","@type":"Person","name":"intgr"},"datePublished":"2021-01-27T15:47:43Z","url":"https://github.com/python/mypy/issues/9981"}
| 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:48c693e6-dc98-7b62-9f06-2e7af8d244b3 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8D82:22E601:3DD7F5:5352E3:6B002AB3 |
| html-safe-nonce | d466b75522a4dac8ed2c915c9504430615c5df6eed0a1b799d976c8301d7171b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4RDgyOjIyRTYwMTozREQ3RjU6NTM1MkUzOjZCMDAyQUIzIiwidmlzaXRvcl9pZCI6IjE1NzczOTk2MDk2NjYzMTY5NzkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | f71b5714c1d40727394574e34890210d68b50a2facf7f0f05842ca02d9e39274 |
| hovercard-subject-tag | issue:795218333 |
| 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/9981/issue_layout |
| twitter:image | https://opengraph.githubassets.com/af003075c1c06b74f6edde28dfb1e746f6dd39bc959133ed39dc396362c885d8/python/mypy/issues/9981 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/af003075c1c06b74f6edde28dfb1e746f6dd39bc959133ed39dc396362c885d8/python/mypy/issues/9981 |
| og:image:alt | Bug Report I think the PR "find_sources: find build sources recursively" #9614 is a good and worthwhile change. But in practice it causes surprising regressions for many users. It's not just spurio... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | intgr |
| 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