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

Type hints!!! #90

Open
ThatXliner opened this issue Jan 7, 2021 · 6 comments
Open

Type hints!!! #90

ThatXliner opened this issue Jan 7, 2021 · 6 comments

Comments

@ThatXliner
Copy link

https://kishstats.com/python/2019/01/07/python-type-hinting.html

https://docs.python.org/3/library/typing.html

@cclauss
Copy link

cclauss commented Aug 2, 2021

$ mypy --install-types --non-interactive .

progress/setup.py:3: error: Skipping analyzing "setuptools": found module but no type hints or library stubs
progress/setup.py:3: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
progress/progress/spinner.py:34: error: Incompatible types in assignment (expression has type "List[str]", base class "Spinner" defined the type as "Tuple[str, str, str, str]")
progress/progress/spinner.py:38: error: Incompatible types in assignment (expression has type "List[str]", base class "Spinner" defined the type as "Tuple[str, str, str, str]")
progress/progress/spinner.py:42: error: Incompatible types in assignment (expression has type "List[str]", base class "Spinner" defined the type as "Tuple[str, str, str, str]")
progress/progress/spinner.py:46: error: Incompatible types in assignment (expression has type "List[str]", base class "Spinner" defined the type as "Tuple[str, str, str, str]")
progress/progress/counter.py:48: error: Incompatible types in assignment (expression has type "Tuple[str, str, str, str, str]", base class "Stack" defined the type as "Tuple[str, str, str, str, str, str, str, str, str]")
progress/progress/bar.py:89: error: Incompatible types in assignment (expression has type "Tuple[str, str, str, str, str, str, str, str]", base class "IncrementalBar" defined the type as "Tuple[str, str, str, str, str, str, str, str, str]")
progress/progress/bar.py:93: error: Incompatible types in assignment (expression has type "Tuple[str, str, str, str, str]", base class "IncrementalBar" defined the type as "Tuple[str, str, str, str, str, str, str, str, str]")
Found 8 errors in 4 files (checked 7 source files)

@PaulConwayiii
Copy link

I can implement type hints. Will begin work later tonight and send a PR when ready

@PaulConwayiii
Copy link

AFAIK there is no way to implement type hints throughout the entire project and still maintain Python 2.6+ compatibility. The issue comes down to having non-literal types (lists, tuples). There is probably a way to make it work, but not cleanly. I also had not realized that when I made my PR that the typing module was introduced in Python 3.5, so that would break compatibility for older Python 3 versions if used.
Since Python 2.6+ compatibility is required currently, I say we close this issue until an explicit decision is made by verigak to ditch older Python versions

@cclauss
Copy link

cclauss commented Jul 11, 2022

Python 2 died 922 days ago on 1/1/2020 so I think it is time to move on... So we can show some progress.

@normanr
Copy link

normanr commented Jan 5, 2024

You can also provide type hints in .pyi stub files. Older versions of python just won't read them.

@cclauss
Copy link

cclauss commented Jan 5, 2024

The project’s name is progress so let’s make some progress by dropping all CPython versions that are no longer supported. Python 2 died 1,465 days ago on 1/1/2020. https://devguide.python.org/versions

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

No branches or pull requests

4 participants