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

Provide library stubs (type hinting) for compatibility with Mypy (e.g.: typeshed) #240

Open
Maroloccio opened this issue Jan 5, 2020 · 4 comments

Comments

@Maroloccio
Copy link

At the moment the lack of type hinting requires turning off mypy checks. It would be helpful to offer library stubs.

@peterbrittain
Copy link
Owner

Looks like a good idea... Anyone willing to help out here?

@JPTIZ
Copy link

JPTIZ commented Dec 27, 2020

Is it just set typehints to the whole code? I can do it if it is the issue.

EDIT: ok, I went to check mypy errors and I think I got the real issue:

asciimatics/paths.py:9: error: Skipping analyzing 'future.utils': found module but no type hints or library stubs                                                                                                                              
asciimatics/paths.py:32: error: Unsupported dynamic base class "with_metaclass"                                                                                                                                                                
asciimatics/paths.py:187: error: Unsupported dynamic base class "with_metaclass" 

Unfotunately, for this one, it is not possible to install future-stubs because it depends on python-future, which does not exist anymore (apparently it was renamed to simply future).

A lot of mypy errors are from Py2 compatibility code. Since there's no more official support to Py2 since the beginning of this year, what if asciimatics dropped support to it, sticking only with Py3?

EDIT2: Ok, maybe dropping support just because typehinting is not working as expected seems overkill.

But updates: I'm getting there, I am! Found this and now the issue makes 100% sense to me: https://mypy.readthedocs.io/en/stable/stubs.html

@peterbrittain
Copy link
Owner

As I understand it, that is just an error saying that the stubs for futufe are missing and I'm not convinced that future-stubs is maintained from the fact it can't be installed.

Did you try any of the workarounds here (https://mypy.readthedocs.io/en/stable/running_mypy.html) - e.g. generating your own future stub files with stubgen?

@JPTIZ
Copy link

JPTIZ commented Jan 1, 2021

As I understand it, that is just an error saying that the stubs for futufe are missing and I'm not convinced that future-stubs is maintained from the fact it can't be installed.

Did you try any of the workarounds here (https://mypy.readthedocs.io/en/stable/running_mypy.html) - e.g. generating your own future stub files with stubgen?

It did work :) Submitted my current WIP

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants