Title: mypy section now required in setup.cfg differs from documentation · Issue #9940 · python/mypy · GitHub
Open Graph Title: mypy section now required in setup.cfg differs from documentation · Issue #9940 · python/mypy
X Title: mypy section now required in setup.cfg differs from documentation · Issue #9940 · python/mypy
Description: Bug Report Existing setup.cfg with a section that looks like [mypy-myapp.mymodule] containing an ignore_errors = True setting is no longer picked up as expected by mypy 0.800. The behaviour documented at https://mypy.readthedocs.io/en/st...
Open Graph Description: Bug Report Existing setup.cfg with a section that looks like [mypy-myapp.mymodule] containing an ignore_errors = True setting is no longer picked up as expected by mypy 0.800. The behaviour documen...
X Description: Bug Report Existing setup.cfg with a section that looks like [mypy-myapp.mymodule] containing an ignore_errors = True setting is no longer picked up as expected by mypy 0.800. The behaviour documen...
Opengraph URL: https://github.com/python/mypy/issues/9940
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"mypy section now required in setup.cfg differs from documentation","articleBody":"**Bug Report**\r\n\r\nExisting setup.cfg with a section that looks like `[mypy-myapp.mymodule]` containing an `ignore_errors = True` setting is no longer picked up as expected by mypy 0.800.\r\n\r\nThe behaviour documented at https://mypy.readthedocs.io/en/stable/config_file.html#config-file-format indicates that a section `[mypy]` is optional for `setup.cfg` files. However with a recent change it is now required.\r\n\r\nPR #9114 introduces a change to skip setup.cfg to avoid another issue where use of setup.cfg was shadowing any additional user configs covered in #9113.\r\n\r\nTo maintain compatibility with existing configs potentially the check should be:\r\n```\r\n if (config_file in defaults.SHARED_CONFIG_FILES and\r\n not any(section.startswith(\"mypy-\") for section in parser.sections()))\r\n ....\r\n```\r\n\r\nIt may be preferred to deprecate the existing documented behaviour, and be able to rely on needing there always to be a `mypy` section instead of treating setup.cfg as special. In the short term however it might be better to add a deprecation notice when this is detected and retain compatibility with existing setup.cfg that do not include an `[mypy]` section for now.\r\n\r\n**To Reproduce**\r\n\r\n(Write your steps here:)\r\n\r\n1. Install mypy locally or via virtualenv\r\n2. clone https://github.com/python/mypy\r\n3. cd to mypy/test-data/packages/typedpkg\r\n4. Run mypy to confirm detect error\r\n ```\r\n mypy -p typedpkg\r\n ```\r\n5. Create a setup.cfg that should ignore these errors and execute mypy:\r\n ```\r\n cat \u003c\u003cEOF > setup.cfg\r\n [mypy-typedpkg.sample]\r\n ignore_errors = True\r\n EOF\r\n mypy -p typedpkg\r\n ```\r\n6. Replace with a setup.cfg that contains an empty `[mypy]`\r\n ```\r\n cat \u003c\u003cEOF > setup.cfg\r\n [mypy]\r\n\r\n [mypy-typedpkg.sample]\r\n ignore_errors = True\r\n EOF\r\n mypy -p typedpkg\r\n ```\r\n\r\n**Expected Behavior**\r\n\r\nError should be produce for the first execution of mypy, and success reported for the latter two\r\n\r\nOutput from step 4:\r\n```\r\ntypedpkg/sample.py:7: error: Incompatible return value type (got \"List[str]\", expected \"Tuple[str, ...]\")\r\nFound 1 error in 1 file (checked 5 source files)\r\n```\r\n\r\nOutput from step 5:\r\n```\r\nSuccess: no issues found in 5 source files\r\n```\r\n\r\nOutput from step 6:\r\n```\r\nSuccess: no issues found in 5 source files\r\n```\r\n\r\n**Actual Behavior**\r\n\r\nOutput from step 4:\r\n```\r\ntypedpkg/sample.py:7: error: Incompatible return value type (got \"List[str]\", expected \"Tuple[str, ...]\")\r\nFound 1 error in 1 file (checked 5 source files)\r\n```\r\n\r\nOutput from step 5:\r\n```\r\ntypedpkg/sample.py:7: error: Incompatible return value type (got \"List[str]\", expected \"Tuple[str, ...]\")\r\nFound 1 error in 1 file (checked 5 source files)\r\n```\r\n\r\nOutput from step 6:\r\n```\r\nSuccess: no issues found in 5 source files\r\n```\r\n\r\n**Your Environment**\r\n\r\n- Mypy version used: 0.800\r\n- Python version used: 3.9.1\r\n- Operating system and version: Ubuntu 20.04\r\n","author":{"url":"https://github.com/electrofelix","@type":"Person","name":"electrofelix"},"datePublished":"2021-01-22T14:38:39Z","url":"https://github.com/python/mypy/issues/9940"}
| 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:9ad27d1c-94ac-32c6-42c1-8097ad4c0020 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9ECC:2B41BC:E3D5D4:131E73B:6B00572A |
| html-safe-nonce | e767fd365c1490f89a86fa7313b1c81b7c6b5e4e20fb5a6db7240736a34fd986 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5RUNDOjJCNDFCQzpFM0Q1RDQ6MTMxRTczQjo2QjAwNTcyQSIsInZpc2l0b3JfaWQiOiI4MzY3NDk0NTg2ODEzMTQyODI2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | dadb8fc37b52cf1a5d93c33830e12ec6253f760eb537ba67b3e0f4375befbc35 |
| hovercard-subject-tag | issue:792055945 |
| 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/9940/issue_layout |
| twitter:image | https://opengraph.githubassets.com/d0f3220ef6340d598651d041362a32f20cd8e234e5c0b5e0466331b17681bc5d/python/mypy/issues/9940 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/d0f3220ef6340d598651d041362a32f20cd8e234e5c0b5e0466331b17681bc5d/python/mypy/issues/9940 |
| og:image:alt | Bug Report Existing setup.cfg with a section that looks like [mypy-myapp.mymodule] containing an ignore_errors = True setting is no longer picked up as expected by mypy 0.800. The behaviour documen... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | electrofelix |
| hostname | github.com |
| expected-hostname | github.com |
| None | 29be975efff6507a5d135de9c7d634cf7ff8f0c55222a64386ab3202209aaf73 |
| 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 | eacd927ba6112e3b01ba99c762bd699a4a4f5df7 |
| ui-target | canary-2 |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width