Skip to content

TYPING: Enable --check-untyped-defs for MyPy #29493

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

Merged
merged 11 commits into from
Dec 19, 2019

Conversation

simonjayhawkins
Copy link
Member

I'll open a new issue for resolution of mypy errors per module, see https://gitter.im/pydata/pandas?at=5dc5cdf2091dd14a0e86103a and #28926 for process used for test modules.

cc @WillAyd @jbrockmendel

@simonjayhawkins simonjayhawkins added the Typing type annotations, mypy/pyright type checking label Nov 8, 2019
@simonjayhawkins simonjayhawkins added this to the 1.0 milestone Nov 8, 2019
@jbrockmendel
Copy link
Member

i have no objection, but am too ignorant on this topic to give a "lgtm"

@WillAyd
Copy link
Member

WillAyd commented Nov 9, 2019

On board with the change. Only consideration point is if we want this much customization in setup.cfg or if we should reinstate mypy.ini . Not sure it really matters but cc @jreback

@jbrockmendel
Copy link
Member

i like having setup.cfg as a one-stop-shop. IIUC the idea is that the stuff added here will be whittled down over time anyway

@simonjayhawkins
Copy link
Member Author

simonjayhawkins commented Nov 9, 2019

we had a brief discussion on this in #28914, the result #28914 (comment)

changing this now would disrupt open PRs for #28926, so would probably be better to put this on hold and clear them first.

@simonjayhawkins
Copy link
Member Author

I'll close this until a decision on #29493 (comment) is reached. Too much of a lag between generating the list and merging could cause CI failures.

@simonjayhawkins
Copy link
Member Author

@jreback DO NOT MERGE if any PRs adding type annotations have been added since 2ec7f2f. also once this is merged do not merge any PRs adding type annotations unless they have merged this patch.

@simonjayhawkins
Copy link
Member Author

list will be different for mypy 0.730, so closing til #29653 is merged.

@xhochy
Copy link
Contributor

xhochy commented Dec 3, 2019

@simonjayhawkins This can be reopened/reviewed/merged as #29653 is merged now?

@simonjayhawkins
Copy link
Member Author

@xhochy I'll reopen it later today for discussion. few things to consider:

mypy 0.750 is now released so may want to bump version on ci to stay current

check_untyped_defs with 0.740+ gives many more errors to resolve so may want to stick with 0.730 for a while. (from the blog http://mypy-lang.blogspot.com/ The self argument to methods without annotations is now correctly given the object’s type (instead of Any) when using check_untyped_defs.)

also need to consider the process to use for bumping mypy on ci once check_untyped_defs is enabled. Simplest solution would be just to update blacklist to exclude new failures and address in seperate PRs and accept than the coverage of check_untyped_defs takes a temporary hit on each mypy bump.

@xhochy
Copy link
Contributor

xhochy commented Dec 3, 2019

also need to consider the process to use for bumping mypy on ci once check_untyped_defs is enabled. Simplest solution would be just to update blacklist to exclude new failures and address in seperate PRs and accept than the coverage of check_untyped_defs takes a temporary hit on each mypy bump.

I would expect that long-term the number of new failures with mypy updates will decrease. We will have probably more typing in pandas, i.e. less untyped defs and mypy will also mature more and more where each release will bring in less change and thus far fewer new errors. Still, for roughly the next 6-12 months I would expect that we will have to go with the blacklist-new-failure-and-fix-in-followup-PRs way.

@WillAyd
Copy link
Member

WillAyd commented Dec 17, 2019

@simonjayhawkins I am fine with this so if no other feedback let's move forward - does the list of exclusions need refreshing?

@simonjayhawkins
Copy link
Member Author

OK, i'll give it 24hours and if no objections, i'll refresh the list and merge on green.

@TomAugspurger
Copy link
Contributor

+1

@simonjayhawkins simonjayhawkins merged commit 20e4c18 into pandas-dev:master Dec 19, 2019
proost pushed a commit to proost/pandas that referenced this pull request Dec 19, 2019
proost pushed a commit to proost/pandas that referenced this pull request Dec 19, 2019
AlexKirko pushed a commit to AlexKirko/pandas that referenced this pull request Dec 29, 2019
@simonjayhawkins simonjayhawkins mentioned this pull request Apr 10, 2020
@simonjayhawkins simonjayhawkins deleted the untyped-defs branch October 4, 2020 08:09
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.

Enable --check-untyped-defs for MyPy
5 participants