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

Update and pin mypy and add CI #87

Merged
merged 12 commits into from
Oct 10, 2022
Merged

Update and pin mypy and add CI #87

merged 12 commits into from
Oct 10, 2022

Conversation

rchl
Copy link
Member

@rchl rchl commented Sep 16, 2022

Adding Sublime's Text own Python Lib directory broke mypy with an error like:

/Applications/Sublime Text.app/Contents/MacOS/Lib/python33 is in the MYPYPATH. Please remove it.
See https://mypy.readthedocs.io/en/stable/running_mypy.html#how-mypy-handles-imports for more info

Instead of including ST's Lib directory, bundle ST stubs.

@rchl
Copy link
Member Author

rchl commented Sep 16, 2022

To be fair I don't really understand why old approach broke mypy.
In theory these days it would be better to use ST's own files as that would be always up to date and those include types now...

The link doesn't really explain this issue very well and even quick glance at mypy's code is not making it clear.

@rwols @jfcherng @predragnikolic any idea?

@rchl
Copy link
Member Author

rchl commented Sep 16, 2022

Looked at mypy's code a bit more and I think I understand it now.

Mypy doesn't like when path in MYPYPATH is already included in PYTHONPATH. I need the path in PYTHONPATH so that Jedi can analyze types so the solution in theory is to only add paths to PYTHONPATH. And that sort of works, Mypy can see the types too but then it complains about another type-related thing:

Screenshot 2022-09-16 at 21 56 04

And https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-library-stubs-or-py-typed-marker explains why it behaves like that...

@rchl
Copy link
Member Author

rchl commented Sep 16, 2022

The initial error is still there with those changes because the paths are still duplicated...

This is so stupid, mypy shouldn't be complaining about that...

@rchl
Copy link
Member Author

rchl commented Sep 16, 2022

Seems like the whole issue is just a regression in mypy...
python/mypy#7604 (comment)

@predragnikolic
Copy link
Member

Will we close this PR because this is a regression in mypy?

@rchl
Copy link
Member Author

rchl commented Sep 19, 2022

There are some useful bits here still and also I'm not sure if I should pin mypy version to resolve this issue for existing users...

@rchl
Copy link
Member Author

rchl commented Sep 19, 2022

But I guess I will not go with bundling external types if I don't have to.

@rchl rchl changed the title Fix issue with sublime_py_files_dir breaking Mypy Update and pin mypy and add CI Oct 10, 2022
@rchl rchl merged commit bad8b3e into master Oct 10, 2022
@rchl rchl deleted the fix/mypy branch October 10, 2022 19:08
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