-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Support per-module strict config #20514
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Supersedes python#12174 I'd been rewriting that PR in place, but is easier to just make a new one. See python#18070 for the extra checks related change.
This comment has been minimized.
This comment has been minimized.
|
Precedence logic needs more work |
This comment has been minimized.
This comment has been minimized.
|
According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅ |
ilevkivskyi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this, I think this is an important feature. Here are few comments (I noticed this is still draft after reviewing, so submitting anyway). Btw what about inline configs? Is it easy to add support for # mypy: strict?
| } | ||
|
|
||
| for key in section: | ||
| for key in sorted(section, key=lambda k: -1 if k in {"strict"} else 0): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what is the point of using k in {"strict"} instead of k == "strict".
| options.cache_fine_grained = True | ||
|
|
||
| if options.strict_concatenate and not strict_option_set: | ||
| print("Warning: --strict-concatenate is deprecated; use --extra-checks instead") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change looks unrelated, why is it needed?
| self.strict_bytes = False | ||
|
|
||
| # Deprecated, use extra_checks instead. | ||
| # Make arguments prepended via Concatenate be truly positional-only. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above, looks unrelated.
| strict = true | ||
| warn_unused_ignores = false | ||
| \[mypy-strictermodule] | ||
| strict = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure I like this semantics, but also not against it. In any case, precedence w.r.t individual flags in current and top-level configs should be clearly documented.
Fixes #11401. Supersedes and closes #12174
I'd been rewriting that PR in place, but is easier to just make a new one.
See #18070 for the extra checks related change.