Title: Add ability to ignore a file or directory without modifying it · Issue #4675 · python/mypy · GitHub
Open Graph Title: Add ability to ignore a file or directory without modifying it · Issue #4675 · python/mypy
X Title: Add ability to ignore a file or directory without modifying it · Issue #4675 · python/mypy
Description: In a project I maintain, we vendor some third party Python code and the project includes generated files such as files created by python-versioneer. What I'd like to do is type check all files, including any new files, apart from those t...
Open Graph Description: In a project I maintain, we vendor some third party Python code and the project includes generated files such as files created by python-versioneer. What I'd like to do is type check all files, inc...
X Description: In a project I maintain, we vendor some third party Python code and the project includes generated files such as files created by python-versioneer. What I'd like to do is type check all files,...
Opengraph URL: https://github.com/python/mypy/issues/4675
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Add ability to ignore a file or directory without modifying it","articleBody":"In [a project](https://github.com/mesosphere/dcos-e2e) I maintain, we vendor some third party Python code and the project includes generated files such as files created by [python-versioneer](https://github.com/warner/python-versioneer).\r\n\r\nWhat I'd like to do is type check all files, including any new files, apart from those that I have explicitly ignored.\r\n\r\nRight now I have the following hack workaround:\r\n\r\n```python\r\nimport subprocess\r\nimport sys\r\n\r\n\r\ndef main() -> None:\r\n args = ['mypy', '.']\r\n ignore_paths = {\r\n 'src/dcos_e2e/_vendor',\r\n 'src/dcos_e2e/_version.py',\r\n 'versioneer.py',\r\n }\r\n result = subprocess.run(args=args, stdout=subprocess.PIPE)\r\n result_lines = result.stdout.decode().strip().split('\\n')\r\n error_lines = [\r\n line for line in result_lines\r\n if not any(line.startswith(path) for path in ignore_paths)\r\n ]\r\n print('\\n'.join(error_lines))\r\n sys.exit(int(bool(error_lines)))\r\n\r\n\r\nif __name__ == '__main__':\r\n main()\r\n```\r\n\r\nVarious tools have mechanisms for doing this, for example:\r\n\r\n```\r\nAdam@MacBook-Pro ~/D/m/d/dcos-e2e> cat .isort.cfg \r\n[settings]\r\nskip=_vendor,\r\n src/dcos_e2e/__init__.py,\r\n versioneer.py,\r\n setup.py,\r\n```\r\n\r\n```\r\n[flake8]\r\nexclude=./src/dcos_e2e/_vendor/,\r\n ./src/dcos_e2e/_version.py,\r\n ./versioneer.py,\r\n```\r\n\r\n```\r\nAdam@MacBook-Pro ~/D/m/d/dcos-e2e> cat pylintrc | grep ignore= -A 3\r\nignore=CVS,\r\n _vendor,\r\n versioneer.py,\r\n _version.py,\r\n```\r\n\r\nThank you for the software.","author":{"url":"https://github.com/adamtheturtle","@type":"Person","name":"adamtheturtle"},"datePublished":"2018-03-03T11:26:59Z","url":"https://github.com/python/mypy/issues/4675"}
| 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:64780a38-220a-9f28-06a4-d885799a14c1 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 99D2:1F52F6:28EA62:3761E5:6B0024E5 |
| html-safe-nonce | 4725a48f35d12700a2d456a752db22024a9b44929bfcfa6c107efd01a9966786 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5OUQyOjFGNTJGNjoyOEVBNjI6Mzc2MUU1OjZCMDAyNEU1IiwidmlzaXRvcl9pZCI6Ijc3MjAzMzc3ODgwNTQyODM0OTMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | e88727f76f8b16639190347c17ec3741d694a4ae33579ad877437d1a693b9de0 |
| hovercard-subject-tag | issue:301990750 |
| 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/4675/issue_layout |
| twitter:image | https://opengraph.githubassets.com/c2c8e3ae7bb9092215a5fcff332e7e8e7638d164eed74b9c0b2cf762fcfac5b9/python/mypy/issues/4675 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/c2c8e3ae7bb9092215a5fcff332e7e8e7638d164eed74b9c0b2cf762fcfac5b9/python/mypy/issues/4675 |
| og:image:alt | In a project I maintain, we vendor some third party Python code and the project includes generated files such as files created by python-versioneer. What I'd like to do is type check all files, inc... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | adamtheturtle |
| 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