Skip to content

Conversation

@hauntsaninja
Copy link
Collaborator

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.

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.
@github-actions

This comment has been minimized.

@hauntsaninja hauntsaninja marked this pull request as draft January 3, 2026 00:22
@hauntsaninja
Copy link
Collaborator Author

Precedence logic needs more work

@github-actions

This comment has been minimized.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 3, 2026

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

Copy link
Member

@ilevkivskyi ilevkivskyi left a 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):
Copy link
Member

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")
Copy link
Member

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.
Copy link
Member

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
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: strict = true is incompatible with per-module configuration

2 participants