mockafka-py
mockafka-py copied to clipboard
Type hints cause TypeError under Python 3.8
Describe the bug
Type hinting in Mockafka uses standard collection types as generics, eg, list[str], rather than the capitalised type alias from the typing module List[str]. This ability is only available in Python 3.8 when using the annotations future statement: from __future__ import annotations. Without the future statement, the code results in a type error.
See PEP 585.
To Reproduce Run the tests under Python 3.8. Running mypy under Python 3.8 will also identify the problem.
Expected behavior There are two options:
- Revert to the types from the
typingmodule, eg,Dictinstead ofdict - Add the future statement to affected files.
Screenshots If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
- OS: Fedora 38
- Python 3.8.18
Additional context Add any other context about the problem here.
Hi @MrkGrgsn ,
Thanks for bringing this up,
But in this version we just support python +3.9
But i will work on this issue later , if you have time it's great to help us in this issue 😄
In the CI
We just added python +3.9 for running tests
https://github.com/alm0ra/mockafka-py/blob/main/.github/workflows/python-app.yml
in this version we just support python +3.9
Ah, okay. I checked pyproject.toml before I submitted this report and I saw python = ">=3.8,<4.0" so I went ahead.
I'm happy to look at adding the future statement, it seems the forward-looking fix of the two options, but if you haven't been targeting 3.8 there may be other issues. I'll let you know what happens.
fixed inv0.1.56