Skip to content
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

Make mypy_plugin compatible with mypy>=0.730 #28

Merged
merged 3 commits into from
Jan 7, 2020

Conversation

wchresta
Copy link
Collaborator

@wchresta wchresta commented Dec 28, 2019

This introduces a new hook to change the type mypy sees before the semantic analyzer runs. This is briefly discussed in #21

The other issues raised in my comment turned out to be bugs that already existed for the old mypy version, too. These are not addressed with this fix.

This has been tested with mypy==0.711 and mypy=0.761

* Removed SimpleBuffer since it seems unnecessary atm
* This avoids type errors down the line
Copy link
Owner

@jspahrsummers jspahrsummers left a comment

Choose a reason for hiding this comment

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

Thanks, this looks good! Just the one minor comment, really.

I've added you as a collaborator on the repository, since you've been doing so much great work. Feel free to merge at will. 😄

requirements.txt Outdated
@@ -1,5 +1,5 @@
yapf==0.27.0
mypy==0.711
mypy>=0.711
Copy link
Owner

Choose a reason for hiding this comment

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

I'd prefer for requirements.txt to actually be a snapshot of known-working dependencies, so anyone can pip install -r requirements.txt and know that their setup should work. This range leaves open the possibility that it may break again the future.

How about something like, e.g.:

Suggested change
mypy>=0.711
mypy>=0.711, <=0.761

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Alright, done :)

* This fixes issue 21
* New type_analyze_hook to fix types before mypy's semantic analyzer runs
* _get_and_delete_cases defers if it encounters PlaceholderNodes
@wchresta wchresta merged commit 51e8256 into jspahrsummers:master Jan 7, 2020
@wchresta wchresta deleted the fix_issue_21 branch January 7, 2020 02:52
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.

None yet

2 participants