Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
[mypy]
# Is the project well-typed?
strict = False
# More lenient, but still safe, reassignments
allow_redefinition = true

@jaraco jaraco Jul 12, 2026

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm inclined to say let's leave this as the default. In general, it's an anti-pattern to redefine variables. In fact, should we in distutils just provide spot exemptions for this behavior?

@Avasam Avasam Jul 12, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Up to you! It happened in only 1 place in distutils (reference PR)

But personally use this option because it's what pyright and ty also do. AFAICT mypy didn't use to do it because it's more complex and had false-positive edge cases. Between 1.20 and 2.0 mypy even had 2 different implementations for allowing redefinitions, which got stabilised in 2.0. See https://mypy-lang.blogspot.com/2026/05/mypy-20-relased.html#:~:text=New%20Behavior%20for%20--allow-redefinition

It also requires local_partial_types which could lead to a bunch of new real-positives on older code, but that's now default in mypy 2.0

allow_redefinition is also planned to be turned on by default in an upcoming release, see https://mypy.readthedocs.io/en/stable/config_file.html#confval-allow_redefinition


in other words, the new implementation for mypy allowing redefinition should lead to less false-positives/idiosyncrasies, whilst keeping correctness. And is planned to become the default anyway.


# Early opt-in even when strict = False
warn_unused_ignores = True
Expand Down
6 changes: 1 addition & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,11 @@ enabler = [
type = [
# upstream

# Exclude PyPy from type checks (python/mypy#20454 jaraco/skeleton#187)
# Exclude PyPy from type checks (python/mypy#20454 jaraco/skeleton#187)
"pytest-mypy >= 1.0.1; platform_python_implementation != 'PyPy'",

# local
]


[tool.setuptools_scm]


[tool.pytest-enabler.mypy]
# Disabled due to jaraco/skeleton#143
Comment on lines -77 to -78

@Avasam Avasam Jul 10, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a PR open for most if not all. Issue is also now closed.

Loading