Skip to content

Conversation

simonjayhawkins
Copy link
Member

follow up to #62327

The mypy setting local_partial_types restricts where mypy is allowed to infer a "partial type" from incomplete initialization. With this option enabled mypy will permit partial types only for variables that are local to functions. Module level and class attribute initializations that would otherwise produce a partial type become errors unless you provide an explicit annotation. This forces you to add annotations where mypy otherwise would have silently inferred a partly-known type.

@simonjayhawkins simonjayhawkins added the Typing type annotations, mypy/pyright type checking label Sep 16, 2025
@mroeschke mroeschke added this to the 3.0 milestone Sep 16, 2025
@mroeschke mroeschke merged commit 324b986 into pandas-dev:main Sep 16, 2025
45 checks passed
@mroeschke
Copy link
Member

Thanks @simonjayhawkins

@simonjayhawkins simonjayhawkins deleted the local-partial-types-2 branch September 17, 2025 09:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Typing type annotations, mypy/pyright type checking
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants